Permissionerror While Installing Tensorflow Using Virtualenv
Solution 1:
For python2:
$ virtualenv --system-site-packages ~/.tensorflow$ source ~/.tensorflow/bin/activate
(.tensorflow)$ pip install --upgrade tensorflow
For python3:
$ virtualenv -p python3.5 --system-site-packages ~/.tensorflow3$ source ~/.tensorflow3/bin/activate
(.tensorflow3)$ pip3 install --upgrade tensorflow
Using these ways, I could successfully install tensorflow only inside virtualenvs.
Thank you so much @AshokaLella!
Solution 2:
If your virtual environment is in python3. Running pip install tensorflow should install it in your python3 environment.
$ virtualenv3 venv
$ source venv/bin/activate
(venv)$ pip install tensorflow
(venv)$ pip freeze
appdirs==1.4.3
numpy==1.12.1
packaging==16.8
protobuf==3.3.0
pyparsing==2.2.0
six==1.10.0
tensorflow==1.1.0
Werkzeug==0.12.2
(venv) $>python
Python 3.6.0 (default, Jan 16 2017, 12:12:55)
[GCC 6.3.1 20170109] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>>
If you are running
virtualenv ~/.tensorflow/bin/activate
make sure virtualenv is for python3. And your virtual env will get created at ~/.tensorflow/bin/activate
(Not sure if you want that). I'd suggest change that address to something simple, and make sure it does not contain the folder named as some of the libraries you want to import. It causes problems sometimes.
If you're trying to import tf in ipython3, you should also make sure that ipython is installed in the same environment. And if you run
ipython notebook
This will launch the default ipython (/usr/bin/ipython). You dont want that. So, run venv/bin/ipython3
instead
Post a Comment for "Permissionerror While Installing Tensorflow Using Virtualenv"