0

I couldnt import numpy though I had it installed in the system

steven@steven-VirtualBox:~$ 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://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1:1.8.1-1ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
9
  • Are you using python 2 or python 3? Commented Nov 30, 2015 at 6:19
  • How are you trying to import it? What error message do you get? Commented Nov 30, 2015 at 6:48
  • @MatteoItalia I am using python 2.7.10 Commented Nov 30, 2015 at 17:54
  • @ChathanDriehuys well just open the python script from the terminal and import numpy Python 2.7.10 (default, Nov 27 2015, 18:37:43) [GCC 4.8.4] 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 Commented Nov 30, 2015 at 17:56
  • @Squart I just installed numpy using apt-get install python-numpy and didn't get the import error you did. My apt-cache looks identical to yours so I have no idea what's going on. Sorry. Commented Nov 30, 2015 at 22:25

1 Answer 1

2

From the comment I find that your local build of python is installed in /usr/local/bin and then does not have access to packages (like numpy) installed system-wide.

So try using:

/usr/bin/python -c "import numpy"
Sign up to request clarification or add additional context in comments.

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.