3

Hello I know there are a lot of posts already about this but after reading through previous posts I still have not found a solution to my issue. To install python I followed the steps of this post here. All seemed to work as expected. In terminal, typing python gives:

zachary@zachary-desktop:~$ python
Python 2.7.5 (default, May 20 2014, 12:26:28) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

To install numpy I followed the instructions outlined here

Following the steps I reached this point

zachary@zachary-desktop:~$ python --version
Python 2.7.5
zachary@zachary-desktop:~$ apt-cache policy python-numpy
python-numpy:
  Installed: 1:1.8.1-1ubuntu1
  Candidate: 1:1.8.1-1ubuntu1
  Version table:
  *** 1:1.8.1-1ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status
zachary@zachary-desktop:~$ apt-cache policy cython
cython:
  Installed: 0.20.1+git90-g0e6e38e-1ubuntu2
  Candidate: 0.20.1+git90-g0e6e38e-1ubuntu2
  Version table:
 *** 0.20.1+git90-g0e6e38e-1ubuntu2 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status
zachary@zachary-desktop:~$ 
zachary@zachary-desktop:~$ apt-cache policy python-scipy
python-scipy:
  Installed: 0.13.3-1build1
  Candidate: 0.13.3-1build1
  Version table:
 *** 0.13.3-1build1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status

So as far as I can see I have installed all of the modules correctly. However when I try to import I get the following error

zachary@zachary-desktop:~$ python
Python 2.7.5 (default, May 20 2014, 12:26:28) 
[GCC 4.8.2] on linux2
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

I think an error may be with the path however I am new to Ubuntu and don't know how to change this setting.

when I do

zachary@zachary-desktop:~$ echo $PYTHONPATH

I get a blank line, which seems wrong. Thanks for the help!

  • What does which python say? How about /usr/bin/python --version? You shouldn't have needed to follow those instructions to install python from a source tarball - AFAIK the default installation of Ubuntu Trusty should come with python 2.7.6, so perhaps the version of numpy is not compatible with 2.7.5? – steeldriver May 20 '14 at 20:10

1 Answers1

3

python 2.7 is normally installed by default (See this answer).

I guess that your local build of python is installed in /usr/local/bin (check using type python) and then does not have access to packages (like numpy) installed system-wide.

So try using:

/usr/bin/python -c "import numpy"