question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: module 'packaging.version' has no attribute 'LegacyVersion'

See original GitHub issue

I have hosted my dash app on AWS using a DockerFile. While trying to deploy the app, I am getting an error which I am guessing is with the dash_uploader component

the error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
    mod = importlib.import_module(module)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/docker-test/src/main.py", line 41, in <module>
    from modules.pydash_components.pages.main_pages.data_page.data_load import data_load_layout
  File "/docker-test/src/modules/pydash_components/pages/main_pages/data_page/data_load.py", line 169, in <module>
    def callback_on_completion(status: du.UploadStatus):
  File "/usr/local/lib/python3.9/site-packages/dash_uploader/callbacks.py", line 105, in add_callback
    if dash_version_is_at_least("1.12"):
  File "/usr/local/lib/python3.9/site-packages/dash_uploader/utils.py", line 20, in dash_version_is_at_least
    if isinstance(dash_version, version.LegacyVersion):
AttributeError: module 'packaging.version' has no attribute 'LegacyVersion'

I am using the following dash versions:

python==3.9.12
dash==2.7.0
dash_bootstrap_components==1.0.3
dash_extensions==0.1.7
dash_table==5.0.0
dash_uploader==0.7.0a1

any idea how I can resolve this without deprecating any packages?

Issue Analytics

  • State:open
  • Created 9 months ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

2reactions
valentindusolliercommented, Dec 14, 2022

Yes indeed. In the last version of packaging (version 22.0), LegacyVersion was removed see changelog. So the temporary solution of @meghna200 is the right way to handle it now. Note that the most recent version except 22.0 is 21.3

1reaction
wayneconnollycommented, Dec 19, 2022

packages==21.0.0

ERROR: Could not find a version that satisfies the requirement packages==21.0.0 (from versions: 0.1.0)

There is only 0.1.0 https://pypi.org/project/packages/#history

It’s actually packaging==21.3.0. That’s the latest version to work as stated by @valentindusollier

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error while using kats module packaging version has no ...
Reason: The new version of the package packaging (22.0) removed the attribute LegacyVersion recently (2022-12-07). Found inspiration on this ...
Read more >
AttributeError: module 'packaging.version' has no attribute ...
Upgrading the package from 19.1 to 20.4 seemed to resolve this. Do we need to specify a minimum version for the packaging dependency...
Read more >
Python packaging.version.LegacyVersion() Examples
This page shows Python examples of packaging.version. ... Numpy < 1.11.2) """ if "numpy.distutils" in sys.modules: import numpy as np if LegacyVersion(np.
Read more >
packaging - PyPI
Core utilities for Python packages. ... The packaging project includes the following: version handling, specifiers, markers, requirements, tags, utilities.
Read more >
How to use the packaging.version.LegacyVersion function in ...
To help you get started, we've selected a few packaging.version.LegacyVersion examples, based on popular ways it is used in public projects.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found