How to solve the error in installing Tensorflow?

Question:

I tried to install TensorFlow using pip install tensorflow and I got the below error. Is that because of a timeout problem? How to overcome this error when installing TensorFlow?

ERROR: Exception:
Traceback (most recent call last):
  File "c:usershpappdatalocalprogramspythonpython38libsite-packagespip_vendorurllib3response.py", line 425, in _error_catcher
    yield
  File "c:usershpappdatalocalprogramspythonpython38libsite-packagespip_vendorurllib3response.py", line 507, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "c:usershpappdatalocalprogramspythonpython38libsite-packagespip_vendorcachecontrolfilewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "c:usershpappdatalocalprogramspythonpython38libhttpclient.py", line 454, in read
    n = self.readinto(b)
  File "c:usershpappdatalocalprogramspythonpython38libhttpclient.py", line 498, in readinto
    n = self.fp.readinto(b)
  File "c:usershpappdatalocalprogramspythonpython38libsocket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "c:usershpappdatalocalprogramspythonpython38libssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "c:usershpappdatalocalprogramspythonpython38libssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
Asked By: RoshiDil

||

Answers:

if you are using conda first run:

conda config --set ssl_verify no

after that modify your default timeout:

pip --default-timeout=900 install tensorflow 

Note: conda config --set ssl_verify no only applicable for conda if you are not on conda env skip this step.

Answered By: Tasnuva Leeya

try:

pip --default-timeout=300 install tensorflow

This has worked for me as commented by Kenan since I’m using a non-conda environment.

Answered By: Emporio Argani