Pandas: ImportError: Missing required dependencies ['numpy'] (Pycharm + Win10 only)

Answered

Hey guys, 

I would like to use Pandas and get this standard missing dependency warning suggesting numpy is missing, but indeed it is not.
This occurs only when importing pandas in a python file within PyCharm and only in Windows 10, not on MAC or Linux and I do not know why?


Setup Example:
PyCharm Pro #PY-182.4505.26

conda env: $conda create -n scratch python=3.7 pandas numpy scipy

Env import in Pycharm via: Settings -> Project Interpreter -> Add -> Conda Environment -> Existing Environment -> Navigate to c:\path\to\miniconda3\envs\scratch\python.exe

Minimal Python Example:
Pycharm -> New -> Python File -> scratch.py

import pandas as pd

data = {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
df = pd.DataFrame.from_dict(data)
print(df)

------------------

Running via: Rightclick in editor window -> run --> Exception as mentioned above
BUT
when running in terminal directly:
$activate scratch
$ python scratch.py

everything works fine.

Can s.o. give an advice what is wrong here and why this only happens within PyCharm?

Thank you very much
Patrick

 

5
12 comments
Avatar
Permanently deleted user

Ah OK, looks like it is the same wired PATH thing like here:

https://youtrack.jetbrains.com/issue/PY-27234
https://bit.ly/2EGzNnG
https://bit.ly/2OJbHgV

Is there a way I can temporarily work around this until it will be fixed in 2018.3?

I have this paths set to my windows user path variable, but this does not fix the problem.

C:\path\to\miniconda3
C:\path\to\miniconda3\Library\mingw-w64\bin
C:\path\to\miniconda3\Library\usr\bin
C:\path\to\miniconda3\Library\bin
C:\path\to\miniconda3\Scripts;

0

I am getting the same error on windows 7 now. I pretty much cannot use pycharm now.

0

Hi,

We have filed an issue about it to our issue tracker https://youtrack.jetbrains.com/issue/PY-32366, please follow it for future updates. 

See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.

0

As a workaround you could try running the script with print(os.environ['PATH']) in the terminal and then take the output and put it in Run configuration environment variable.

1
Avatar
Permanently deleted user

Thank you Sergey, for adding to youtrack.

Maybe a picture is better. So I dont think it make sense to add the same paths to the PATH Variable again to the run configuration as it already present. What I find wired is even if I point the absolute path to the relevant env in the "path" variable "C:\portable\python\miniconda3\envs\dev" instead of only "C:\portable\python\miniconda3" it still does not work.

So I can´t find out what exactly and where Pycharm is looking for.

 

0

You should run it in the terminal. The idea is to get the correct PATH and then put it in PyCharm.

0
Avatar
Permanently deleted user

Thats it! Obviously all paths from ...\envs\dev\... are needed. Thank you so much. I was searching for a solution for days already.

0

How is it possible that a bug like this made it into pycharm? Looks like nobody is testing it.

0
Avatar
Permanently deleted user

The issue still exists in PyCharm 2019.1. Since it is not possible to copy-paste the value for PATH variable, one has to type it. Apparently, one needs only "C:\path-to\Anaconda3\Library\bin"

0
Avatar
Permanently deleted user

Hum, not sure it's PyCharm. I have exactly the same problem with Eclipse and PyDev.  I resolve it with the PATH declaration. 

I use Anaconda3-2019.03-Windows-x86_64 and I found the same problem on PyCharm and Eclipse/PyDev with the same "conda environments"

Dan

0

Please try the latest 2019.1.1 version: https://www.jetbrains.com/pycharm/download

Some Anaconda improvements were made there over 2019.1 version.

0
Avatar
Permanently deleted user

This bug still exists in 2019.1.2 (even installed the Anaconda version). I'm so glad I got a month to month license instead of paying for a full year, then I'd be even more pissed than I am now!!  So unless I can figure out a way to do data analysis without Pandas, then I guess it's back to Spyder (I checked and my code runs flawlessly in Spyder).

UPDATE: Fixed by typing

pip install numpy --force-reinstall

in the Python Console tab.

1

Please sign in to leave a comment.