jjrob / MGET

Marine Geospatial Ecology Tools
Other
0 stars 0 forks source link

Copernicus (CMEMS) tools and functions fail with RuntimeError: Failed to query the Copernicus Marine Service catalogue for dataset ID "XXXXX". The copernicusmarine.describe() function failed with RuntimeError: no running event loop. #1

Closed jjrob closed 1 week ago

jjrob commented 1 week ago

This problem occurs because of a change to the Python aiohttp package that affected the copernicusmarine package. See aio-libs/aiohttp#8555 for detail of the change to aiohttp.

The problem occurs when the installed version of aiohttp is 3.10.0 or newer but the installed version of copernicusmarine 1.3.0 or older. This scenario tends to happen for MGET users who have ArcGIS Pro 3.2.x, due to the following situation:

jjrob commented 1 week ago

We can't solve this from within MGET itself. Assuming you are stuck with copernicusmarine 1.3.0 because of ArcGIS pinning numpy, or some similar reason, the solution we recommend is to downgrade aiohttp to version 3.9.5.

First confirm that conflicting versions of the packages are installed. From the ArcGIS Python Command Prompt, run:

conda list "aiohttp|copernicusmarine"

You should see output similar to:

# packages in environment at C:\Users\Jason\AppData\Local\ESRI\conda\envs\arcgispro-py3-mget:
#
# Name                    Version                   Build  Channel
aiohttp                   3.10.5                   pypi_0    pypi
copernicusmarine          1.3.0                    pypi_0    pypi

If you have aiohttp >= 3.10.0 and copernicusmarine <= 1.3.0, then you have the conflicting packages. The solution is to downgrade aiohttp to version 3.9.5. From the same Python Command Prompt, run:

conda install --no-deps conda-forge::aiohttp==3.9.5

The --no-deps flag should prevent conda from updating any other packages. Be warned that if any other packages require 3.10 or later, they may be broken.

Also, the conda dependency solver that came with ArcGIS Pro 3.2.x is very slow. If you find that this command seems to run forever with the message Solving environment, you can try running the command with micromamba instead of conda.

jjrob commented 1 week ago

Closing this as external.