Impossible to import model_utils module in Django


I follow the official documentation of the django-model-utils model and I’ve just done pip install django-model-utils in my virtual environment.

However, VSCode indicates that Import "model_utils.managers" could not be resolved as shown below.

VSCode error display

With pip list I’ve checked that the module is effectively installed.

Package                  Version
------------------------ --------
asgiref                  3.6.0
autopep8                 2.0.1
defusedxml               0.7.1
diff-match-patch         20200713
Django                   4.1.5
django-admin-rangefilter 0.9.0
django-extensions        3.2.1
django-import-export     3.1.0
django-model-utils       4.3.1
django-phonenumber-field 7.0.2
djangorestframework      3.14.0
et-xmlfile               1.1.0
import-export            0.3.1
MarkupPy                 1.14
odfpy                    1.4.1
openpyxl                 3.1.1
phonenumbers             8.13.4
Pillow                   9.4.0
pip                      22.0.2
pycodestyle              2.10.0
pytz                     2022.7.1
PyYAML                   6.0
setuptools               59.6.0
sqlparse                 0.4.3
tablib                   3.3.0
tomli                    2.0.1
xlrd                     2.0.1

And I’ve look that the folder exists with the right name and a file as shown below.
Screenshot of lib folders

How can I solve this please ?

Asked By: Dhrions



Try restarting VSCode and reloading the Python interpreter. To reload the Python interpreter, open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P) and type "Python: Select Interpreter". Then, select the interpreter that corresponds to your virtual environment.

Answered By: Sunderam Dubey