Need help setting up my Django environment

102 views
Skip to first unread message

Brigid Sang

unread,
Feb 17, 2024, 7:39:27 AM2/17/24
to Django users
I'm encoutering the below error, how can I fix this

Traceback (most recent call last):
  File "/home/brigid/.local/bin/django-admin", line 8, in <module>
    sys.exit(execute_from_command_line())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brigid/.local/lib/python3.11/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/home/brigid/.local/lib/python3.11/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/brigid/.local/lib/python3.11/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/brigid/.local/lib/python3.11/site-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brigid/.local/lib/python3.11/site-packages/django/core/management/commands/startproject.py", line 20, in handle
    super().handle('project', project_name, target, **options)
  File "/home/brigid/.local/lib/python3.11/site-packages/django/core/management/templates.py", line 117, in handle
    django.setup()
  File "/home/brigid/.local/lib/python3.11/site-packages/django/__init__.py", line 16, in setup
    from django.urls import set_script_prefix
  File "/home/brigid/.local/lib/python3.11/site-packages/django/urls/__init__.py", line 1, in <module>
    from .base import (
  File "/home/brigid/.local/lib/python3.11/site-packages/django/urls/base.py", line 8, in <module>
    from .exceptions import NoReverseMatch, Resolver404
  File "/home/brigid/.local/lib/python3.11/site-packages/django/urls/exceptions.py", line 1, in <module>
    from django.http import Http404
  File "/home/brigid/.local/lib/python3.11/site-packages/django/http/__init__.py", line 5, in <module>
    from django.http.response import (
  File "/home/brigid/.local/lib/python3.11/site-packages/django/http/response.py", line 13, in <module>
    from django.core.serializers.json import DjangoJSONEncoder
  File "/home/brigid/.local/lib/python3.11/site-packages/django/core/serializers/__init__.py", line 23, in <module>
    from django.core.serializers.base import SerializerDoesNotExist
  File "/home/brigid/.local/lib/python3.11/site-packages/django/core/serializers/base.py", line 6, in <module>
    from django.db import models
  File "/home/brigid/.local/lib/python3.11/site-packages/django/db/models/__init__.py", line 3, in <module>
    from django.db.models.aggregates import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brigid/.local/lib/python3.11/site-packages/django/db/models/aggregates.py", line 5, in <module>
    from django.db.models.expressions import Case, Func, Star, When
  File "/home/brigid/.local/lib/python3.11/site-packages/django/db/models/expressions.py", line 486, in <module>
    class TemporalSubtraction(CombinedExpression):
  File "/home/brigid/.local/lib/python3.11/site-packages/django/db/models/expressions.py", line 487, in TemporalSubtraction
    output_field = fields.DurationField()
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brigid/.local/lib/python3.11/site-packages/django/db/models/fields/__init__.py", line 155, in __init__
    if isinstance(choices, collections.Iterator):
                           ^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Iterator'

Mordecai Etukudo

unread,
Feb 17, 2024, 7:46:57 AM2/17/24
to django...@googlegroups.com
Comment you model. Py and the run if you still have the issue not this is to fine how where the issue if from 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ce94bd02-d38d-464d-9d06-2fbd3d5e7340n%40googlegroups.com.

Ryan Nowakowski

unread,
Feb 17, 2024, 3:32:32 PM2/17/24
to django...@googlegroups.com, Brigid Sang
Your Python version is likely too new for your version of Django.

kge...@gmail.com

unread,
Feb 18, 2024, 11:48:39 AM2/18/24
to Django users

Supports what Mordecai Etukudo said about version incompatability.

Type "help", "copyright", "credits" or "license" for more information. 
>>> import collections 
>>> collections.Iterator 
<stdin>:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working 
<class 'collections.abc.Iterator'>

How mature is your project? Changing python (or django) versions isnt always trivial but I suspect your project is fairly new though and you may want to consider using the latest of each.

kge...@gmail.com

unread,
Feb 18, 2024, 11:53:28 AM2/18/24
to Django users
**What Ryan said about incompatibility

If you want to pick a particular version of python (say, 3.12) when you create an env use:

conda create -n myEnv python==3.12

Reply all
Reply to author
Forward
0 new messages