Pandas: ImportError: Missing required dependencies ['numpy'] (Pycharm + Win10 only)
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
Please sign in to leave a comment.
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;
I am getting the same error on windows 7 now. I pretty much cannot use pycharm now.
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.
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.
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.
You should run it in the terminal. The idea is to get the correct PATH and then put it in PyCharm.
How is it possible that a bug like this made it into pycharm? Looks like nobody is testing it.
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"
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
Please try the latest 2019.1.1 version: https://www.jetbrains.com/pycharm/download
Some Anaconda improvements were made there over 2019.1 version.
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.