I have a difficult time using pip to install almost anything. I'm new to coding, so I thought maybe this is something I've been doing wrong and have opted out to easy_install to get most of what I needed done, which has generally worked. However, now I'm trying to download the nltk library, and neither is getting the job done.
I tried entering
sudo pip install nltk
but got the following response:
/Library/Frameworks/Python.framework/Versions/2.7/bin/pip run on Sat May 4 00:15:38 2013
Downloading/unpacking nltk
Getting page https://pypi.python.org/simple/nltk/
Could not fetch URL [need more reputation to post link]: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL [need more reputation to post link]/simple/nltk/ when looking for download links for nltk
Getting page [need more reputation to post link]/simple/
Could not fetch URL https://pypi.python. org/simple/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL [need more reputation to post link] when looking for download links for nltk
Cannot fetch index base URL [need more reputation to post link]
URLs to search for versions for nltk:
* [need more reputation to post link]
Getting page [need more reputation to post link]
Could not fetch URL [need more reputation to post link]: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL [need more reputation to post link] when looking for download links for nltk
Could not find any downloads that satisfy the requirement nltk
No distributions at all found for nltk
Exception information:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/basecommand.py", line 139, in main
status = self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/commands/install.py", line 266, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 1026, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/index.py", line 171, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for nltk
--easy_install installed fragments of the library and the code ran into trouble very quickly upon trying to run it.
Any thoughts on this issue? I'd really appreciate some feedback on how I can either get pip working or something to get around the issue in the meantime.
This question is related to
python
pip
nltk
easy-install
Just uninstall and reinstall pip packages it will workout for you guys.
Mac os version: high Sierra 10.13.6
python version: 3.7
So I uninstalled the older pip and installed the newest version10.0.0 by entering this:
python3 -m pip uninstall pip setuptools
curl https://bootstrap.pypa.io/get-pip.py | python3
Now my problem was solved. If you are using the python2, you can substitute the python3 with python. I hope it also works for you.
To install any other package I have to use the latest version of pip, since the 9.0.1
has this SSL problem. To upgrade the pip by pip itself, I have to solve this SSL problem first.
To jump out of this endless loop, I find this only way that works for me.
.whl
file of the latest version.sudo pip install pip-10.0.1-py2.py3-none-any.whl
Now the pip is the latest version and can install anything.
I solved this issue with the following steps (on sles 11sp2)
zypper remove pip
easy_install pip=1.2.1
pip install --upgrade scons
Here are the same steps in puppet (which should work on all distros)
package { 'python-pip':
ensure => absent,
}
exec { 'python-pip':
command => '/usr/bin/easy_install pip==1.2.1',
require => Package['python-pip'],
}
package { 'scons':
ensure => latest,
provider => pip,
require => Exec['python-pip'],
}
You can also use conda to install packages: See http://conda.pydata.org
conda install nltk
The best way to use conda is to download Miniconda, but you can also try
pip install conda
conda init
conda install nltk
I had this with PyCharm and upgrading pip to 10.0.1 broke pip with "'main' not found in module" error.
I could solve this problem by installing pip 9.0.3 as seen in some other thread. These are the steps I did:
Everything started to work after that.
If you're connecting through a proxy, execute export https_proxy=<your_proxy>
(on Unix or Git Bash) and then retry installation.
If you're using Windows cmd, this changes to set https_proxy=<your_proxy>
.
I had the same problem. I just updated the python from 2.7.0 to 2.7.15. It solves the problem.
You can download here.
I found it sufficient to specify the pypi host as trusted. Example:
pip install --trusted-host pypi.python.org pytest-xdist
pip install --trusted-host pypi.python.org --upgrade pip
This solved the following error:
Could not fetch URL https://pypi.python.org/simple/pytest-cov/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600) - skipping
Could not find a version that satisfies the requirement pytest-cov (from versions: )
No matching distribution found for pytest-cov
Update April 2018: To anyone getting the TLSV1_ALERT_PROTOCOL_VERSION error: it has nothing to do with trusted-host/verification issue of the OP or this answer. Rather the TLSV1 error is because your interpreter does not support TLS v1.2, you must upgrade your interpreter. See for example https://news.ycombinator.com/item?id=13539034, http://pyfound.blogspot.ca/2017/01/time-to-upgrade-your-python-tls-v12.html and https://bugs.python.org/issue17128.
Update Feb 2019: For some it may be sufficient to upgrade pip. If the above error prevents you from doing this, use get-pip.py. E.g. on Linux,
curl https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
More details at https://pip.pypa.io/en/stable/installing/.
Pypi removed support for TLS versions less than 1.2
You need to re-install Pip, do
curl https://bootstrap.pypa.io/get-pip.py | python
or for global Python:
curl https://bootstrap.pypa.io/get-pip.py | sudo python
For me, the latest pip (1.5.6) works fine with the insecure nltk package if you just tell it not to be so picky about security:
pip install --upgrade --force-reinstall --allow-all-external --allow-unverified ntlk nltk
If it is only about nltk, I once faced similar problem. Try following guide for installation. Install NLTK
If you are sure it doesn't work with any other module, you may have problem with different versions of Python installed.
Or Give It a Try to see if it says pip is already installed.:
sudo apt-get install python-pip python-dev build-essential
and see if it works.
I solved this issue by update Python3 Virtualenv on my mac.
I reference the site https://gist.github.com/pandafulmanda/730a9355e088a9970b18275cb9eadef3
brew install python3
pip3 install virtualenv
As posted above by blackjar, the below lines worked for me
pip --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org install xxx
You need to give all three --trusted-host options
. I was trying with only the first one after looking at the answers but it didn't work for me like that.
macOS Sierra 10.12.6. Wasn't able to install anything through pip (python installed through homebrew). All the answers above didn't work.
Eventually, upgrade from python 3.5 to 3.6 worked.
brew update
brew doctor #(in case you see such suggestion by brew)
then follow any additional suggestions by brew, i.e. overwrite link to python.
I did the following on Windows 7 to solve this problem.
c:\Program Files\Python36\Scripts> pip install beautifulsoup4 --trusted-host *
The --trusted-host seems to fix the SSL issue and * means every host.
Of course this does not work because you get other errors since there is no version that satisfies the requirement beautifulsoup4, but I don't think that issue is related to the general question.
I used pip3 version 9.0.1
and was unable to install any packages recently via the commandpip3 install
.
Mac os version: EI Captain 10.11.5
.
python version: 3.5
I tried the command:
curl https://bootstrap.pypa.io/get-pip.py | python
It didn't work for me.
So I uninstalled the older pip and installed the newest version10.0.0
by entering this:
python3 -m pip uninstall pip setuptools
curl https://bootstrap.pypa.io/get-pip.py | python3
Now my problem was solved. If you are using the python2, you can substitute the python3 with python. I hope it also works for you.
By the way, for some rookies like me, you have to enter the code:
sudo -i
to gain the root right :) Good luck!
Another cause of SSL errors can be a bad system time – certificates won't validate if it's too far off from the present.
This video tutorial worked for me:
$ curl https://bootstrap.pypa.io/get-pip.py | python
Use Latest version of python on mac Python 2.7.15rc1 https://bugs.python.org/issue17128
I solved a similar problem by adding the --trusted-host pypi.python.org
option
I used pip version 9.0.1
and had the same issue, all the answers above didn't solve the problem, and I couldn't install python / pip with brew for other reasons.
Upgrading pip to 9.0.3
solved the problem. And because I couldn't upgrade pip with pip I downloaded the source and installed it manually.
sudo python3 pip-9.0.3.tar.gz
- Install pipOr you can install newer pip with:
curl https://bootstrap.pypa.io/get-pip.py | python
The only solution that worked for me is:
sudo curl https://bootstrap.pypa.io/get-pip.py | sudo python
tried
pip --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org install xxx
and finally worked out, not quite understand why the domain pypi.python.org is changed.
Solution - Install any package by marking below hosts trusted
Temporary solution
pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org {package name}
Permanent solution - Update your PIP(problem with version 9.0.1) to latest.
pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org pytest-xdist
python -m pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org --upgrade pip
I tried some of the popular answers, but still could not install any libraries/packages using pip install
.
My specific error was 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain
using Miniconda for Windows (installer Miniconda3-py37_4.8.3-Windows-x86.exe).
It finally works when I did this:
pip install -r requirements.txt --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org
Specifically, I added this to make it work: --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org
Source: Stackoverflow.com