1
$\begingroup$

I want to create a virtual environment using anaconda for python 3 in which I can use a specific version of tensorflow-gpu.

My base conda python is 3.6.8 and the base conda tensorflow-gpu version is 1.10.1.
I want to create an environment with python 3.6.9 and tensorflow-gpu 1.11.0.
I am running Ubuntu 18.04.

To do this, I have been running the following code in my bash:

$ conda create --name test_env python=3.6.9
$ conda activate test_env

However, when I open a python console and check the tensorflow version it is instantly 1.10.1 which is the tensorflow-gpu version of my conda base environment.

Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:07:31) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'1.10.1'

The problem seems to only occur with the tensorflow package. Other modules like keras give the expected ModuleNotFoundError error when I try to import them after i created the test_env environment.

Even if I install a specific tensorflow version with the following command, the tensorflow version remains to be 1.10.1.

$ conda install tensorflow-gpu==1.11.0

When i use conda list it (only) lists the target tensorflow-gpu version:
tensorflow-gpu 1.11.0 h0d30ee6_0

Do you have any ideas on how to use tensorflow-gpu version 1.11.0 in a new virtual environment?

$\endgroup$

1 Answer 1

0
$\begingroup$

You can create the conda environment and install all required packages at the same time:

$ conda create --name test_env python=3.6 tensorflow==1.11
$\endgroup$

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.