0

Strange, this happened after i upgraded to 1.10.3 on Ubuntu 16, Anaconda Distribution. The old 0.9 worked fine for me. Reinstalled multiple times as well, no difference.

➜  django-admin startproject django_tutorial
Traceback (most recent call last):
  File "/storage/programfiles/anaconda3/bin/django-admin", line 11, in <module>
    sys.exit(execute_from_command_line())
  File "/storage/programfiles/anaconda3/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/storage/programfiles/anaconda3/lib/python3.5/site-packages/django/core/management/__init__.py", line 316, in execute
    settings.INSTALLED_APPS
  File "/storage/programfiles/anaconda3/lib/python3.5/site-packages/django/conf/__init__.py", line 53, in __getattr__
    self._setup(name)
  File "/storage/programfiles/anaconda3/lib/python3.5/site-packages/django/conf/__init__.py", line 41, in _setup
    self._wrapped = Settings(settings_module)
  File "/storage/programfiles/anaconda3/lib/python3.5/site-packages/django/conf/__init__.py", line 97, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/storage/programfiles/anaconda3/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'dash'

Can't find anything on google, anyone have any ideas? :)

EDIT:

Django-admin is installed at:

➜  ~ which django-admin
/storage/programfiles/anaconda3/bin/django-admin

Stuff I've tried so far:

1) Multiple pip uninstall Django and pip install Django

2) Verifying site-packages has Django uninstalled and reinstalling again

3) After uninstall, pip freeze | grep Django shows nothing.

4) pip install django-dash

Solves it, but now the error is ImportError: No module named 'dash.development_settings'

Strange:

python -m django --version 

throws the same ImportError: No module named 'dash.development_settings' but I can run python in a terminal and do

import django
django.get_version() 

and it works fine

Wboy
  • 2,452
  • 2
  • 24
  • 45
  • Try working in a [virtualenv](https://virtualenv.pypa.io/en/stable/), so you know if its a problem with your app or with your django installation – yuvi Nov 26 '16 at 11:44
  • The command was for starting a new project, not an existing app – Wboy Nov 26 '16 at 11:46
  • Doesn't matter. Create a virtual environment, and install a clean Django there, then try creating a project. If the problem persists, it isn't because of your upgrade. If it is the upgrade, then you can either work in the VE (which is better anyway) or manually remove all the Django library files and re-install – yuvi Nov 26 '16 at 11:56
  • I had the same error. I think it happens cause you didn't delete old version of django. try to remove it twice. then instal the version you need – Zagorodniy Olexiy Nov 26 '16 at 12:07
  • @ZagorodniyOlexiy How did you remove it? i tried pip uninstall twice and it shows no such package called django. installed again and it still doesnt work – Wboy Nov 26 '16 at 12:15
  • Go to the `site-packages` folder (you an see the path in the error above) and delete the folder Django manually, not through pip. – yuvi Nov 26 '16 at 12:19
  • try search django manually. maybe you have different versions of django for different version of python http://stackoverflow.com/q/20897851/4592608 – Zagorodniy Olexiy Nov 26 '16 at 12:20
  • Also, looks like you're using Anaconda, that's probably relevant, so add that info to your post (because Anaconda uses isolated environments and you might be mixing something up there) – yuvi Nov 26 '16 at 12:21
  • The site packages folder does not have django, but other stuff like pyinstaller has bits and pieces of django (i guess it comes with that library). The pip freeze | grep django method shows nothing too. – Wboy Nov 26 '16 at 14:42
  • Please show `requirements.txt` file – Tomasz Jakub Rup Nov 26 '16 at 16:04
  • Django is obviously installed incorrectly. That's the problem. Either use a virtual environment, or you need a clean install (which means you need to find where you django is installed, remove manually and re-install with pip) – yuvi Nov 30 '16 at 16:06
  • @yuvi I did that already. Clearly the clean uninstall isn't working – Wboy Dec 01 '16 at 01:41
  • Did you try working in a virtualenv? – yuvi Dec 01 '16 at 01:43
  • Again, `pip uninstall` is not enough. You can try `pip install Django --upgrade -f` which will forcibly re install django, but assuming your basic installation was screwed, using a virtualenv is the best possible course of action I can recommend – yuvi Dec 01 '16 at 01:47
  • @yuvi A virtualenv may solve the problem, but I want to know why its not working in a default installation. I've checked the site-packages directory after pip uninstall and verified theres nothing remaining of the Django package, and its still not working. What do you mean by "basic installation"? of what? – Wboy Dec 01 '16 at 06:01

2 Answers2

0

You don't have django-dash installed

pip install django-dash

Or remove dash and dash. related apps from INSTALLED_APPS

Tomasz Jakub Rup
  • 10,502
  • 7
  • 48
  • 49
  • Hey man, thanks for the reply! :) now it changes to ImportError: No module named 'dash.development_settings'. Was it always like this? I never had this difficulty starting a new project before. How would i remove from installed apps when i haven't initialized the app yet? – Wboy Nov 26 '16 at 14:55
  • in addition: python -m django --version throws the same error, but importing django within python and using get_version() works – Wboy Nov 26 '16 at 14:58
  • Are You sure You started new project? I don't think so. Please show Your **settings.py** file – Tomasz Jakub Rup Nov 26 '16 at 15:09
  • If you see my original post, the command i used was: django-admin startproject django_tutorial – Wboy Nov 26 '16 at 15:10
  • OK, but new django project **don't have** `dash` in `INSTALLED_APPS`. – Tomasz Jakub Rup Nov 26 '16 at 16:00
  • Don't ask me man, as i said, in django 0.9 this never happened. I never had to install django-dash either. and what do you mean requirements.txt? Of what? This is a new project – Wboy Nov 26 '16 at 16:13
0

I finally figured out what the hell was wrong.

my bashrc had export DJANGO_SETTINGS = dash.development_settings or something like that (deleted it already) and removing that line worked.

Wboy
  • 2,452
  • 2
  • 24
  • 45