1

While I was struggling to understand why I couldn't import NumPy I think that I faced another problem. During the numerous attempts and through various different "solutions" I think that I end up installing two python.

/usr/bin/python --version
Python 2.7.6

renan@renan-1215B:~$ which python
/usr/local/bin/python

Now when I try to import NumPy the following error appear:

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

Everything seems to be installed

renan@renan-1215B:~$ apt-cache policy python-numpy
python-numpy:
  Installed: 1:1.8.2-0ubuntu0.1
  Candidate: 1:1.8.2-0ubuntu0.1
  Version table:
 *** 1:1.8.2-0ubuntu0.1 0
        500 http://br.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1:1.8.1-1ubuntu1 0
        500 http://br.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
renan@renan-1215B:~$ 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://br.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status
renan@renan-1215B:~$ 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://br.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status

I tried the following solution and get the same error message

renan@renan-1215B:~$ /usr/local/bin/python -c "import numpy"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named numpy

I want to know if it would be too much painful to remove one of these pythons (I saw some warnings to not remove python, otherwise it could crash the system, then I would not dare to do this by myself) If not, how could I do it ? And backing to the main question, what else should I try to import NumPy (I did not showed more attempts because after I notice 2 pythons installed I assumed that it could be a cause of my fail attempts, but I can say that apt-get and aptitude did not work.)

5
  • 1
    The python in /usr/local is probably one installed from source, and could/should be removed. Did you install from source? Also, does /usr/bin/python -c 'import numpy' work?
    – muru
    Jan 29, 2015 at 2:56
  • Yes, it worked, Thanks ! Should I remove it with rm ou apt-get remove? Jan 29, 2015 at 5:08
  • 1
    Unfortunately, apt-get would be the wrong command. Software installed via apt-get don't touch /usr/local. Did you at any time, compile Python (something like ./configure; make; sudo make install)?
    – muru
    Jan 29, 2015 at 5:12
  • Yes, exactly those commands. Jan 29, 2015 at 10:55
  • You might have to delete more than just /usr/local/bin/python, so run make install again to see which files where installed and delete them like the linked answer did.
    – muru
    Jan 29, 2015 at 16:54

0

Browse other questions tagged .