Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get "ImportError: cannot import name find_spec" when I start a new Django project?

Tags:

I'm learning Python in tandem with Django. I initially installed Python 3 on my machine (Debian Wheezy), 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/rialaado/Projects/webenv/bin/django-admin.py", line 2, in <module>     from django.core import management   File "/home/rialaado/Projects/webenv/lib/python3.2/site-packages/django/core/management/__init__.py", line 10, in <module>     from django.apps import apps   File "/home/rialaado/Projects/webenv/lib/python3.2/site-packages/django/apps/__init__.py", line 1, in <module>     from .config import AppConfig   File "/home/rialaado/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/rialaado/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 

A quick google turned up no results that would help me.

What should I do?

like image 998
Axolotl Avatar asked Jan 05 '16 23:01

Axolotl


1 Answers

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

Try upgrading to 3.4 or later.

like image 153
KarthiG Avatar answered Sep 23 '22 00:09

KarthiG