Reputation: 3109
I wanted to be able to access all of my site packages from another installation of Python, so I created a virtual environment in this way:
venv my_project --system-site-packages
I noticed that my version of Keras was outdated, so from within my virtualenv, I executed:
pip install keras
which worked without an issue. I'm using pip version 9.0.1
I'm trying to run a python program that uses TensorFlow, but when I run it, I get an error:
ImportError: No module named tensorboard.plugins
I googled around and found that I needed to upgrade TensorFlow. I tried several commands:
(my_project/) user@GPU5:~/spatial/zero_padded/powerlaw$ pip install tensorflow
The above gives me a 'requirement already satisfied' error.
$ pip install --target=~/spatial/zero_padded/powerlaw/my_project/ --upgrade tensorflow
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
The output of which python
:
/user/spatial/zero_padded/powerlaw/my_project/bin/python
I think my PYTHONPATH
is the first line in this:
(my_project/) user@GPU5:~/spatial/zero_padded/powerlaw/my_project$ python -c "import sys; print '\n'.join(sys.path)"
/user/spatial/zero_padded/powerlaw/my_project
/opt/enthought/canopy-1.5.1/appdata/canopy-1.5.1.2730.rh5-x86_64/lib/python27.zip
/opt/enthought/canopy-1.5.1/appdata/canopy-1.5.1.2730.rh5-x86_64/lib/python2.7
/opt/enthought/canopy-1.5.1/appdata/canopy-1.5.1.2730.rh5-x86_64/lib/python2.7/plat-linux2
/opt/enthought/canopy-1.5.1/appdata/canopy-1.5.1.2730.rh5-x86_64/lib/python2.7/lib-tk
/opt/enthought/canopy-1.5.1/appdata/canopy-1.5.1.2730.rh5-x86_64/lib/python2.7/lib-old
/opt/enthought/canopy-1.5.1/appdata/canopy-1.5.1.2730.rh5-x86_64/lib/python2.7/lib-dynload
/user/spatial/zero_padded/powerlaw/my_project/lib/python2.7/site-packages
/user/pkgs/enthought/canopy-1.5.1/lib/python2.7/site-packages
/user/pkgs/enthought/canopy-1.5.1/lib/python2.7/site-packages/PIL
/opt/enthought/canopy-1.5.1/appdata/canopy-1.5.1.2730.rh5-x86_64/lib/python2.7/site-packages
How do I upgrade TensorFlow inside my virtualenv?
Upvotes: 0
Views: 761
Reputation: 15986
Pretty sure that all you need to do is run pip install
with -U
to upgrade the package inside the virtualenv:
(my_project/) user@GPU5:~/spatial/zero_padded/powerlaw$ pip install -U tensorflow
-U
is just shorthand for --upgrade
. But, you should really go ahead and create a dependencies file for yourself called requirements.txt
that lives in the project root and specify version numbers there.
e.g.,
tensorflow==1.2.0
And that makes it easier to install all requirements
pip install -r requirements.txt
Upvotes: 1
Reputation: 16214
The best way to do it is install the dependencies outside de vm, and create a new one I'm afraid to say that. Because doing upgrades is different than installing
Upvotes: 0