On Windows, I am running a Python server that uses gino, asyncpg, and sqlalchemy. This application runs fine in normal Run mode, but when I run in debug mode, the database engine fails to initialize. I narrowed the issue down to a problem with a sqlalchemy script in which pkg_resources is used to load a dialect plugin for asyncpg. All of the other libraries in the project seem to be called from the virtual environment, but pkg_resources specifically is being loaded in from the system Python install:
Because my system install lacks the other dependencies, the loading process fails at this point.
But as you can see, pkg_resources seems to be installed just fine in my virtual environment:
When I try to import pkg_resources in the Python Console, it loads from the virtual environment. And when I run the application normally (not in debug mode), it seems to all work just fine.
Has anyone ever run into this issue? What in the world could be causing it? I am using PyCharm Community Edition 2019.3