0

I have installed

pip install sqlparse
pip3 install sqlparse
conda install sqlparse

But still getting sqlparse module error Why is that?

(New4) C:\Users\zesha\Documents\GitHub\django-blog>python manage.py makemigrations
Traceback (most recent call last):
  File "C:\Users\zesha\Documents\GitHub\django-blog\manage.py", line 21, in <module>
    main()
  File "C:\Users\zesha\Documents\GitHub\django-blog\manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\zesha\AppData\Roaming\Python\Python39\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Users\zesha\AppData\Roaming\Python\Python39\site-packages\django\core\management\__init__.py", line 377, in execute
    django.setup()
  File "C:\Users\zesha\AppData\Roaming\Python\Python39\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)

  File "C:\Users\zesha\AppData\Roaming\Python\Python39\site-packages\django\apps\registry.py", line 114, in populate
    app_config.import_models()
  File "C:\Users\zesha\AppData\Roaming\Python\Python39\site-packages\django\apps\config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\ProgramData\Miniconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\zesha\AppData\Roaming\Python\Python39\site-packages\django\db\utils.py", line 214, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "C:\Users\zesha\AppData\Roaming\Python\Python39\site-packages\django\db\utils.py", line 111, in load_backend
    return import_module('%s.base' % backend_name)
  File "C:\ProgramData\Miniconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\zesha\AppData\Roaming\Python\Python39\site-packages\django\db\backends\sqlite3\base.py", line 32, in <module>
    from .introspection import DatabaseIntrospection            # isort:skip
  File "C:\Users\zesha\AppData\Roaming\Python\Python39\site-packages\django\db\backends\sqlite3\introspection.py", line 4, in <module>
    import sqlparse
ModuleNotFoundError: No module named 'sqlparse'

I am getting the following error. I am not sure where should I install sqlparse

FlyingTeller
  • 17,638
  • 3
  • 38
  • 53
NobinPegasus
  • 545
  • 2
  • 16

1 Answers1

1

Since you also tried conda install, I am supsecting that you have anaconda or miniconda installed. pip and pip3 probably point to the python version managed by conda. However, your error message suggests that your script is being executed with a python version that is located at

C:\Users\zesha\AppData\Roaming\Python\Python39\

To install for that version of python specifically, you could try something like (might need to check that that is actual path to python.exe in that folder):

C:\Users\zesha\AppData\Roaming\Python\Python39\python.exe -m pip install sqlparse

Alternatively, run your script with the python that is managed by conda

FlyingTeller
  • 17,638
  • 3
  • 38
  • 53