ImportError cannot import name find spec when I start a new Django project

0 votes

I'm learning Python in tandem with Django. I initially installed Python 3 on my machine, but read about possible conflicts and removed it with some difficulty.

Now I'm using virtualenv and installed python3 within the env and Django using pip. Django and Python seem to have installed correctly:

# python -c "import django;  print(django.get_version())"
1.9.1
# python -V
Python 3.2.3`

but when I try to start a new Django project, I get the following:

# django-admin.py startproject mysite
Traceback (most recent call last):
  File "/home/niroj/Projects/webenv/bin/django-admin.py", line 2, in <module>
    from django.core import management
  File "/home/niroj/Projects/webenv/lib/python3.2/site-packages/django/core/management/__init__.py", line 10, in <module>
    from django.apps import apps
  File "/home/niroj/Projects/webenv/lib/python3.2/site-packages/django/apps/__init__.py", line 1, in <module>
    from .config import AppConfig
  File "/home/niroj/Projects/webenv/lib/python3.2/site-packages/django/apps/config.py", line 6, in <module>
    from django.utils.module_loading import module_has_submodule
  File "/home/niroj/Projects/webenv/lib/python3.2/site-packages/django/utils/module_loading.py", line 67, in <module>
    from importlib.util import find_spec as importlib_find
ImportError: cannot import name find_spec

What should I do?

Aug 5, 2020 in Python by kartik
• 37,530 points
841 views

1 answer to this question.

0 votes

Hello @kartik,

find_spec isn't available in Python 3.2.3; it was added in Python 3.4.

Try upgrading to 3.4 or later.

Hope it works!!
Thank YOU!!

answered Aug 5, 2020 by Niroj
• 82,820 points

Related Questions In Python

0 votes
1 answer

How to resolve ImportError: cannot import name 'add' in python ?

There's no module called "add" in random. ...READ MORE

answered Feb 12, 2019 in Python by Mark
2,956 views
0 votes
1 answer

ImportError: cannot import name 'main' in pip

Hi@akhtar, To avoid this error, you should upgrade ...READ MORE

answered Apr 15, 2020 in Python by MD
• 95,300 points
2,163 views
0 votes
1 answer

ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' (unknown location)

Hi@akhtar, I think there is a problem in ...READ MORE

answered Apr 22, 2020 in Python by MD
• 95,300 points
3,043 views
0 votes
1 answer

How can I get the domain name of my site within a Django template?

Hello kartik, The variation of the context processor ...READ MORE

answered Apr 23, 2020 in Python by Niroj
• 82,820 points
4,591 views
0 votes
1 answer

How to temporarily disable a foreign key constraint in MySQL?

Hello @kartik, To turn off foreign key constraint ...READ MORE

answered Jun 23, 2020 in Python by Niroj
• 82,820 points
926 views
0 votes
1 answer

How do I use Django templates without the rest of Django?

Hello @kartik, Let's say you have this important ...READ MORE

answered Jun 23, 2020 in Python by Niroj
• 82,820 points
418 views
0 votes
1 answer

ImportError: cannot import name 'render_to_response' from 'django.shortcuts'

Hello @kartik, The render_to_response shortcut was deprecated in Django 2.0, and ...READ MORE

answered Jul 2, 2020 in Python by Niroj
• 82,820 points
2,165 views