42

I'm working with Ubuntu 14.04 , I had a TensorFlow V0.10 but I want to update this version. if i do:

$ pip install --upgrade $TF_BINARY_URL

but it prints:

Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1198, in prepare_files
    do_download,
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1376, in unpack_url
    self.session,
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 572, in unpack_http_url
    download_hash = _download_url(resp, link, temp_location)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 433, in _download_url
    for chunk in resp_read(4096):
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 421, in resp_read
    chunk_size, decode_content=False):
  File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py", line 225, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py", line 174, in read
    data = self._fp.read(amt)
  File "/usr/lib/python2.7/httplib.py", line 573, in read
    s = self.fp.read(amt)
  File "/usr/lib/python2.7/socket.py", line 380, in read
    data = self._sock.recv(left)
  File "/usr/lib/python2.7/ssl.py", line 341, in recv
    return self.read(buflen)
  File "/usr/lib/python2.7/ssl.py", line 260, in read
    return self._sslobj.read(len)
SSLError: The read operation timed out

Storing debug log for failure in /home/brm17/.pip/pip.log
12
  • Could be internet problem. Try reset router / using proxy?
    – Kh40tiK
    Mar 3, 2017 at 8:57
  • This is due to weak internet connection. Try setting default timeout (HTTP timeout) using pip --default-timeout=100 install --upgrade $TF_BINARY_URL
    – Prabhjot
    Mar 3, 2017 at 9:09
  • @Kh40tiK how i do this ?
    – stevGates
    Mar 3, 2017 at 11:52
  • @Prabhjot : an error You must give at least one requirement to install (see "pip help install") !
    – stevGates
    Mar 3, 2017 at 11:53
  • @Brm-Covißio : You haven't set the environment variable $TF_BINARY_URL. Try doing pip --default-timeout=100 install --upgrade tensorflow
    – Prabhjot
    Mar 3, 2017 at 13:11

8 Answers 8

97
(tensorflow)$ pip install --upgrade pip  # for Python 2.7
(tensorflow)$ pip3 install --upgrade pip # for Python 3.n

(tensorflow)$ pip install --upgrade tensorflow      # for Python 2.7
(tensorflow)$ pip3 install --upgrade tensorflow     # for Python 3.n
(tensorflow)$ pip install --upgrade tensorflow-gpu  # for Python 2.7 and GPU
(tensorflow)$ pip3 install --upgrade tensorflow-gpu # for Python 3.n and GPU

(tensorflow)$ pip install --upgrade tensorflow-gpu==1.4.1 # for a specific version

Details on install tensorflow.

3
  • For me upgrading tensorflow alone made tensorflow giving errors. I have to upgrade the tensorflow-gpu also to get it working Aug 28, 2018 at 6:31
  • for Windows users, if you get ImportError: DLL load failed: The specified module could not be found. or Failed to load the native TensorFlow runtime.or similar, try updating MSVC Runtime to the latest as described in issue github.com/tensorflow/tensorflow/issues/35749 Feb 10, 2020 at 14:33
  • Thank you! The command worked for me to upgrade TF to 2.8.0 (Python 3): pip install --upgrade tensorflow==2.8.0 Mar 30, 2022 at 5:29
28

To upgrade any python package, use pip install <pkg_name> --upgrade.

So in your case it would be pip install tensorflow --upgrade. Just updated to 1.1.0

1
  • 1
    doesn't always work: No distributions at all found for tensorflow in /usr/local/lib/python3.4/dist-packages
    – Alex
    Nov 4, 2017 at 21:41
6

This is official recommendation for upgrading Tensorflow.

To get TensorFlow 1.5, you can use the standard pip installation (or pip3 if you use python3)

$  pip install --ignore-installed --upgrade tensorflow
1
  • Often you have to sudo the command: sudo pip3 install --ignore-installed --upgrade tensorflow May 14, 2018 at 0:52
6

Tensorflow upgrade -Python3

>> pip3 install --upgrade tensorflow --user

if you got this

"ERROR: tensorboard 2.0.2 has requirement grpcio>=1.24.3, but you'll have grpcio 1.22.0 which is incompatible."

Upgrade grpcio

>> pip3 install --upgrade grpcio --user
2

Before trying to update tensorflow try updating pip

pip install --upgrade pip

If you are upgrading from a previous installation of TensorFlow < 0.7.1, you should uninstall the previous TensorFlow and protobuf using,

pip uninstall tensorflow

to make sure you get a clean installation of the updated protobuf dependency.

Uninstall the TensorFlow on your system, and check out Download and Setup to reinstall again.

If you are using pip install, go check the available version over https://storage.googleapis.com/tensorflow, search keywords with linux/cpu/tensorflow to see the availabilities.

Then, set the path for download and execute in sudo.

$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-py2-none-any.whl

$ sudo pip install --upgrade $TF_BINARY_URL

For more detail, follow this link in here

2

For anaconda installation, first pick a channel which has the latest version of tensorflow binary. Usually, the latest versions are available at the channel conda-forge. Then simply do:

conda update -f -c conda-forge tensorflow

This will upgrade your existing tensorflow installation to the very latest version available. As of this writing, the latest version is 1.4.0-py36_0

2

for a specific version

pip install --upgrade tensorflow==2.2
1

Upgrading to Tensorflow 2.0 using pip. Requires Python > 3.4 and pip >= 19.0

CST:~ USERX$ pip3 show tensorflow
Name: tensorflow
Version: 1.13.1

CST:~ USERX$ python3 --version
Python 3.7.3

CST:~ USERX$ pip3 install --upgrade tensorflow

CST:~ USERX$ pip3 show tensorflow
Name: tensorflow
Version: 2.0.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.