PyCharm: ImportError: libmysqlclient.so.20 only when I run django app from IDE

Viewed 87

I am working on a simple Django app using PyCharm community edition, python 3.9 and ubuntu 20.04. The project's virtual environment is in folder [project root]/venv/

When I start the app from the pycharm terminal window I execute the following commands and everything works fine (no import errors):

source ./venv/bin/activate
python manage.py runserver

When I start the app from the IDE running configuration, I get an ImportError: libmysqlclient.so.20: cannot open shared object file: No such file or directory.

Given that the project runs via the terminal, I believe that my python installation and my virtual environment are ok. I guess that this should not happen if the IDE run/debug configuration was using the same virtual environment hosted in [project root]/venv/. Therefore, I suppose the run/debug configuration is not correctly configured, or there is something missing in my paths. I have checked other posts but I could not find a solution.

The following screenshots depict my run/debug configuration and the setup of my virtual environment in the PyCharm IDE (also showing the respective packages). enter image description here enter image description here

Could somebody please guide me?

Is there a way to confirm that my run debug configuration uses the same virtual environment as the one used via the terminal? Is there a setting in PyCharm IDE that I should check for? Do I miss something fundamental about how do python virtual environments work?

0 Answers
Related