使用pip安装Cartopy库时,出现报错:Getting requirements to build wheel did not run successfully.

原文地址:https://blog.csdn.net/qq_37598092/article/details/123652853

 

使用pip安装Cartopy库时,出现报错:

1 Getting requirements to build wheel did not run successfully.
2 Getting requirements to build wheel did not run successfully.
3 │ exit code: 1
4 ╰─> [3 lines of output]
5 setup.py:117: UserWarning: Unable to determine GEOS version. Ensure you have 3.7.2 or later installed, or installation may fail.
6 warnings.warn(
7 Proj 8.0.0 must be installed.

 

输入: 

1 pip install Cartopy

 

报错:

 1 D:\app\python\python310\Scripts>pip install Cartopy
 2 WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
 3 WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
 4 Collecting Cartopy
 5   Using cached Cartopy-0.20.2.tar.gz (10.8 MB)
 6   Installing build dependencies ... done
 7   Getting requirements to build wheel ... error
 8   error: subprocess-exited-with-error
 9 
10   × Getting requirements to build wheel did not run successfully.
11   │ exit code: 1
12   ╰─> [3 lines of output]
13       setup.py:117: UserWarning: Unable to determine GEOS version. Ensure you have 3.7.2 or later installed, or installation may fail.
14         warnings.warn(
15       Proj 8.0.0 must be installed.
16       [end of output]
17 
18   note: This error originates from a subprocess, and is likely not a problem with pip.
19 error: subprocess-exited-with-error
20 
21 × Getting requirements to build wheel did not run successfully.
22 │ exit code: 1
23 ╰─> See above for output.
24 
25 note: This error originates from a subprocess, and is likely not a problem with pip.
26 WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
27 WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)

 

于是,尝试在https://www.lfd.uci.edu/~gohlke/pythonlibs/#numba下载并安装whl文件:
输入:

1 pip install Cartopy-0.20.2-pp38-pypy38_pp73-win_amd64.whl

 

出现成功安装提示:

 1 D:\app\python\python310\Scripts>pip install Cartopy-0.20.2-cp310-cp310-win_amd64.whl
 2 WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
 3 WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
 4 Processing d:\app\python\python310\scripts\cartopy-0.20.2-cp310-cp310-win_amd64.whl
 5 Collecting shapely>=1.6.4
 6   Downloading Shapely-1.8.1.post1-cp310-cp310-win_amd64.whl (1.3 MB)
 7      ---------------------------------------- 1.3/1.3 MB 2.2 MB/s eta 0:00:00
 8 Requirement already satisfied: pyshp>=2.1 in d:\app\python\python310\lib\site-packages (from Cartopy==0.20.2) (2.2.0)
 9 Requirement already satisfied: numpy>=1.18 in d:\app\python\python310\lib\site-packages (from Cartopy==0.20.2) (1.22.0)
10 Requirement already satisfied: matplotlib>=3.1 in d:\app\python\python310\lib\site-packages (from Cartopy==0.20.2) (3.5.1)
11 Requirement already satisfied: pyproj>=3.0.0 in d:\app\python\python310\lib\site-packages (from Cartopy==0.20.2) (3.3.0)
12 Requirement already satisfied: kiwisolver>=1.0.1 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (1.3.2)
13 Requirement already satisfied: cycler>=0.10 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (0.11.0)
14 Requirement already satisfied: packaging>=20.0 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (21.3)
15 Requirement already satisfied: pillow>=6.2.0 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (9.0.0)
16 Requirement already satisfied: python-dateutil>=2.7 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (2.8.2)
17 Requirement already satisfied: fonttools>=4.22.0 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (4.28.5)
18 Requirement already satisfied: pyparsing>=2.2.1 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (3.0.6)
19 Requirement already satisfied: certifi in d:\app\python\python310\lib\site-packages (from pyproj>=3.0.0->Cartopy==0.20.2) (2021.10.8)
20 Requirement already satisfied: six>=1.5 in d:\app\python\python310\lib\site-packages (from python-dateutil>=2.7->matplotlib>=3.1->Cartopy==0.20.2) (1.16.0)
21 WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
22 Installing collected packages: shapely, Cartopy
23 WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
24 WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
25 Successfully installed Cartopy-0.20.2 shapely-1.8.1.post1
26 WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
27 WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)

 

但是,在pycharm中导入cartopy模块时,出错:

1 ImportError: DLL load failed: 找不到指定的模块。

 

网上查找资料后,原因应该是cartopy模块的依赖库版本不对。

 

解决方案

cartopy包的依赖库有:pyproj,Pillow,pyshp,Shapely
需要将这几个库卸载后,使用whl重新安装。

1、卸载原有依赖库

1 pip uninstall Pillow

2 pip uninstall pyshp
 
3 pip uninstall Shapely
 
4 pip uninstall pyproj

 

2、在https://www.lfd.uci.edu/~gohlke/pythonlibs/#numba中查找并下载这几个库和你电脑的对应版本
此处下载的是:

  • Pillow-9.0.1-cp310-cp310-win_amd64.whl
  • pyproj-3.3.0-cp310-cp310-win_amd64.whl
  • pyshp-2.2.0-py3-none-any.whl
  • Shapely-1.8.1.post1-cp310-cp310-win_amd64.whl

 

3、安装库 

1 pip install --user Shapely-1.8.1.post1-cp310-cp310-win_amd64.whl
2 
3 pip install --user pyproj-3.3.0-cp310-cp310-win_amd64.whl
4 
5 pip install --user pyshp-2.2.0-py3-none-any.whl
6 
7 pip install --user  Pillow-9.0.1-cp310-cp310-win_amd64.whl

 

安装完成后,在pycharm中导入cartopy模块时不再报错,成功。

 

问题解决。


————————————————
版权声明:本文为CSDN博主「LorettaWang」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_37598092/article/details/123652853

 

posted @ 2022-04-12 18:36  EROEG  阅读(5263)  评论(0编辑  收藏  举报