I am very new to Python and trying to > pip install linkchecker
on Windows 7. Some notes:
> pip install scrapy
also results in the SSL error.python
and pip
were not available from the command line until I installed 3.4.1.> pip search linkchecker
works. Perhaps that is because pip search does not verify the site's SSL certificate.Here are the contents of my pip.log after running pip install linkchecker
:
Downloading/unpacking linkchecker
Getting page https://pypi.python.org/simple/linkchecker/
Could not fetch URL https://pypi.python.org/simple/linkchecker/: connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)
Will skip URL https://pypi.python.org/simple/linkchecker/ when looking for download links for linkchecker
Getting page https://pypi.python.org/simple/
Could not fetch URL https://pypi.python.org/simple/: connection error: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/ (Caused by <class 'http.client.CannotSendRequest'>: Request-sent)
Will skip URL https://pypi.python.org/simple/ when looking for download links for linkchecker
Cannot fetch index base URL https://pypi.python.org/simple/
URLs to search for versions for linkchecker:
* https://pypi.python.org/simple/linkchecker/
Getting page https://pypi.python.org/simple/linkchecker/
Could not fetch URL https://pypi.python.org/simple/linkchecker/: connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)
Will skip URL https://pypi.python.org/simple/linkchecker/ when looking for download links for linkchecker
Could not find any downloads that satisfy the requirement linkchecker
Cleaning up...
Removing temporary dir C:\Users\jcook\AppData\Local\Temp\pip_build_jcook...
No distributions at all found for linkchecker
Exception information:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python34\lib\site-packages\pip\req.py", line 1177, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "C:\Python34\lib\site-packages\pip\index.py", line 277, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
pip.exceptions.DistributionNotFound: No distributions at all found for linkchecker
pip install gensim config --global http.sslVerify false
Just install any package with the "config --global http.sslVerify false" statement
You can ignore SSL errors by setting pypi.org
and files.pythonhosted.org
as well as the older pypi.python.org
as trusted hosts.
$ pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org <package_name>
Note: Sometime during April 2018, the Python Package Index was migrated from pypi.python.org
to pypi.org
. This means "trusted-host" commands using the old domain no longer work, but you can add both.
Since the release of pip 10.0, you should be able to fix this permanently just by upgrading pip
itself:
$ pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip setuptools
Or by just reinstalling it to get the latest version:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
(… and then running get-pip.py
with the relevant Python interpreter).
pip install <otherpackage>
should just work after this. If not, then you will need to do more, as explained below.
You may want to add the trusted hosts and proxy to your config file.
pip.ini
(Windows) or pip.conf
(unix)
[global]
trusted-host = pypi.python.org
pypi.org
files.pythonhosted.org
Alternate Solutions (Less secure)
Most of the answers could pose a security issue.
Two of the workarounds that help in installing most of the python packages with ease would be:
easy_install <package_name>
. Note that some packages won't be found or will give small errors.pip install wheel_package_name.whl
to install the package.You can specify a cert with this param:
pip --cert /etc/ssl/certs/FOO_Root_CA.pem install linkchecker
See: Docs » Reference Guide » pip
If specifying your company's root cert doesn't work maybe the cURL one will work: http://curl.haxx.se/ca/cacert.pem
You must use a PEM file and not a CRT file. If you have a CRT file you will need to convert the file to PEM There are reports in the comments that this now works with a CRT file but I have not verified.
Also check: SSL Cert Verification.
For me the problem was fixed by creating a folder
pip
, with a file: pip.ini
in
C:\Users\<username>\AppData\Roaming\
e.g:
C:\Users\<username>\AppData\Roaming\pip\pip.ini
Inside it I wrote:
[global]
trusted-host = pypi.python.org
pypi.org
files.pythonhosted.org
I restarted python, and then pip permanently trusted these sites, and used them to download packages from.
If you can't find the AppData Folder on windows, write %appdata%
in file explorer and it should appear.
kenorb’s answer is very useful (and great!).
Among his solutions, maybe this is the most simple one:
--trusted-host
For example, in this case you can do
pip install --trusted-host pypi.python.org linkchecker
The pem file(or anything else) is unnecessary.
I had ssl issues due to company network security related to netscope. My machine is windows 10 with python 3.9 and the following command worked for me.
pip config set global.trusted-host \
"pypi.org files.pythonhosted.org pypi.python.org" \
--trusted-host=pypi.python.org \
--trusted-host=pypi.org \
--trusted-host=files.pythonhosted.org
Here, pip permanently trusted these sites, and now we can use them to download any packages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With