2

I'm a little bit baffled by this error I'm getting when I try to runserver or syncdb - the server was running just fine the other night when I last logged on, so I have no idea why all of a sudden it's not working. Google gave me the following page but it doesn't really address my issue.

Let me know if you need more if the console information below isn't enough. I really am not very efficient with django yet, complete beginner really, and I'm not sure why this isn't working.

Pythoness-410:auth gfleche$ python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/__init__.py", line 1, in <module>
    import collections
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/collections.py", line 8, in <module>
    from _collections import deque, defaultdict
ImportError: No module named _collections

Thank you so much and let me know.

7
  • 1
    stackoverflow.com/questions/18106790/… - looks like this case, _collections is a builtin module. What this means is that it has nothing to do with Django and everything to do with MacOSX package management & python installation Aug 7, 2013 at 15:24
  • 2
    Does import _collections work in a fresh python prompt? If not then your python got broken somehow.
    – Claudiu
    Aug 7, 2013 at 15:24
  • 1
    no, execute python, then in the python prompt type import _collections, with that space in between there... Aug 7, 2013 at 15:28
  • 1
    Might be the same issue as in this question.
    – knbk
    Aug 7, 2013 at 15:32
  • 1
    @AnttiHaapala thanks for bearing with me : I get this error: >>> import _collections Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named _collections
    – gersande
    Aug 7, 2013 at 15:36

2 Answers 2

2

Django is attempting to issue the following command (or some variant of it):

import collections

And is failing. This could be because your installation is missing components . You can verify it's not a django related issue by doing the following:

Pythoness-410:auth gfleche$ python
>>> import collections

If you get an error back, then it's likely to be an issue with your python installation - since collections has been around for some time, and is part of the standard install.

3
  • 1
    I get the following error: >>> import collections Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/collections.py", line 8, in <module> from _collections import deque, defaultdict ImportError: No module named _collections
    – gersande
    Aug 7, 2013 at 15:37
  • Everybody was very helpful and lovely. Turns out there is a huge problem with my entire Python installation and I'm going to have to reinstall my OS to get it to work properly, according to the googling I've done. You guys are brilliant.
    – gersande
    Aug 7, 2013 at 17:22
  • 1
    I personally found Python development on OS X a real pain, as well as on Windows. The happiest place I've found is Linux. I used to run OS X as my "base" OS and then run Ubuntu and Windows in VirtualBox VMs. Then I could cross-browser, cross-platform test from one machine. Linux is incredibly easy to configure for Python development. You might give it a try. Aug 7, 2013 at 17:58
0

Everybody was very helpful and lovely. Turns out there was some sort of issue with my entire Python install - I didn't end up reinstalling my entire OS, but only XCode, since it had been out of date since at least 2010, and this had caused a variety of other issues. Reinstalling XCode with CLI tools, installing Python 2.7, as well as reinstalling homebrew, pip and django solved my issue. Thanks very much everybody. I'm still uncertain what could have happened for my computer to make it work for almost a month and then all of a sudden crash. I'm going to keep looking for the answer why it stopped working in the first place, but I'm so happy I can finally get back to work and my django is back and running smoothly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.