dash-uploader: AttributeError: module 'packaging.version' has no attribute 'LegacyVersion'

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?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 34 (12 by maintainers)

Commits related to this issue

Most upvoted comments

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

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

@fohrloop Understood. I have gathered some necessary information. We can track it at https://github.com/fohrloop/dash-uploader/pull/135 .

I solved this issue by adding packages==21.0.0 in my requirements.txt file. the app seems to run without the issue showing up again

No problem. @GitHunter0 I just released the changes as version 0.7.0-a2. You may install it with the --pre flag from PyPI. Let me hear if it works for you. If so, I might as well publish it as the 0.7.0.

Sorry, I was only looking at the dev branch, where the LegacyVersion check was already fixed. It was removed in this pull request #128. I suppose, version 0.7.0a1 was created before the pull request was merged.

That’s great! I think since this is fixed in both, 0.6.x (stable) and 0.7.x (dev), this one can finally be closed. Thanks a lot for the help!