Getting permission denied error while installing tensorflow and keras - tensorflow

After following the steps from my previously asked question Can I implement deep learning models in my laptop with intel hd graphics
I am getting a permission denied error while installing tensorflow
What can I do to install tensorflow and keras without getting this error?

pip3 is trying to access /usr/bin/ for which you need superuser rights. Try
sudo pip3 install --upgrade ...

It appears that TensorFlow depends on a newer version of the setuptools package than you have installed. As Maximilian points out, pip needs root access to upgrade setuptools and install TensorFlow and Keras in your machine's Python distribution. You can either use sudo as he suggests, or it may be safer to install TensorFlow into a Virtualenv. For example, to create a Virtualenv in the directory ~/tensorflow, execute the following commands:
$ sudo pip install virtualenv
$ virtualenv --system-site-packages ~/tensorflow
$ cd ~/tensorflow
$ source bin/activate
$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.0-cp27-none-linux_x86_64.whl

Related

HadoopFileSystem load error during TensorFlow installation on raspberry pi3

screen shot
As Python2.7 will be deprecated on 01/01/2020. I was planning to start using python3. So, I tried to install the tensorflow==1.14.0 on the raspberry pi and it was successful, but when I am loading the Tensorflow for further operations then it throws a load error.
Python - 3.7 (Default installed by Raspbian OS)
Any suggestions why am I facing this issue?
Thanks for your time
You can't install later versions of Tensorflow on the Raspberry Pi using pip. You have to install from source. I made a video doing this: https://youtu.be/GNRg2P8Vqqs
Installing Tensorflow requires some extra steps on the Pi's ARM architecture.
This is how I installed tf 2.0 on my Pi 4:
Make your project directory:
cd Desktop
mkdir tf_pi
cd tf_pi
Make a virtual environment:
python3 -m pip install virtualenv
virtualenv env
source env/bin/activate
Run the commands based on https://github.com/PINTO0309/Tensorflow-bin/#usage:
sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev
python3 -m pip install keras_applications==1.0.8 --no-deps
python3 -m pip install keras_preprocessing==1.1.0 --no-deps
python3 -m pip install h5py==2.9.0
sudo apt-get install -y openmpi-bin libopenmpi-dev
sudo apt-get install -y libatlas-base-dev
python3 -m pip install -U six wheel mock
Pick a tensorflow release from https://github.com/lhelontra/tensorflow-on-arm/releases (I picked 2.0.0). Picking a higher version of Tensorflow (like 2.1.0) requires a higher version of scipy that wasn't compatible with my Raspberry Pi:
wget https://github.com/lhelontra/tensorflow-on-arm/releases/download/v2.0.0/tensorflow-2.0.0-cp37-none-linux_armv7l.whl
python3 -m pip uninstall tensorflow
python3 -m pip install tensorflow-2.0.0-cp37-none-linux_armv7l.whl
RESTART YOUR TERMINAL
Reactivate your virtual environment:
cd Desktop
cd tf_pi
source env/bin/activate
Test:
Open a python interpreter by executing:
python3
import tensorflow
tensor.__version__
This should have no errors and output: 2.0.0
I got the same issue today when trying to run the fresh tf installation on my pi 3+

pip install tensorflow fails - MAC OSError: [Errno 13]

I am trying to install tensorflow on mac Sierra. When I run pip install tensorflow I get following report.
It works fine for me by using command :
pip3 install https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.10.1-py3-none-any.whlrflow-1.10.1-py3-none-any.whl
run sudo pip install tensorflow
The problem appears to be, that you have not got the rights to install tensorflow globally. Therefore, one solution appears to be, that you try to install tensorflow locally using the following command:
pip install tensorflow --user

I am not able to update tensorflow installed with anaconda

I have been trying to update tensorflow from 1.2.1 to 1.3.
I did the following on my terminal:
pip3 install tensorflow --upgrade
After this, I tried checking the version
python3 -c 'import tensorflow as tf; print(tf.__version__)'
This outputs 1.2.1 but not 1.3.0
All this had been done in an anaconda environment.
Operating system: macOS Sierra
I would like to know how one can perform this update.
Thank you
The solution that I found was to install pip inside the conda environment and use that instance of pip to install the packages. Please refer here
The reason I got the above error was that the python3 and pip3 paths were different.
This became evident when I ran the below commands inside the conda environment.
which python3
/Users/SMBP/anaconda/envs/tensorflow/bin/python3
which pip3
/usr/local/bin/pip3
Also, I think it is better to use virtualenv and virtualenvwrapper if you wish to work with tensorflow as it is the recommended way.

Installing Tensorflow 1.3 (No module named tensorflow)

I am initializing a new VM with Ubuntu 17 on Google Cloud Platform, I then SSH into the newly created VM, upload this script and run it...
#! /bin/bash
sudo apt-get install python-pip
sudo pip install --upgrade pip
sudo pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
Now, this works for me, when I launch a Python interactive environment
import tensorflow as tf
does not throw an error, however, if I run the same script but replace
tensorflow-0.5.0-cp27-none-linux_x86_64.whl
with
tensorflow-1.3.0-cp27-none-linux_x86_64.whl
I get:
ImportError: No module named tensorflow
... incredibly frustrating, especially since the contrib library doesn't seem to be apart of the 0.5 version... any ideas of what is going on, perhaps how I can first install 0.5 and then upgrade to 1.3 ?
I also get the same then i tried pip install tensorflow after worked fine

What is the procedure to update virtualenv installation of tensorflow?

I am currently using the virtualenv intallation of tensorflow version r0.7. I would like to upgrade to r0.9 in virtualenv. What ia the procedure to do it?
The following should work :
# Once inside your virtualenv
(venv) $ pip uninstall -qy tensorflow
(venv) $ pip install -U https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl
That is, assuming you want the cpu version and using Python 2.7. Look here for other versions of the pip packages.