Making a few assumptions about how everything has been configured, you can essentially just directly extract the contents of a *.deb into the root of the file system. You should never, ever, do this on a system where apt is working properly, but if apt isn't available, here's what you do.
BUT FIRST, A WARNING!
MANUALLY INSTALLING PACKAGES AS DESCRIBED BELOW IS BAD AND YOU CAN EASILY REALLY MESS THINGS UP!
BACKUPS BEFORE HAND ARE HIGHLY RECOMMENDED!
Find out what package you need, which you can find out by running, e.g. for numpy apt-cache search numpy
on a Pi with apt. Alternatively you can browse http://mirrordirector.raspbian.org/raspbian/dists/stable/main/binary-armhf/Packages, which contains a full list of packages. You can then download the *.deb file for your package from the Rasbian mirrordetect, e.g. for python-numpy http://mirrordirector.raspbian.org/raspbian/pool/main/p/python-numpy/python-numpy_1.16.5-1_armhf.deb. Extract this file using the GUI, or if no tool automatically opens it the command ar x python-numpy_1.16.5-1_armhf.deb
. You should find among the files extracted a data.tar.xz file. This contains all of the contents that apt installs. You can do (roughly) what apt would do by running sudo tar -xf data.tar.xz -C /
. To avoid accidentally doing something bad, you can run just tar -xf data.tar.xz
which will extract the files into the current directory. You can then check to see what would be overwritten, and manually copy files as needed to avoid this.
Just installing python-numpy may not be enough to get numpy working as since this is manual you have to follow the dependency tree. This is given in the Packages file mentioned above. In the case of python-numpy,
Depends: python (<< 2.8), python (>= 2.7~), python2.7:any, python:any
(<< 2.8), python:any (>= 2.7~), libblas3 | libblas.so.3, libc6 (>=
2.27), liblapack3 | liblapack.so.3, python-pkg-resources
Based on that, you'll probably also need to track down libblas3 and liblapack3 and install those manually as well, and in turn follow there dependencies. See why package managers are so great?
Note 1: Even if apt isn't available dpkg may be! You can install from the .deb file directly then using dpkg -i python-numpy_1.16.5-1_armhf.deb
.
Note 2: This doesn't do any post-install configuration of packages that apt might do! You can find what it would have done in the control.tar.xz file, and manually carry out these steps.
Note 3: If you aren't running stable Raspbian, (currently Buster) then the links above will download the wrong package, check which Raspbian you're on using cat /etc/issue
and edit the links swapping out 'stable', etc., as needed.
Note 4: These steps also assume you're familiar with getting files onto your remote Pi via wget
or scp
or some other file transfer tool (such as inserting the SD card into another PC).
sudo apt install python{,3}-numpy
should work on Stretch and Buster.