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?
9 Answers9
Pip allows to specify the version
pip install tensorflow==1.1
4 Comments
(from versions: 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.3.0rc0, 2.3.0rc1)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.5C:> 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.whlvoila, a virtual environment is created.
Comments
Is it possible to have multiple version of tensorflow on the same OS?
Yes, you can use python virtual environments for this. From thedocs:
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 thedocs), you can create a virtual environment for the tutorial and install the tensorflow version you need in it:
PATH_TO_PYTHON=/usr/bin/python3.5virtualenv -p $PATH_TO_PYTHON my_tutorial_env source my_tutorial_env/bin/activate # this activates your new environmentpip install tensorflow==1.1PATH_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_envNow you can work again with the tensorflow version that was already installed on your system.
Comments
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
2 Comments
(from versions: 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.3.0rc0, 2.3.0rc1)Pay attention:you cannot install arbitrary versions of tensorflow, they have to correspond to your python installation, which isn't conveyed by most of the answers here. This is also true for thecurrent wheels like here (fromthis answer above). For this example, thecp35-cp35m found inside the url hints that it is for Python 3.5.x
A huge list of different wheels/compatibilities can be foundhere on github.By using this, you can downgrade to almost every availale version in combination with the respective for python. For example:
pip install tensorflow==2.0.0(note that previous to installing Python 3.7.8 alongside version 3.8.3 in my case, you would get this:
ERROR: Could not find a version that satisfies the requirement tensorflow==2.0.0 (from versions: 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.3.0rc0, 2.3.0rc1)ERROR: No matching distribution found for tensorflow==2.0.0this also holds true for other non-compatible combinations.)
This should also be useful for legacy CPU without AVX support or GPUs with a compute capability that's too low.
If you only need the most recent releases (which it doesn't sound like in your question) a list of urls for the current wheel packages is available onthis tensorflow page. That's from thisSO-answer.
Note:This link to a list of different versions didn't work for me.
1 Comment
You can try to use the options of--no-cache-dir together with-I to overwrite the cache of the previous version and install the new version. For example:
pip3 install --no-cache-dir -I tensorflow==1.1Then use the following command to check the version of tensorflow:
python3 -c ‘import tensorflow as tf; print(tf.__version__)’It should show the right version got installed.
3 Comments
pip install tensorflow==[version] did work to downgrade.(from versions: 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.3.0rc0, 2.3.0rc1)If you have anaconda, you can just install desired version and conda will automatically downgrade the current package for you.
For example:
conda install tensorflow=1.11 Comment
Comments
You can downgrade TensorFlow version to a lower version by running:
1.Check the version of TensorFlow that currently installed by:
pip3 show tensorflow2.Then, Downgrade TensorFlow to a lower version by running:
pip3 install --upgrade tensorflow==<version>Set the version to a lower number than the currently installed release. When choosing, make sure the version is compatible with the Python release.
If you are using a Notebook environment, run the following command and restart the kernel when the installation completes:
!pip install --upgrade tensorflow==<version>Although the best practice is to use the latest version of Python andTensorFlow since older versions have vulnerability issues. So becautious when downgrading.
Comments
Explore related questions
See similar questions with these tags.



