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
Cœur
  • 37,241
  • 25
  • 195
  • 267
stevGates
  • 910
  • 2
  • 9
  • 19
  • Could be internet problem. Try reset router / using proxy? – Kh40tiK Mar 03 '17 at 08: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 03 '17 at 09:09
  • @Kh40tiK how i do this ? – stevGates Mar 03 '17 at 11:52
  • @Prabhjot : an error `You must give at least one requirement to install (see "pip help install")` ! – stevGates Mar 03 '17 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 03 '17 at 13:11
  • @Prabhjot other error : `Could not find any downloads that satisfy the requirement tensorflow in /usr/local/lib/python2.7/dist-packages Downloading/unpacking tensorflow Cleaning up... No distributions at all found for tensorflow in /usr/local/lib/python2.7/dist-packages Storing debug log for failure in /tmp/tmpHw3sqs` – stevGates Mar 03 '17 at 13:46
  • Try installing the package with a whl file: `sudo pip --default-timeout=100 install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-cp27-none-linux_x86_64.whl` – Prabhjot Mar 03 '17 at 17:14
  • an error : `tensorfl‌​ow-1.0.0-cp27-none-l‌​inux_x86_64.whl is not a supported wheel on this platform. Storing debug log for failure in /home/brm17/.pip/pip.log` – stevGates Mar 03 '17 at 21:45
  • @Prabhjot `an error : tensorfl‌​ow-1.0.0-cp27-none-l‌​inux_x86_64.whl is not a supported wheel on this platform. Storing debug log for failure in /home/brm17/.pip/pip.log ` – stevGates Mar 03 '17 at 22:58
  • help me please ! – stevGates Mar 04 '17 at 12:07
  • `is not a supported wheel on this platform` can be caused by old versions of pip as well; did you try `pip install --upgrade pip`? – Alexandre Passos Mar 06 '17 at 21:23
  • Possible duplicate of [How to Update Tensorflow from source](http://stackoverflow.com/questions/34239537/how-to-update-tensorflow-from-source) – WY Hsu Mar 28 '17 at 06:16

8 Answers8

96
(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.

Panfeng Li
  • 3,321
  • 3
  • 26
  • 34
  • For me upgrading tensorflow alone made tensorflow giving errors. I have to upgrade the tensorflow-gpu also to get it working – FindOutIslamNow Aug 28 '18 at 06: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 https://github.com/tensorflow/tensorflow/issues/35749 – Roman Kruglov Feb 10 '20 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 – Pulkit Ratna Ganjeer Mar 30 '22 at 05: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

Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
  • 1
    doesn't always work: No distributions at all found for tensorflow in /usr/local/lib/python3.4/dist-packages – Alex Nov 04 '17 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
0xAliHn
  • 18,390
  • 23
  • 91
  • 111
5

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
Harish Kumawat
  • 312
  • 6
  • 10
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

Akash
  • 395
  • 5
  • 16
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

kmario23
  • 57,311
  • 13
  • 161
  • 150
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
Jeereddy
  • 1,050
  • 8
  • 16
0

for a specific version

pip install --upgrade tensorflow==2.2
Kukesh
  • 490
  • 1
  • 5
  • 18