Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

legacy-cgi dependency required in python>=3.13 #124

Closed
mo-jfallon opened this issue Oct 18, 2024 · 3 comments
Closed

legacy-cgi dependency required in python>=3.13 #124

mo-jfallon opened this issue Oct 18, 2024 · 3 comments

Comments

@mo-jfallon
Copy link

What maintenance does this project need?

Issue:

An error was encountered running the cdsapi test code: https://cds.climate.copernicus.eu/how-to-api

(cdsapi) ᚌ username@hostname: Downloads $ python cdsapi_test.py 
Traceback (most recent call last):
  File "~/Downloads/cdsapi_test.py", line 3, in <module>
    client = cdsapi.Client()
  File "~/.conda/envs/cdsapi/lib/python3.13/site-packages/cdsapi/api.py", line 285, in __new__
    import cads_api_client.legacy_api_client
  File "~/.conda/envs/cdsapi/lib/python3.13/site-packages/cads_api_client/__init__.py", line 25, in <module>
    from .api_client import ApiClient
  File "~/.conda/envs/cdsapi/lib/python3.13/site-packages/cads_api_client/api_client.py", line 8, in <module>
    import multiurl.base
  File "~/.conda/envs/cdsapi/lib/python3.13/site-packages/multiurl/__init__.py", line 11, in <module>
    from .downloader import Downloader, download, robust
  File "~/.conda/envs/cdsapi/lib/python3.13/site-packages/multiurl/downloader.py", line 18, in <module>
    from .http import FullHTTPDownloader, PartHTTPDownloader, robust
  File "~/.conda/envs/cdsapi/lib/python3.13/site-packages/multiurl/http.py", line 10, in <module>
    import cgi
ModuleNotFoundError: No module named 'cgi'

cgi module removed from Python versions >= 3.13 (see documentation: https://docs.python.org/3.11/library/cgi.html )

Solution:

Install legacy-cgi (https://pypi.org/project/legacy-cgi). This resolved the error for me, and I was able to download data. Perhaps this should be treated as a new required dependency going forwards)?

(On a separate note, I also encountered an issue with now deprecated pkg_resource, and this is resolved in the suggested pull request #74. Mentioning here as both issues occur because of upgrade to python 3.13.)

Organisation

Met Office

@akrherz
Copy link

akrherz commented Oct 18, 2024

c/f ecmwf/multiurl#14

@veenstrajelmer
Copy link

@mo-jfallon this should indeed be resolved with the PR linked to ecmwf/multiurl#14. The latest release of multiurl should therefore support python 3.13. Does this indeed resolve your issue? In that case this issue can be closed.

@mo-jfallon
Copy link
Author

Yes thanks @veenstrajelmer , I will mark this issue as closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants