Не удалось найти версию, которая удовлетворяет требованию
я устанавливаю несколько пакетов Python в Ubuntu 12.04, используя следующие requirements.txt
file:
numpy>=1.8.2,<2.0.0
matplotlib>=1.3.1,<2.0.0
scipy>=0.14.0,<1.0.0
astroML>=0.2,<1.0
scikit-learn>=0.14.1,<1.0.0
rpy2>=2.4.3,<3.0.0
и эти две команды:
$ pip install --download=/tmp -r requirements.txt
$ pip install --user --no-index --find-links=/tmp -r requirements.txt
(первый загружает пакеты, а второй устанавливает их).
процесс часто останавливается с ошибкой:
Could not find a version that satisfies the requirement <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2)) (from versions: )
No matching distribution found for <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2))
который я исправляю вручную с:
pip install --user <package>
а затем запустить второй
7955
5
5 ответов:
этот подход (имея все зависимости в каталоге и не загружая из индекса) работает только тогда, когда каталог содержит все пакеты. Поэтому каталог должен содержать все зависимости, но также и все пакеты, от которых зависят эти зависимости (например,
six
,pytz
etc).поэтому вы должны вручную включить их в
requirements.txt
(Так что первый шаг загружает их явно) или вы должны установить все пакеты с помощью PyPI, а затемpip freeze > requirements.txt
сохранить список всех необходимых пакетов.
попробуйте установить flask через powershell, используя следующую команду.
>>pip install --isolated Flask
Это позволит избежать установки переменных окружения и конфигурации пользователя.
после 2 часов поисков, я нашел способ исправить это с помощью всего одной линии команды. Вам нужно знать версию пакета (просто найдите версию пакета).
:
python3 -m pip install --pre --upgrade PACKAGE==VERSION.VERSION.VERSION
Не всегда, но в некоторых случаях пакет уже существует. Например — getpass. Он не указан в «pip list», но его можно импортировать и использовать:
Если я пытаюсь pip установить getpass я получаю следующее сообщение об ошибке:
«Не удалось найти версию, удовлетворяющую требованию getpass»
Sometimes you get an error when you’re trying to install a Python package
using pip. It looks like this:
Could not find a version that satisfies the requirement (from versions:)
No matching distribution found for
Some probable reasons for this error are:
-
PyPI server isn’t responding to your requests. It can happen either because
the PyPI server is down or because it has blacklisted your IP address. This
happened to me once when I was trying installing packages on a server.
This can be fixed by using a proxy with pip. See the solution below. -
You’re running an older pip (especially on Mac). This can be fixed by
upgrading your pip.
See this post on Stack Overflow.
Thanks to Anupam Jain who pointed this in a comment. -
The package you’re trying to install is not available for your Python version.
-
The package is not available for your operating system. This is a rare case
and only happens when the package is not pure-Python, i.e. it’s been
partially written in C or Cython. Such a package needs to be compiled for
every operating system (Windows/Mac/Linux) and architecture (32-bit/64-bit).
Suppose a package has only been compiled for Windows 64-bit, then you’ll get
this error if you try to install it on Windows 32-bit, or any other
OS. -
The package is not present on PyPI server. In this case pip will not work. So
you’ll have to download and install the package manually from Github or wherever
it is available.
Solution¶
I had this issue because PyPI server had blacklisted the IP
of my hosting provider, the obvious solution was to make pip
install via a proxy.
But to see if that’s also the case with you, you can test it like this:
$ curl https://pypi.org
The requestors Network has been blacklisted due to excessive request volume.
If you are a hosting customer, please contact your hosting company's support.
If you are the hosting company, please contact infrastructure-staff@python.org to resolve
If you see the message similar to above, that means your IP has also been
blacklisted by https://pypi.org.
If you don’t see this message then the reason for the pip error could be that you’re using
an older version. See this post on Stack Overflow
for a solution.
Anyways, this can be fixed by using a proxy with pip.
Supplying a proxy address to pip
is easy:
$ pip install -r requirements.txt --proxy address:port
Above, address
and port
are IP address and port of the proxy.
To find proxies, just search Google for proxy list.
Other things that I tried¶
These are some other things that I tried to get rid of this issue.
Although they didn’t work for me, but they might work for you.
- Changing DNS resolver of my server.
This makes sense if your server’s DNS resolver can’t find PyPI servers. - Reconfiguring SSL, reinstalling CA certificates.
This makes sense if you don’t have updated CA certificates which are used by
PyPI servers. - Downloading packages using
wget
.
This is an alternative way to install Python packages. Download them viawget
and then install them usingpython setup.py install
. In my case, the server was
blacklisted by PyPI so I was getting a 403 Forbidden error. - Downloading packages using
curl
.
Alternative towget
. In my case I didn’t get a 403 error but rather it just
created invalid tarball files, instead of actually downloading them. - Downloading packages using
git
orhg
.
If your desired packages havegit
orhg
repositories that you can clone, this
is a good workaround.
Hello,
I’m trying to follow a Python 3.6 tutorial that wants me to install the matplotlib. But, everytime I try to install it within the Python Environments window of VS 2017 I get the following in the Output window:
—— Installing ‘matplotlib’ ——
Collecting matplotlib
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)’),)’: /simple/matplotlib/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)’),)’: /simple/matplotlib/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)’),)’: /simple/matplotlib/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)’),)’: /simple/matplotlib/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)’),)’: /simple/matplotlib/
Could not fetch URL https://pypi.org/simple/matplotlib/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=’pypi.org’, port=443): Max retries exceeded with url: /simple/matplotlib/ (Caused by SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed (_ssl.c:841)’),)) — skipping
Could not find a version that satisfies the requirement matplotlib (from versions: )
No matching distribution found for matplotlib
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=’pypi.org’, port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed (_ssl.c:841)’),)) — skipping
—— Failed to install ‘matplotlib’ ——
Does anyone know how to fix this? I would appreciate any help.
I did find an article that said this:
You can ignore SSL errors by setting pypi.org and files.pythonhosted.org as trusted hosts.
$ pip install —trusted-host pypi.org —trusted-host files.pythonhosted.org <package_name>
I’m not sure how I would manually type that pip command in VS 2017. Can it be done? And, that isn’t really a solution — it appears to be a work around.
Thank you very much!!
PS: I tried to update PIP from 10.0.1 to 18.1 and got the same certificate errors.
-
Edited by
Tuesday, November 27, 2018 7:56 PM