This error is occurring because the pkg_resources
module, which is part of the setuptools
package, is not available in your Python environment. This is a common issue when using Python 3.12, as setuptools
is no longer included by default. Let’s resolve this issue:
- The problem: The
drf_yasg
package (Django REST framework Yet Another Swagger Generator) is trying to importpkg_resources
, which is not available. - Solution: Install or upgrade
setuptools
in your virtual environment.
Here are the steps to resolve this:
- Activate your virtual environment if it’s not already activated:
source /var/www/vhosts/for-gaza.com/api.for-gaza.com/venv/bin/activate
2. Install or upgrade setuptools
:
pip install --upgrade setuptools