Python Forum

Full Version: Installing Numpy on Raspberry Pi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!

I'm trying to use numpy with python3 on my Rasspberry Pi, but I'm not able to import the module after I installed it with sudo apt install python3-numpy, see below.

Installing numpy:
pi@raspberrypi:~ $ sudo apt install python3-numpy
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
gfortran python-numpy-doc python3-dev python3-nose python3-numpy-dbg
The following NEW packages will be installed:
python3-numpy
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 0 B/1,693 kB of archives.
After this operation, 9,492 kB of additional disk space will be used.
Selecting previously unselected package python3-numpy.
(Reading database ... 129861 files and directories currently installed.)
Preparing to unpack .../python3-numpy_1%3a1.12.1-3_armhf.deb ...
Unpacking python3-numpy (1:1.12.1-3) ...
Setting up python3-numpy (1:1.12.1-3) ...
Processing triggers for man-db (2.7.6.1-2) ...


Afterwards I try to import numpy, but it fails:
pi@raspberrypi:~ $ python3
Python 3.6.3 (default, Mar 28 2020, 15:16:40)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'


What am I doing wrong? Could you please help me?

Tahnk's in advance,

Johannes
Why not use pip?

I wouldn't be surprised if you have two Python 3 versions installed on your system, and that's the issue. I bet this would work:
$ python3 -m pip install numpy
(Apr-03-2020, 06:17 PM)micseydel Wrote: [ -> ]Why not use pip?

I wouldn't be surprised if you have two Python 3 versions installed on your system, and that's the issue. I bet this would work:
$ python3 -m pip install numpy

Thank's alot! Unfortimateöy aösp üip fials on my Raspi:
pi@raspberrypi:~ $ sudo python3 -m pip install --index-url=https://pypi.python.org/simple/   numpy
Error:
Could not fetch URL https://pypi.python.org/simple/numpy/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available.
What could I do?

Thanks in advance Smile ! Johannes
Try this then try to install again.
python3 -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip
pip3 can also work alone,may need to install it.
# Install
sudo apt-get update
sudo apt install python3-pip

# Test with:
pip3 -V 

# Not using sudo
pip3 install --user numpy