Cannot install tensorflow on raspberry pi 3b+ - python-2.7

I am running into an error when I try to install tensorflow using pip on my raspberry pi 3b+.
Here is the error message:
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-p4UFOu/h5py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ofsmSC/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-p4UFOu/h5py/
Here is the command I tried that gave the error I mentioned:
sudo pip install tensorflow
I am running the latest version of Raspbian OS and have updated and upgraded my raspberry pi. I am also using python 2.7 and this works successfully with python 2.7 on my ubuntu 18.10 laptop.
Any ideas how I can successfully do this?

Guessing by /tmp/pip-install-p4UFOu/h5py/setup.py, you have the issues with installing the h5py package which is required by tensorflow. Since you are building h5py from source (the prebuilt ARM wheels exist for Python 3.4/3.5 only atm), refer to the h5py installation docs:
To install h5py from source, you need three things installed:
A supported Python version with development headers
HDF5 1.8.4 or newer with development headers
A C compiler
On Raspbian and Python 2, this translates to:
apt install python-dev
apt install libhdf5-dev
apt install gcc (or, if you want the whole development tools to be installed at once, apt install build-essential)
Now pip install h5py should have everything to build and install the package properly.

Related

Cythonizing sklearn/_isotonic.pyx failed

I'm trying to install the OCRF-Examples (https://github.com/ngoix/OCRF).
The installation instructions said:
conda create -n OCRF_env python=2.7 anaconda
source activate OCRF_env
conda install -n OCRF_env numpy scipy cython matplotlib
git clone https://github.com/ngoix/OCRF
cd OCRF
pip install --upgrade pip
pip install pyper
python setup.py install
I was able to run all the commands of the installation instructions without any problems - except for the last one:
python setup.py install
Here I got this error:
Cython is installed with the latest version (0.29.13) and no other Cython versions are installed.
If relevant: I already had Python 3.6.9 installed on my Macbook. Due to the OCRF installation, I now have Python 2.7. as additional environment.
Am I doing something wrong?

pip install mysqlclient error django

I am currently using MySQL 8.0 as database for my Django project. I am working with Python 3.6 version and have installed pip to load python modules from internet. I haven't faced issues while loading packages other than mysqlclient using pip.
I issued the command pip install mysqlclient and end up with following message and installation gets aborted:
"c:\users\anirudh\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Anirudh\\AppData\\Local\\Temp\\pip-install-xer9o7aw\\mysqlclient\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Anirudh\AppData\Local\Temp\pip-record-t3br6ckm\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Anirudh\AppData\Local\Temp\pip-install-xer9o7aw\mysqlclient\
I am using visual studio 2017 and followed the link below fix this issue but no luck.
https://dimitri.janczak.net/2017/05/20/python-3-6-visual-studio-2017/
I tried to install mysqlclient using pip. But i did not succeed. I was able to install it using:
conda install mysqlclient
And it worked fine for me.

Getting errors when installing iPython 5.0 for python 2.7 on windows 10

I am trying to install IPython 5.0 for python 2.7 on Windows 10 using pip like this in cmd propmpt:
C:\Python27\Scripts>pip install IPython==5.0
But its failing and showing some error which I dont know how to resolve.Error:
Command "c:\python27\python.exe -u -c "import setuptools,
tokenize;file='c:\users\vishal\appdata\local\temp\pip-build-sfsbeq\scandir\setup.py';f=getattr(tokenize,
'open', open)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, file, 'exec'))" install
--record c:\users\vishal\appdata\local\temp\pip-auxpgu-record\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in c:\users\vishal\appdata\local\temp\pip-build-sfsbeq\scandir\
Previously I have installed other packages such as numpy using pip command and it worked fine.
Any help is appreciated. Thanks in advance!
First take a look at the answer enter link description here.
I'm trying to install iPython on windows, too. The difference is that I'm targeting the newest version (no matter which). I met with the same error, but before it I got another message:
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
Just download and install the package mentioned above, and retry
pip install ipython
Hooray!

How do I install babel.messages module in Ubuntu?

I am trying to install using
sudo apt-get install babel.messages
but getting error:
ImportError: No module named babel.messages
Please let me know how to install in Ubuntu 16.04
Try that with using this command:
# pip install babel
It will work well
For Ubuntu versions older than 17.04, you can install python-babel from the Ubuntu repositories by running the following command in terminal:
sudo apt-get install python-babel
For Ubuntu versions from 17.04 and also on older versions you can install it via pip, the Python package manager as:
pip install babel
If you don't have pip installed yet, you can install it as:
sudo apt install python-pip

Pandas Seaborn Install

On Ubuntu 12.04 LTS running Python 2.7 I'm getting an install error from attempting to add the great looking Seaborn plotting package to my existing Pandas environment which is running fine.
Here's a snippet from the console containing the errors:
~$ pip install seaborn
running install_lib
creating /usr/local/lib/python2.7/dist-packages/seaborn
error: could not create '/usr/local/lib/python2.7/dist-packages/seaborn':
Permission denied
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tm/pip_build_moj0/seaborn/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-LvVao5-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_mojo/seaborn
Storing debug log for failure in /home/mojo/.pip/pip.log
Anyone have a resolution tip not available on the Seaborn github site?
I think the easiest way is to use sudo:
sudo pip install seaborn
It requires sudo permission to write to usr/local/lib.
Note: If you're using anaconda you won't need sudo to install via pip, once you've conda installed pip, though seaborn may also be available via conda.
Personal installation is a good habit to get into:
pip install --user seaborn
However, there is an even easier way: as of writing python XY maintains up-to-date builds of pandas and seaborn (among other useful packages), so all you have to do is
sudo add-apt-repository ppa:pythonxy/pythonxy-devel
sudo apt-get update
sudo apt-get install python-seaborn python-pandas
Note that this will only work with python 2.x; you will still need pip3 to install the python 3.x packages.