dash-uploader icon indicating copy to clipboard operation
dash-uploader copied to clipboard

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

Open meghna200 opened this issue 2 years ago • 14 comments

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?

meghna200 avatar Dec 09 '22 07:12 meghna200

I have this issue also.

python==3.9.13
dash==2.7.0
dash-bootstrap-components==1.1.0
dash-core-components==2.0.0
dash-html-components==2.0.0
dash-renderer==1.9.1
dash-table==5.0.0
dash-uploader==0.7.0a1

wayneconnolly avatar Dec 11 '22 04:12 wayneconnolly

I solved this via a hotfix.

I commented out lines 20 and 21 of:

https://github.com/np-8/dash-uploader/blob/dev/dash_uploader/utils.py

wayneconnolly avatar Dec 11 '22 05:12 wayneconnolly

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

meghna200 avatar Dec 11 '22 07:12 meghna200

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

valentindusollier avatar Dec 14 '22 09:12 valentindusollier

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

wayneconnolly avatar Dec 19 '22 01:12 wayneconnolly

Thanks to @Sisyphus235 's contribution, this issue will be fixed in the next version release.

Ref https://github.com/fohrloop/dash-uploader/pull/128

mapix avatar Nov 27 '23 06:11 mapix

Hi folks @mapix , @fohrloop , do you have a planned release date for the next version?

I'm asking because fixing packages==21.0.0 is preventing the installation of other important packages...

GitHunter0 avatar Jun 08 '24 06:06 GitHunter0

@GitHunter0 I'm not actively working on this project and not planning to use time on this in the near future. This project is looking for maintainers so if anyone is able to make fixes, please raise your hand and I'll add you the required privileges to make merges. I'm the only one with PyPI upload rights, but I'm able to help if there's a release to be made. In the long run, also those rights should be transferred / shared but that requires a longer time effort or trust gained otherwise.

fohrloop avatar Jun 11 '24 11:06 fohrloop

@mapix what do you think, are you able to use some time for a new release? or others on this thread?

fohrloop avatar Jun 11 '24 11:06 fohrloop

Thank you for the feedback, @fohrloop . That would be really great if @mapix could update this package. It is an important component, so much better than the native Dash uploader...

GitHunter0 avatar Jun 11 '24 12:06 GitHunter0

@fohrloop Yes , Could you please help add the release permissions on PyPI? I am currently unable to publish. mapix or [email protected] on pypi

mapix avatar Jun 11 '24 12:06 mapix

@mapix I appreciate that you would like to volunteer here and help. What I meant by "being able to use some time for a new release" was the ability to work on the project so there's something to be released :) I can still for some time keep the responsibility to upload a new packaged release to PyPI. Quoting my message above:

In the long run, also those rights should be transferred / shared but that requires a longer time effort or trust gained otherwise.

And the reason for this is that there have been some supply chain attacks in the open source projects in the past, so I think it's good practice to share the publishing rights sparingly. I hope you understand that.

Do you think there are changes in the dash-uploader repo already which should be packaged and published..?

fohrloop avatar Jun 22 '24 09:06 fohrloop

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

mapix avatar Jun 22 '24 13:06 mapix

I also encountered this issue. It seems fixed by installing packaging==21.3.0 as others suggested, but looking forward to the official fix.

gcroci2 avatar Jul 08 '24 17:07 gcroci2