相关文章推荐

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

Hello there, I was used the following script to install Basemap in Google Colab.

!apt-get install libgeos-3.5.0
!apt-get install libgeos-dev
!pip install https://github.com/matplotlib/basemap/archive/master.zip

But this script didn't work anymore because of some update in the github repo. Can anyone help me how to install basemap right now (after the update)? Here is the error messages:

ERROR: HTTP error 404 while getting https://github.com/matplotlib/basemap/archive/basemap-master.zip
ERROR: Could not install requirement https://github.com/matplotlib/basemap/archive/basemap-master.zip because of HTTP error 404 Client Error: Not Found for url: https://codeload.github.com/matplotlib/basemap/zip/basemap-master for URL https://github.com/matplotlib/basemap/archive/basemap-master.zip

Thanks in advance.

@titan-khan Thanks for the feedback and sorry for the inconvenience!

I was doing a big refactoring of the basemap project in order to make the wheel packaging easier. Now basemap is split in three parts ( basemap , basemap-data , basemap-data-hires ), these three packages are now under the packages folder and there is no setup.py file at the top-level folder anymore. That is probably why it is failing to you.

Could you give a try to the recent wheels that I uploaded to PyPI? We have at the moment the beta release 1.3.0b1 there (with libgeos already bundled so no need of compiling anything by yourself):

!pip install "basemap == 1.3.0b1" "basemap-data == 1.3.0b1"

If you need the high-resolution data files, just add "basemap-data-hires == 1.3.0b1" to the former pip call. At the moment you need to specify both basemap and basemap-data as basemap depends on basemap-data and pip cannot find it because we only have beta releases at the moment. Once we have the final version 1.3.0, you will be able to do:

!pip install basemap

and then basemap-data will get downloaded automatically too.

Maybe someone is making changes again?

Yesterday I was working a lot with basemap. Today I got an error 'no module named mpl_toolkits.basemap'

Anyone knows what's going on with this libraries and toolkits?

Thanks!

[EDIT]
It is now working again. It was about 50 minutes not working for me.
I don't know why. It simply loaded again after several trials.

Hi @FenixDigitalB . How did you try to install basemap in Google Colab? I have just tried it out and it works:

!pip install basemap

Output:

Collecting basemap
  Downloading basemap-1.3.1-cp37-cp37m-manylinux1_x86_64.whl (862 kB)
     |████████████████████████████████| 862 kB 5.0 MB/s 
Collecting pyshp<2.2,>=1.2
  Downloading pyshp-2.1.3.tar.gz (219 kB)
     |████████████████████████████████| 219 kB 50.1 MB/s 
Requirement already satisfied: six<1.16,>=1.10 in /usr/local/lib/python3.7/dist-packages (from basemap) (1.15.0)
Collecting pyproj<3.4.0,>=1.9.3
  Downloading pyproj-3.2.1-cp37-cp37m-manylinux2010_x86_64.whl (6.3 MB)
     |████████████████████████████████| 6.3 MB 51.6 MB/s 
Requirement already satisfied: matplotlib<3.6,>=1.5 in /usr/local/lib/python3.7/dist-packages (from basemap) (3.2.2)
Requirement already satisfied: numpy<1.22,>=1.19 in /usr/local/lib/python3.7/dist-packages (from basemap) (1.19.5)
Collecting basemap-data<1.4,>=1.3
  Downloading basemap_data-1.3.0-py2.py3-none-any.whl (30.5 MB)
     |████████████████████████████████| 30.5 MB 55.8 MB/s 
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib<3.6,>=1.5->basemap) (3.0.6)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib<3.6,>=1.5->basemap) (0.11.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib<3.6,>=1.5->basemap) (1.3.2)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib<3.6,>=1.5->basemap) (2.8.2)
Requirement already satisfied: certifi in /usr/local/lib/python3.7/dist-packages (from pyproj<3.4.0,>=1.9.3->basemap) (2021.10.8)
Building wheels for collected packages: pyshp
  Building wheel for pyshp (setup.py) ... done
  Created wheel for pyshp: filename=pyshp-2.1.3-py3-none-any.whl size=37324 sha256=7b9a5e94151002117c08fe6f93fb17c94ca6370c93fc1eaced83dab23011ff2a
  Stored in directory: /root/.cache/pip/wheels/43/f8/87/53c8cd41545ba20e536ea29a8fcb5431b5f477ca50d5dffbbe
Successfully built pyshp
Installing collected packages: pyshp, pyproj, basemap-data, basemap
Successfully installed basemap-1.3.1 basemap-data-1.3.0 pyproj-3.2.1 pyshp-2.1.3
WARNING: The following packages were previously imported in this runtime:
  [mpl_toolkits]
You must restart the runtime in order to use newly installed versions.

Then I restart the colab runtime, and this:

from mpl_toolkits import basemap
print(basemap.__version__)

returns:

1.3.1

as expected.

 
推荐文章