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

ImportError DLL load fails for importing cartopy.crs #2019

Closed
CHC278Cao opened this issue Mar 24, 2022 · 5 comments
Closed

ImportError DLL load fails for importing cartopy.crs #2019

CHC278Cao opened this issue Mar 24, 2022 · 5 comments
Milestone

Comments

@CHC278Cao
Copy link

Description

Hello! I get a ImportError for importing Cartopy in python 3.7. I installed the Cartopy 0.20 and all dependency with wheel file, and I tried to reinstall the Cartopy, the ImportError is still here.

Code to reproduce

import cartopy.crs as ccrs

Traceback

Traceback (most recent call last):
  File "F:/workspace/maps/src/test.py", line 11, in <module>
    import cartopy.crs as ccrs
  File "F:\workspace\maps\env\lib\site-packages\cartopy\__init__.py", line 110, in <module>
    import cartopy.crs
  File "F:\workspace\maps\env\lib\site-packages\cartopy\crs.py", line 27, in <module>
    import cartopy.trace
ImportError: DLL load failed: The specified module could not be found.
Full environment definition I download the Cartopy and its dependency from https://www.lfd.uci.edu/~gohlke/pythonlibs/, and the files I get as follows:
- Cartopy-0.20.2-cp37-cp37m-win_amd64.whl - GDAL-3.4.2-cp37-cp37m-win_amd64.whl - matplotlib-3.5.1-cp37-cp37m-win_amd64.whl - numpy-1.21.5+mkl-cp37-cp37m-win_amd64.whl - Pillow-8.4.0-cp37-cp37m-win_amd64.whl - pyproj-3.2.1-cp37-cp37m-win_amd64.whl - pyshp-2.2.0-py3-none-any.whl - Shapely-1.8.1.post1-cp37-cp37m-win_amd64.whl

Operating system

Windows 10 64 bit, Python 3.7.9

Cartopy version

Cartopy - 0.20.2

conda list

pip list

Cartopy==0.20.2
GDAL==3.4.2
matplotlib==3.5.1
Pillow==8.4.0
pyproj==3.2.1
pyshp==2.2.0
Shapely==1.8.1.post1
six==1.16.0

@dopplershift
Copy link
Contributor

Try to reinstall shapely from source instead of the wheel file: pip install --no-binary shapely.

@freol35241
Copy link

Hi, I have been running in to this problem lately as well and it seems related to the shapely version?

with:

Shapely==1.8.1.post1  --> DLL import error
Shapely==1.8.1        --> DLL import error
Shapely==1.8.0        --> OK

So, as a workaround for now, pin your shapely version to 1.8.0.

@firobeid
Copy link

Hell @dopplershift! Is there a py3-none-any.whl wheel for installing cartopy or a wasm version wheel?

@dopplershift
Copy link
Contributor

@firobeid Currently Cartopy doesn't release wheels (#1174) due to challenges maintaining build compatibility with Shapely. Even if we did, they wouldn't be py3-none-any due to the fact that Cartopy currently needs to build some compiled extension modules (#2080 might help here).

For Wasm, building in Pyodide has been on my list, but I haven't gotten around to it.

@greglucas
Copy link
Contributor

We have just released v0.22 which should help with the compatibility between packages and installation much easier. Please open a new issue if you are still having problems.

@QuLogic QuLogic added this to the 0.22 milestone Aug 7, 2023
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

6 participants