Pycharm does not use system PYTHONPATH

In our lab we use "module" to dynamically switch versions of the software needed by different projects / users on different servers.

My current config, executing in .bashrc among other things sets about 10 paths in PYTHONPATH environment variable.

When running python from an SSH session, I get
>> len(sys.path)
and e.g. import matplotlib works fine

When Running from PyCharm I get

import sys

and import matplotlib fails.

Looking at the project interpreter configuration *does* list all correct packages, including matplotlib. Only at run time they are not found.


The solution to duplicate all settings from PYTHONPATH in the Pycharm IDE via setting interpreter paths as described in the docs

does not seem appropriate -- I have multiple projects and I might want to test versus different versions of the software. Not to mention that duplicating the settings that are already available via PYTHONPATH is a redundancy that complicates and confuses things.


I found some relatively old posts about related issues, e.g.

Have the current status not changed? 

Please clarify:

1) Does PyCharm completely ignores system PYTHONPATH?

2) Is there any workaround to get PYTHONPATH used without having to copy all paths from there manually? Is it possible to create a python wrapper script like discussed in the linked post that actually works?


PyCharm 2018.3.4 (Professional Edition)
Build #PY-183.5429.31, built on January 29, 2019
JRE: 1.8.0_152-release-1343-b26 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.10.5

The remote python interpreter is configured through a deployment configuration


1 comment


>Does PyCharm completely ignores system PYTHONPATH?

No, Pycharm use PYTHONPATH as one of the sources to construct sys.path


Maybe you run PyCharm from a different environment than the one where you have set PYTHONPATH? I suggest the following test:

1. Open system terminal and source your .bashrc , ensure you have all the paths in PYTHONPATH

2. Run PyCharm from this same terminal session.

Please share the result


Please sign in to leave a comment.