9

while installing TF, exception appeared:

File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/cachecontrol/adapter.py", line 46, in send resp = super(CacheControlAdapter, self).send(request, **kw) File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/adapters.py", line 447, in send raise SSLError(e, request=request) SSLError: ("bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)",)

command: pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl

I have no clue how to solve this. I was recently reinstalled pip, could reinstall cause it?

Mihriban Minaz
  • 3,043
  • 2
  • 32
  • 52
Snurka Bill
  • 973
  • 4
  • 12
  • 29
  • The error indicates a problem with the remote site's certificate. It could be misconfigured, or there could be something in your network (proxy? wlan?) which intercepts the traffic somehow. Can you fetch the URL manually, e.g. with `curl`? – tripleee Feb 04 '16 at 01:56

9 Answers9

16

SSL error can be solved by bellow steps for sure. Just download the wheel on your own and pip install.

# Ubuntu/Linux 64-bit, CPU only:

$ wget https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

$ sudo pip install --upgrade tensorflow-0.5.0-cp27-none-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled:

$ wget https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

$ sudo pip install --upgrade tensorflow-0.5.0-cp27-none-linux_x86_64.whl

4

Use the following version of certifi

pip2 install 'certifi==2015.4.28' --force-reinstall

after that there will be no more SSL errors.

Solution was found here: https://github.com/kennethreitz/requests/issues/3212

aboettcher
  • 81
  • 6
2

For those working on macOS run from a terminal window..

- /Applications/Python\ 3.6/Install\Certificates.command
CDspace
  • 2,639
  • 18
  • 30
  • 36
2

This command worked for me

pip3 install --trusted-host pypi.python.org  --upgrade http://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py3-none-any.whl

I made the request as http instead of https and I was able to bypass the ssl check. Hope this helps.

1

I think you need some security certificates.

Please try the following command.

sudo pip install requests[security]

If you get any error message, please uninstall and reinstall python-requests.

sudo pip uninstall requests
sudo apt-get install python-requests    

I hoped it will give you the certificates you need. Thanks.

Necromancer
  • 869
  • 2
  • 9
  • 25
  • issue still stands :/ I've reinstalled python-requests using apt-get. hitting sudo pip install requests[security] did nothing, so I've tried --upgrade and this is result: AssertionError: version mismatch, 0.9.2 != 1.5.0 ---------------------------------------- Rolling back uninstall of cryptography Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-R05Y91/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-BR_et.... do you have any idea? – Snurka Bill Feb 08 '16 at 03:02
  • Please try the following link... http://stackoverflow.com/questions/34085552/sslerror-bad-handshake-python-requests – Necromancer Feb 08 '16 at 08:06
1

I ran into this problem too, and in my case using curl to download manually didn't fix the problem. Curl reported this:

curl: (60) SSL certificate problem: certificate is not yet valid

The problem in my case turns out to have been my VM's clock not being in sync with the internet time servers. Resetting my VM's clock so the datetime was correct fixed the problem, and I was able to go right back to installing straight from pip.

I've added this note to a related GitHub issue filed for TensorFlow. This Unix StackExchange question ultimately led me to the answer.

lampShadesDrifter
  • 3,925
  • 8
  • 40
  • 102
Owen S.
  • 7,665
  • 1
  • 28
  • 44
0

I used Anaconda to run "py -m pip install --upgrade tensorflow" and it worked.

0

Try to upgrade your pip version with another mirror.

pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/
0

This can happen if the date on your computer is wrong. Check with the command

date

I got it when it was set to August but the true date was in December. I corrected it with

sudo date 12191148

for December 19th 11:48 but obviously use the correct date for when you are.

user1318499
  • 1,327
  • 11
  • 33