Opened 2 years ago

Closed 2 years ago

#33845 closed Uncategorized (invalid)

Error running "Django-polls" package in my project

Reported by: Temidayo Owned by: nobody
Component: Packaging Version: 4.0
Severity: Normal Keywords: django-package, django-tutorial
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

In line with instruction in this tutorial, https://docs.djangoproject.com/en/4.0/intro/reusable-apps/, I removed my polls app from the polls project, then built the polls app package.

After several tries, I was able to successfully install the polls package. Here is quote from my command line

PS C:\Users\MY PC\desktop\django_exp\src\django_novice> pip install --user django-polls/dist/django-polls-0.1.tar.gz
Processing c:\users\my pc\desktop\django_exp\src\django_novice\django-polls\dist\django-polls-0.1.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: Django>=4.0 in c:\users\my pc\anaconda3\lib\site-packages (from polls==0.0.0) (4.0.5)
Requirement already satisfied: asgiref<4,>=3.4.1 in c:\users\my pc\anaconda3\lib\site-packages (from Django>=4.0->polls==0.0.0) (3.5.2)
Requirement already satisfied: backports.zoneinfo in c:\users\my pc\anaconda3\lib\site-packages (from Django>=4.0->polls==0.0.0) (0.2.1)
Requirement already satisfied: sqlparse>=0.2.2 in c:\users\my pc\anaconda3\lib\site-packages (from Django>=4.0->polls==0.0.0) (0.4.2)
Requirement already satisfied: tzdata in c:\users\my pc\anaconda3\lib\site-packages (from Django>=4.0->polls==0.0.0) (2022.1)
DEPRECATION: Source distribution is being reinstalled despite an installed package having the same name and version as the installed package. pip 21.1 will remove support for this functionality. A possible replacement is use --force-reinstall. You can find discussion regarding this at https://github.com/pypa/pip/issues/8711.
Building wheels for collected packages: polls
  Building wheel for polls (PEP 517) ... done
  Created wheel for polls: filename=polls-0.0.0-py3-none-any.whl size=8708 sha256=76b4882f158eabbe3ca27b5fd6a286c3fb5913debab67c2e2aa8968477869fd2
  Stored in directory: c:\users\my pc\appdata\local\pip\cache\wheels\1e\27\af\921b67e711b16738c014d72bd9a7a69e2d516f837fb1efe4fe
Successfully built polls
Installing collected packages: polls
  Attempting uninstall: polls
    Found existing installation: polls 0.0.0
    Uninstalling polls-0.0.0:
      Successfully uninstalled polls-0.0.0
Successfully installed polls-0.0.0`

Now, after this installation, I tried the `python manage.py runserver` command to bring back up the development server, but unluckily for me, I got an error.

`Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "c:\users\my pc\anaconda3\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "c:\users\my pc\anaconda3\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
    autoreload.raise_last_exception()
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\core\management\__init__.py", line 398, in execute
    autoreload.check_errors(django.setup)()
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\apps\registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\apps\config.py", line 213, in create
    mod = import_module(mod_path)
  File "c:\users\my pc\anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'polls'
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\core\management\__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\core\management\base.py", line 414, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\core\management\commands\runserver.py", line 74, in execute
    super().execute(*args, **options)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\core\management\base.py", line 460, in execute
    output = self.handle(*args, **options)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\core\management\commands\runserver.py", line 111, in handle
    self.run(**options)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\core\management\commands\runserver.py", line 118, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\utils\autoreload.py", line 680, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\utils\autoreload.py", line 661, in start_django
    reloader.run(django_main_thread)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\utils\autoreload.py", line 344, in run
    self.run_loop()
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\utils\autoreload.py", line 350, in run_loop
    next(ticker)
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\utils\autoreload.py", line 390, in tick
    for filepath, mtime in self.snapshot_files():
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\utils\autoreload.py", line 411, in snapshot_files
    for file in self.watched_files():
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\utils\autoreload.py", line 304, in watched_files
    yield from iter_all_python_module_files()
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\utils\autoreload.py", line 120, in iter_all_python_module_files
    return iter_modules_and_files(modules, frozenset(_error_files))
  File "C:\Users\MY PC\desktop\django_exp\lib\site-packages\django\utils\autoreload.py", line 160, in iter_modules_and_files
    if not path.exists():
  File "c:\users\my pc\anaconda3\lib\pathlib.py", line 1400, in exists
    self.stat()
  File "c:\users\my pc\anaconda3\lib\pathlib.py", line 1197, in stat
    return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'`

There was a ModuleNotFoundError: No module named 'polls'

Can anyone help with advise of how to solve this?

Change History (1)

comment:1 by Tim Graham, 2 years ago

Description: modified (diff)
Resolution: invalid
Status: newclosed

See TicketClosingReasons/UseSupportChannels for places to get help. This tracker is for confirmed bugs. Thanks.

Note: See TracTickets for help on using tickets.
Back to Top