2

Note - I already check numpy import error related threads but none helped

I am using debian 8 where default python is 2.7.9. I installed python 3.4.2 and created virutal env.

Within virtual environment -

python -V
Python 3.4.2

pip -V
pip 1.5.6 from /path/venv34/lib/python3.4/site-packages (python 3.4)

I have python3 numpy package - python3-numpy_1.12.0-2~pn0_amd64.deb

which I have installed with sudo dpkg -i python3-numpy_1.12.0-2~pn0_amd64.deb

which successfully completed.

Now when I do

python
Python 3.4.2 (default, Feb  7 2019, 06:08:06) 
[GCC 4.9.2] 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'
>>> 

Any clue what's wrong here?

user2129623
  • 2,167
  • 3
  • 35
  • 64
  • You should install numpy with `pip install numpy` instead. It will add it to your python scripts folder, which is where the interpreter looks for packages. – Jack Walsh Mar 06 '19 at 05:26
  • @Jack: I need specific version of `numpy` as `numpy_1.12.0-2~pn0_amd64.deb` – user2129623 Mar 06 '19 at 05:27
  • Possible duplicate of [Install a module using pip for specific python version](https://stackoverflow.com/questions/10919569/install-a-module-using-pip-for-specific-python-version) – Baltschun Ali Mar 06 '19 at 05:40

3 Answers3

3

python3.4 -m pip install numpy==1.12.0-2

Baltschun Ali
  • 376
  • 3
  • 12
  • `raise ValueError(msg, line, "at", line[p:]) ValueError: ('Expected version spec in', 'python3-numpy_1.12.0-2~pn0_amd64.deb', 'at', '~pn0_amd64.deb')` – user2129623 Mar 06 '19 at 05:33
2

Try python -m pip install numpy==1.12.0. This should help you.

Mayur
  • 4,345
  • 3
  • 26
  • 40
2

ok since my repo is less than 50 i can not add comments, so take this answer as a comment to your question.

I think numpy is installed but not in your virtualenv, make sure your virtualenv is active when you are trying to install any library, you will see virtualenv name in every command line if it is activated.

(venv) C:\Users\seventeen\sprint25>

Vikas Gautam
  • 239
  • 1
  • 4
  • 21