Bizzare Virtual Environment Behavious - Terminal is fine but run/debug in PyCharm fails

When I try to run the code through PyCharms run/debug function it fails to find the installed modules. PyCharm itself is fine, it doesn't complain about missing modules and the environment appears to be fine.

When I run the exact same command in the Terminal it works without issue.

This happens for both pipenv and venv created environments, whether in PyCharm or externally.

PyCharm Pro 2020.3.3

Linux Mint 20.1

virtualenv 20.0.17 from /usr/lib/python3/dist-packages/virtualenv/

pipenv, version 11.9.0 from /usr/bin/pipenv

When running/debugging in PyCharm...

When running the exact same command from the terminal...

I haven't tried conda but I assume the same behaviour.

I have removed all other interpreters and disabled the local versions python from the environment to ensure there are no conflicts.

I have no idea what might be causing this.



After testing briefly I found the problem is the name of the file I am running. It can be recreated by adding a file called to the root of your project.


How weird.




it looks like the following bug , please vote for it in order to be updated once it is resolved. 

I apologize for the inconvenience.


Please sign in to leave a comment.