38

For python 3.2 I used sudo apt-get install python3.2-numpy.It worked. What to do for python3.3? Nothing I could think of works. Same goes for scipy, etc. Thanks.

Edit: this is how it looks like

radu@sunlit-inspired:~$ python3
Python 3.3.2 (default, Jul  3 2013, 10:17:40) 
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
3
  • What did you do and what errors did you get? Commented Jul 3, 2013 at 8:39
  • Install python3.3: linuxg.net/… . Once you have it, follow @LennartRegebro answer. Commented Jul 3, 2013 at 9:29
  • @Zhneya: do you mean I should uninstall and install anew using deadsnakes? Commented Jul 3, 2013 at 9:53

5 Answers 5

14

From the terminal run:

  sudo apt-get install python3-numpy

This package contains Numpy for Python 3.

For scipy:

 sudo apt-get install python3-scipy

For for plotting graphs use pylab:

 sudo apt-get install python3-matplotlib
Sign up to request clarification or add additional context in comments.

1 Comment

sudo apt-get install python3-numpy worked for me :)
11

The normal way to install Python libraries is with pip. Your way of installing it for Python 3.2 works because it's the system Python, and that's the way to install things for system-provided Pythons on Debian-based systems.

If your Python 3.3 is system-provided, you should probably use a similar command. Otherwise you should probably use pip.

I took my Python 3.3 installation, created a virtualenv and run pip install in it, and that seems to have worked as expected:

$ virtualenv-3.3 testenv
$ cd testenv
$ bin/pip install numpy
blablabl

$ bin/python3
Python 3.3.2 (default, Jun 17 2013, 17:49:21) 
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> 

8 Comments

unfortunately my system Python is 2.7.3 so pip installs there. there is a pip-3.2 but no pip-3.3.
@Radu: Just like numpy needs to be installed specifically for Python 3.3, pip needs to be installed for Python 3.3. regebro.wordpress.com/2011/02/02/…
i ran python3 distribute_setup.py and it tells me Installing easy_install-3.2 script to /usr/local/bin ! i can confirm that python3 is python3.3 not python3.2.
@Radu: I find it somewhat hard to believe that distribute_setup.py would create an easy_install-3.2 if executed with Python 3.3. If it really does, your installs are seriously messed up.
I believe you. Yet this is what happens. Could you be so kind and tell me what would you do if you had this situation on your machine and you needed python3.3? Thank you.
|
5

I'm on Ubuntu 15.04. This seemed to work:

$ sudo pip3 install numpy

On RHEL this worked:

$ sudo python3 -m pip install numpy

Comments

4

My issue was the failure to import numpy into my python files. I was receiving the "ModuleNotFoundError: No module named 'numpy'". I ran into the same issue and I was not referencing python3 on the installation of numpy. I inputted the following into my terminal for OSX and my problems were solved:

python3 -m pip install numpy

Comments

1

On fedora/rhel/centos you need to

sudo yum install -y python3-devel

before

mkvirtualenv -p /usr/bin/python3.3 test-3.3
pip install numpy

otherwise you'll get

SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.