SSL error while using pip install to install tensorflow-gpu
Asked Answered
C

10

14

I am trying to install tensorflow-gpu by running pip install tensorflow-gpu Windows, inside an Anaconda enviornment, but I am getting the following error:

Could not install packages due to an EnvironmentError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1977)

I also tried doing it in a command prompt with administrator access, but it still didn't work.

C:\WINDOWS\system32>pip install tensorflow-gpu
Collecting tensorflow-gpu
Downloading https://files.pythonhosted.org/packages/2f/84/b6dfafe3282101f7d3a9410652ab4e6dc73f981fd63a40be0b47ff3bac3a/tensorflow_gpu-1.9.0-cp35-cp35m-win_amd64.whl (103.3MB)
    19% |######                          | 19.9MB 2.6MB/s eta 0:00:32
Could not install packages due to an EnvironmentError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1977)

All other network-related activities(such as browsing the web) work properly on the computer. I also have the correct CUDA and cuDNN installed, along with the latest NVIDIA drivers.

I fixed this problem by purging my Anaconda installation and reinstalling it, and then installing tensorflow-gpu. However, I am still curious as to why this error even happened in the first place.

Contrition answered 19/7, 2018 at 16:9 Comment(15)
I don't know if this is useful, but I recently tried to dual boot Ubuntu, but because it didn't really work out very well, I uninstalled it(aka, resetting bootloader and deleting partitions)Contrition
It looks like this happened while downloading. My guess would be faulty memory, or your connection is being tampered with (less likely). Is it reproducible? Does it always happen at 19%?Anna
Also, do you have enough disk space? Things can go wrong in very weird and unexpected ways if that happens.Anna
Nope, not always at 19%Contrition
I definitely have enough disk space. Also I just did the fall creators update.Contrition
Please check the edit...Contrition
Since it seems to be working now, did you try to uninstall and re-install it? I would try like 10 times pip uninstall tensorflow-gpu; pip install tensorflow-gpu --no-cache-dir just to make sure you got rid of the problem (even without knowing how)Convection
Nope did not try again.Contrition
lol i accidently uninstalled pipContrition
but in the proccess of installing pip again using conda, it updated openssl, so this problem should be fixed by now.Contrition
hopefully it was a blessing in disguiseConvection
Status update, my python installation is officially broken. Having to reinstall miniconda.Contrition
Many other things failed. It was a disaster.Contrition
In my case it happened on my Mac in pip, wget, Chrome. On another Ubuntu box wget worked fine. So IMHO it's something with OpenSSL on Mac.Toshiatoshiko
possibly due to connection issues, had a similar error while executing had and resolved by re-attempting the same failed command Error([('SSL routines', 'ssl3_get_record', 'decryption failed or bad record mac')])Chihuahua
M
10

It's related to network connection. I faced the same error in my Ubuntu system. Hence solved it by changing my network(WiFi) connection.

Mindimindless answered 3/4, 2020 at 2:10 Comment(3)
as weird as it can see, switching from the other wifi signal of my router make it works!Nomography
Same happened to my windows. I got the same error when using the wifi but worked fine when used the ethernet cableEmetic
@Mindimindless @Sagar Patil error possibly due to slow internet connection issues, had a similar error while executing pip install openai and resolved by re-attempting the same failed command without changing network connections Error : ` Error([('SSL routines', 'ssl3_get_record', 'decryption failed or bad record mac')])`Chihuahua
A
3

Use the following syntax while installation packages:

pip install --user packagename
Autotrophic answered 8/4, 2020 at 19:18 Comment(0)
A
0

I had the same problem with PyCharm to install tensorflow. As Dimitri Bolt described, I started the CMD as administrator and used the sytax described by Devendra Kanade. I got the error again, but each time I started the command, the progress became bigger. After three or four times, the download was successful and I was able to import tensorflow in PyCharm.

Agential answered 9/10, 2020 at 9:3 Comment(0)
P
0

You should note "Downloading" (19%, not finished yet) in the pip-msg just before the error. For pip, this means 99% that this is a download error.

  1. The quick fix is to increase <retries> in the pip option :
    --retries <retries> Maximum number of retries each connection should attempt (default 5 times).
    NB: I've never tried this.

  2. The general fix using normal download (I tried this to install PyQt5) :

a) Find the name of the problematic web-file in your pip-errmsg, enclosed in quotes, then google the whole (including quotes). In your case, that will be "tensorflow_gpu-1.9.0-cp35-cp35m-win_amd64.whl" .
b) Choose a reliable site and download that file. Windows 10 may give you erroneous msg about some .part-file but just ignore that msg and download again.
c) Load your browser list for downloaded files. For Firefox, ctrl-J will load that list (library). If failure, click to repeat download on the list (not site). You may need to repeat the clicking 10 times for the download to be successful !!!

d) Suppose that "tensorflow_gpu-1.9.0-cp35-cp35m-win_amd64.whl" is now in the local folder c:\Users\uuuu\Downloads\ . Create in this folder an ansi-text file named "example-requirements.txt" which has 3 lines(2 empty lines) as below:

tensorflow_gpu-1.9.0-cp35-cp35m-win_amd64.whl

e) Now in a normal command prompt, issue 3 commands as below:
c:
cd c:\Users\uuuu\Downloads\
pip install --requirement example-requirements.txt --no-cache-dir
NB: you can copy and paste, very easy in Win 10.

f) If successful, done now !
g) If you again have pip-problem with downloading another web-file then you must repeat a) , b) , c) , d) and edit the old "example-requirements.txt" to contain 4 lines(2 empty lines) as below:

tensorflow_gpu-1.9.0-cp35-cp35m-win_amd64.whl
another-file-name-with-extension

h) Repeat e) , f) , g) ... ...


NB: DOC for pip install-options are found on https://pip.pypa.io/en/stable/cli/pip_install/#
(search for "Example Requirements File" on the page).

Prodigy answered 14/6, 2021 at 15:41 Comment(0)
C
0

stumbled upon the same error while installing via conda, updating conda solved the problem (btw, the new version downloaded the packages sequentially, whilst the older attempted a parallel download)

Coessential answered 31/7, 2022 at 13:38 Comment(0)
T
0

There seems to be a problem with pip when downloading TensorFlow wheel package. So just download the package from the PyPi.org and install it that way.

Download package for your python version from here

https://pypi.org/project/tensorflow-intel/#files

once downloaded go to the your downloads folder then install it with this command

pip install tensorflow_intel-xxxxxxxxxxx.whl

this install the core TensorFlow package and install all other dependencies. Hope this helps

Thou answered 10/6, 2023 at 4:24 Comment(0)
F
0

If you are in India and using Jio then use VPN. After trying that if you get an error something like

WARNING: Failed to write executable - trying to use .deleteme logic
ERROR: Could not install packages due to an OSError:

then use --user flag

pip install "package name" --user
Filose answered 26/2 at 14:34 Comment(0)
A
0

I don't know why, but this error occurs due to the pycharm window being minimized. My guess is that the bitrate (or transfer quality or smth similar) is reduced due to being used in another process. Just disable all other download processes.

Acetone answered 11/3 at 6:35 Comment(0)
P
0

One other possibility that worked for me was to update pip to the latest version and then try again. In my case it was trying to install scikit-learn.

Pemphigus answered 12/8 at 19:30 Comment(0)
E
-1

Reinstall the library again!

I face this problem for several libraries like tensorflow-gpu and matplotlib

I have no idea why but if i found something i will share.

Enamour answered 11/11, 2019 at 7:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.