Trying to install cartopy, but keep getting this: Getting requirements to build wheel ... error error: subprocess-exited-with-error

Viewed 1527

I tried doing "conda install -c conda-forge cartopy in an anaconda prompt, but that does not do anything even though it says done.

In my command prompt, I try pip install cartopy and the message I will put below keeps popping up. I have downloaded one of the cartopy extension packages on uci.edu as well, but that does not seem to work. Also, I have wheel package installed and as far as I have seen all of the dependencies as well, but I could be wrong. Any suggestions would help, thank you.

Error message:

Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      setup.py:117: UserWarning: Unable to determine GEOS version. Ensure you have 3.7.2 or later installed, or installation may fail.
        warnings.warn(
      setup.py:166: UserWarning: Unable to determine Proj version. Ensure you have 8.0.0 or later installed, or installation may fail.
        warnings.warn(
      Proj version 0.0.0 is installed, but cartopy requires at least version 8.0.0.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
2 Answers

You can resolve this error by downloading the binary for the cartopy library from the link given below

https://www.lfd.uci.edu/~gohlke/pythonlibs/#cartopy

Follow the below steps

(1) Download the appropriate binary for your python version.

(2) After that, open the file explorer and go to downloads.

(3) Do Shift + Right click on mouse and select the option "open a powershell window here".

(4) Once the powershell window is open type the following "pip install " and then do either of the following

(a) Type out the entire name of the wheel file you downloaded.

(b) Type the first 3-4 letters, click Tab and use the up and down arrow button to navigate to correct wheel file you wish to use.

(5) Once the statement "pip install [wheel file name here]" is done, press enter.

(6) If the downloaded wheel file is not correct for your version of python, download the next wheel file from the link given above.

Follow the above steps till you successfully install the Cartopy library.

Like others have said, you need proj installed before installing cartopy.

If you create a conda environment.yml file like this...

name: my_env
channels:
  - conda-forge
dependencies:
  - python>=3.10
  - cartopy
  - proj # Required to build cartopy (can't be installed with pip)

then you can create that conda environment with this...

conda env create -f environment.yml
Related