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,520 points
2,316 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,840 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 13, 2019 in Python by Mark
4,703 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,460 points
4,976 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,460 points
7,543 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,840 points
2,494 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,840 points
1,577 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,840 points
8,606 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP