Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to downgrade tensorflow, multiple versions possible?

I have tensorflow 1.2.1 installed, and I need to downgrade it to version 1.1 to run a specific tutorial. What is the safe way to do it? I am using windows 10, python 3.5. Tensorflow was installed with pip3, but "pip3 show tensorflow" returns blank.

Is it possible to have multiple version of tensorflow on the same OS?

like image 756
Yee Avatar asked Aug 18 '17 06:08

Yee


People also ask

Can you have multiple versions of TensorFlow?

As Tensorflow is continuously evolving, it is normal to find a situation in which you require multiple versions of Tensorflow to coexist on the same machine. Those versions can be different enough to have different CUDA library dependencies.

Can I downgrade TensorFlow?

The best practice for TensorFlow downgrade is to use the latest version of Python and TensorFlow. Older versions have vulnerability issues, so be cautious when downgrading. Set the version to a lower number than the currently installed release. When choosing, make sure the version is compatible with the Python release.

How do you change TF version?

If you want to switch TensorFlow versions after import, you will need to restart your runtime with 'Runtime' -> 'Restart runtime...' and then specify the version before you import it again.

How do I get an older version of TensorFlow?

You can do as suggested beforehand and search for available version in tesorflow site but you can't access versions older than available there. So if you want an earlier version: go to https://github.com/tensorflow/tensorflow. search for the version you want under branches - for instance r0.


4 Answers

Pip allows to specify the version

pip install tensorflow==1.1

like image 162
Jürg Merlin Spaak Avatar answered Oct 18 '22 01:10

Jürg Merlin Spaak


I discovered the joy of anaconda: https://www.continuum.io/downloads. It allows multiple virtual environments to host different versions of phyton and tensorflow. For example the following creates a virtual environment with pyton3.5 and tensorflow1.1

C:> conda create -n tensorflow1.1 python=3.5
C:> activate tensorflow1.1
(tensorflow1.1) 
C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.1.0-cp35-cp35m-win_amd64.whl

voila, a virtual environment is created.

like image 26
Yee Avatar answered Oct 18 '22 01:10

Yee


Is it possible to have multiple version of tensorflow on the same OS?

Yes, you can use python virtual environments for this. From the docs:

A Virtual Environment is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. It solves the “Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keeps your global site-packages directory clean and manageable.

After you have install virtualenv (see the docs), you can create a virtual environment for the tutorial and install the tensorflow version you need in it:

PATH_TO_PYTHON=/usr/bin/python3.5
virtualenv -p $PATH_TO_PYTHON my_tutorial_env 
source my_tutorial_env/bin/activate # this activates your new environment
pip install tensorflow==1.1

PATH_TO_PYTHON should point to where python is installed on your system. When you want to use the other version of tensorflow execute:

deactivate my_tutorial_env

Now you can work again with the tensorflow version that was already installed on your system.

like image 11
GeertH Avatar answered Oct 18 '22 00:10

GeertH


If you are using python3 on windows then you might do this as well

pip3 install tensorflow==1.4

you may select any version from "(from versions: 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7.0rc0, 1.7.0rc1, 1.7.0)"

I did this when I wanted to downgrade from 1.7 to 1.4

like image 6
Omkar Avatar answered Oct 18 '22 01:10

Omkar