from pkg_resources import DistributionNotFound, get_distribution ModuleNotFoundError: No module named ‘pkg_resources’

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:

  1. The problem: The drf_yasg package (Django REST framework Yet Another Swagger Generator) is trying to import pkg_resources, which is not available.
  2. Solution: Install or upgrade setuptools in your virtual environment.

Here are the steps to resolve this:

  1. 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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Select your currency
USD United States (US) dollar