Home > database >  wagtail No module named wagtail.contrib
wagtail No module named wagtail.contrib

Time:01-03

I did start wagtail fresh installation after I did and I want to use python instead python3

pip3 install wagtail
wagtail start wagtail02
cd wagtail02
pip3 install -r requirements.txt

when I try to do python manage.py migrate I get an error message

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/lotfi/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/home/lotfi/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/home/lotfi/.local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/lotfi/.local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/lotfi/.local/lib/python2.7/site-packages/django/apps/config.py", line 120, in create
    mod = import_module(mod_path)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named wagtail.contrib

I don't find a solution on internet but if I do python3 manage.py migrate it work, is there a solution to make it working using python instead of python3

CodePudding user response:

By running pip3 install wagtail and pip3 install -r requirements you're installing packages under python3, and then trying to run it with python2.
To install under the correct version of python, try running:
python -m pip install wagtail
python -m pip install -r requirements.txt

CodePudding user response:

It looks like your python executable is Python 2.7, which Wagtail dropped support for in 2018.

However, setting up a virtual environment will allow you to repoint the pip and python aliases to any Python version of your choosing - you can then install Wagtail in that environment and invoke it with the python command.

  • Related