PyCharm Won't Import Module (Numpy) Even Though It Shows It's Installed

Answered

I'm sorry if this problem has already been covered. I'm new to Python and PyCharm, so I may have missed something, but I checked similar questions and didn't see a solution that applied to me. 

 

I created a virtual environment and installed numpy using PyCharm's GUI. The screenshots below of the 1) project interpreter settings and 2) terminal verify that the installation took place. 


However, when I try to import numpy in the session, I get an error:

I thought it might be something wrong with numpy itself, but the same problem occurs with pandas. 

9 comments

Hi Fenixjeanne,

Thank you for contacting PyCharm support.

Please provide a screenshot of your Run/Debug Configuration window (Run | Edit Configurations...).

Looking forward to your reply.

Kind regards,

Sergey

https://www.jetbrains.com

The Drive to Develop

1

I hope this was the screenshot you were looking for.

0

Please check your Python interpreter in  `Settings | Build, Execution, Deployment | Console | Python Console`.

It should be the same as your Project Interpreter as shown on the screenshot with example:

Kind regards,

Sergey

https://www.jetbrains.com

The Drive to Develop

0

The interpreter looks to be the same - PyCharm_projs

0

Thanks for the update.

Is `import numpy` resolved in the Editor?

Please provide more details about the scenario. Do you import numpy in the Python Console or run code from Editor to console?

If possible, please attach a sample project so I can try to reproduce.

Kind regards,

Sergey

https://www.jetbrains.com

The Drive to Develop

0

I imported in the console. I don't know why because I didn't change settings, but it is now working. I imported numpy just now with no problem. Could exiting the program have reset PyCharm?

0

That's odd.

Yes, it could be there was something with indexing. When restarted PyCharm reindexed the project and probably that is what resolved the issue.

Thank you for letting me know anyway.

Kind regards,

Sergey

https://www.jetbrains.com

The Drive to Develop

0

Hi,

I recently installed on a fresh windows 10 installation (with all the updates) the following:

Anaconda3-2018.12-Windows-x86_64.exe

 

and then:

pycharm-community-2018.3.3.exe

 

I turned on PyCharm and created a new project with existing interpreter C:\Users\<username>\AppData\Local\Continuum\anaconda3\python.exe

 

I created a new python file and set the interpreter the same as the project default.

I typed "import numpy as np" and tried to run. It didn't work. Then I tried directly in the console and the same result.

The message says that it couldn't load the DLL and that it is probably broken.

A colleague tried the same thing with the same result.

 

Please help,

Viktor

0

Hi Viktorpopescu,

The problem is caused by known issue https://youtrack.jetbrains.com/issue/PY-27234. It should be fixed in 2019.1 version. We have just realised our EAP build which has a fix for it. Would you mind give it a try?

You can download it from https://www.jetbrains.com/pycharm/nextversion/

0

Please sign in to leave a comment.