PyCharm does not use environmental varialbe %PATH% in Windows
Answered
I fail to load a pyhon module when running the script in PyCharm IDE. The python module relies on cuda dll, e.g. cudnn64_7.dll. I have added the cuda path into the environmental variables %PATH% of windows.
cuda_bin_path=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin
The script can run in Windows command or ipython, but could not run in PyCharm IDE. I doubt that PyCharm do not use %PATH% to find .exe or .dll, or parse the windows %PATH% by mistake.
Please sign in to leave a comment.
Have you tried printing PATH from PyCharm?
For example, run the following code to check if your entry is in PATH:
import os
print(os.environ['PATH'[)
Also, did you add that to PATH or created another env variable?
I just tried adding an entry to PATH, then restart PyCharm and Toolbox, ran the above script and the entry was there.
I printed PATH from Pycharm. My entry is there.
I updated PyCharm to the latest version 2019.3.2. The issue remains.
Thanks
Yong
So PyCharm does read your PATH env variable.
Make sure the issue doesn't reproduce when you run your code from the system cmd prompt using the same interpreter you use in PyCharm.
If it works fine, try starting PyCharm from the cmd prompt and see if it helps.
I can run the script in the windows promp.
Then I start PyCharm from the same windows prompt, and it does not work with the same issue.
Then perhaps the issue is not related to PATH.
Try setting your env variable in the run configuration.
I figured out the issue. It is not related to PyCharm, but due to the cuda .dll version conflict in between two python libraries, onnxruntime-gpu and pytorch.
Thanks for your help.