ModuleNotFoundError for a present module

0

Right, any valid reason as to why I'm getting the following:

Traceback (most recent call last):
  File "/home/ubuntu/.ssh/xxxx/manage.py", line 22, in <module>
    main()
  File "/home/ubuntu/.ssh/xxxx/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/django/core/management/__init__.py", line 416, in execute
    django.setup()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/django/apps/config.py", line 193, in create
    import_module(entry)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_bootstrap_icons'
ubuntu@ip-172-31-21-168:~/.ssh/blauwestadtech$ 

When I run the command:

python3 manage.py makemigrations

Despite this already being installed in my settings under:

INSTALLED_APPS = [
    ....
    ....
    'django_bootstrap_icons',
    ....
    ....
]

Getting rather sick and tired of these silly little things now to be honest,

asked a month ago82 views
1 Answer
0

The error message you're encountering indicates that Django is unable to find the module named 'django_bootstrap_icons'. There could be several reasons for this issue:

  • Module Not Installed: First and foremost, ensure that the 'django_bootstrap_icons' module is correctly installed in your Python environment. You can verify this by running pip list to see if it appears in the list of installed packages. If it's not installed, you can install it using pip install django-bootstrap-icons.
  • Virtual Environment: If you're using a virtual environment for your Django project, make sure you have activated it before running python3 manage.py makemigrations. Sometimes, packages are installed in a virtual environment but the environment isn't activated when running commands.
  • Path Issues: It's possible that the Python interpreter running manage.py is different from the one where 'django_bootstrap_icons' is installed. Ensure that the Python interpreter you're using is the correct one and has access to the installed packages
  • Typo or Misspelling: Double-check the spelling of 'django_bootstrap_icons' in your INSTALLED_APPS setting. Even a small typo can lead to this kind of error.
  • Package Version Compatibility: Ensure that the version of 'django_bootstrap_icons' you have installed is compatible with the version of Django you're using. Sometimes, incompatibility between package versions can lead to such errors.
  • Project Structure: If 'django_bootstrap_icons' is not a standard Django package and is installed in a non-standard location, make sure that the path to this package is correctly specified in your project's settings.
profile picture
EXPERT
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions