I am running into the following issue trying to install mysqlclient as part of getting a Django project up and running on an AWS EC2 instance.
In a python 3.8.5
virtual environment:
(venv3)$ which pip
~/venv3/bin/pip
(venv3)$ pip --version
pip 21.0.1 from /home/ec2-user/venv3/local/lib/python3.8/dist-packages/pip (python 3.8)
(venv3)$ pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-2.0.3-cp38-cp38-linux_x86_64.whl
Installing collected packages: mysqlclient
Successfully installed mysqlclient-2.0.3
I try running the Django Shell:
(venv3)$ python manage.py shell
...full trace stack truncated for brevity...
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
So I tried to find where pip installed it, and it seems to not actually be installed or be a trace of it anywhere:
(venv3)$ pip show mysqlclient
WARNING: Package(s) not found: mysqlclient
(venv3)$ pip freeze | grep -i mysqlclient
<nothing>
(venv3)$ sudo find / -name mysqlclient
<nothing>
Then as a sanity check I apparently successfully install it but then pip can't find it to uninstall it:
(venv3)$ pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-2.0.3-cp38-cp38-linux_x86_64.whl
Installing collected packages: mysqlclient
Successfully installed mysqlclient-2.0.3
(venv3)$ pip uninstall mysqlclient
WARNING: Package(s) not found: mysqlclient
Other things I have tried/verified
- Making sure python is the 64-bit version
- Checking pip outside of the virtual environment
- Nuking the virtual environment and starting again
- Trying to install specific versions of
mysqlclient
- Installing and importing/using any other python package
EDIT: Wanted to add that I have also deleted the pip cache and it still does not work.