I successfully installed most of the python data science packages on my RPi Zero using Geoff Boing's excellent guide. However, the versions of some of the packages seem quite old. E.g. numpy.__version__
is '1.8.2' and scipy is '0.14.0'.
My system:
Raspbian GNU/Linux 8 (jessie)
If I do
sudo apt-get upgrade python-numpy
I get
python-numpy is already the newest version.
But the most recent version from Scipy is 1.15.
Is it a limitation of my OS or is 1.8.2 the most recent build for RPi or am I doing something wrong?
(My main issue is numpy 1.8.2 doesn't have various methods I want to use like np.flip
).
1 Answer 1
You can use the Python package manager Pip to get packages. These are not tied to a distributions packages. You may have to install it via sudo apt-get install python-pip
.
To get numpy (1.15.4 at time of writing) you'll need the python dev packages sudo apt-get install python-dev python3-dev
. You can omit python3-dev if you are stuck on python2.
Then you can fetch down numpy from pip either globally sudo pip install numpy
or if you are using a python virtual environment (virtualenv) then just pip install numpy
with the environment activated.
Bear in mind it takes a while to build numpy in this fashion. On a Pi 2 it took about 30 minutes so might take an hour or more on the zero.
-
Odd that so many people want to build this kind of packages from source (especially on models like the Zero). On Raspbian Stretch and Python 3 there are pre-compiled wheels available using pip3. And with a minimal bit of work you can also do the same on Jessie.Dirk– Dirk2018年11月12日 20:13:37 +00:00Commented Nov 12, 2018 at 20:13
-
Upgrading the entire OS for one package seems like a worse use of time than having pip build this for you. If you feel you can detail the minimal work needed it sounds like problem solved.user29019– user290192018年11月12日 20:29:15 +00:00Commented Nov 12, 2018 at 20:29
-
Add /etc/pip.conf (see piwheels.org). And it's a good idea to leave Jessie behind soon anyway. Updates will end soon... And IIRC it takes a lot more than an hour to build numpy on a Zero.Dirk– Dirk2018年11月12日 21:04:34 +00:00Commented Nov 12, 2018 at 21:04
-
I'd make that an answer, looks like it's a neat solution. Nice work.user29019– user290192018年11月12日 21:12:56 +00:00Commented Nov 12, 2018 at 21:12
-
I think I already did that for other questions. Not sure though. I'll have a lookDirk– Dirk2018年11月12日 21:16:50 +00:00Commented Nov 12, 2018 at 21:16
1.12.1
... and looking further, in buster and sid it's1.14.5
- so you'll need to look for some other way to get 1.15