13

It is unclear to me how to install Matplotlib's Basemap on Windows. Maybe the question is straightforward, I need some help.

I followed this tutorial. As far as I understand, first, GEOS and PROJ4 should be installed, and lastly matplotlib-1.4.3.win-amd64-py2.7.exe should be executed.

I get stuck with GEOS. I downloaded source code of geos-3.5.0, "untarred" it, then I go to a Command Prompt, change directory to geos-3.5.0 and run this:

export d://test

but it does not work.

Leb
  • 15,483
  • 10
  • 56
  • 75
Klausos Klausos
  • 15,308
  • 51
  • 135
  • 217

4 Answers4

23

Use this download for basemap on Windows.

It worked for me:

pip install basemap-1.0.8-cp34-none-win_amd64.whl

Assuming you're in right directory of course.

Leb
  • 15,483
  • 10
  • 56
  • 75
  • 1
    You're welcome. It also got [Shapely](https://pypi.python.org/pypi/Shapely) if you need it. Very useful. – Leb Oct 08 '15 at 17:07
  • I know this is an old answer, but could you please elaborate on what you mean by "Assuming you're in right directory"? When I try to run the command, I get the error: `ERROR: basemap‑1.2.2‑cp38‑cp38‑win_amd64.whl is not a valid wheel filename.` – Qwethm Jan 26 '21 at 07:18
  • 2
    @Qwethm You need to run your command in the same folder as the basemap-1.0.8-cp34-none-win_amd64.whl file (i.e in your downloads folder). – bjornasm Feb 25 '21 at 00:54
3

This is the alternate solution that might useful for anaconda users

For only Anaconda Users, they can get it to install on the local machine through the following command:

conda install basemap

This will auto-install all required dependency packages.

Here also, Assuming that User are at the right directory to install any module.

1

I had the same issue as I pip installed and then conda installed and then had to do a clean install as dependencies were a mess.

At that time I solved my problem by using Google Colab and installing the following:

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

I would also recommend reading Importing-of-Basemap-in-Google-Colab as it helped with Colab installation.

Dharman
  • 30,962
  • 25
  • 85
  • 135
0

while importing like (from mpl_toolkits.basemap import Basemap) I was getting error.

For me This Worked Like charm:

pip install basemap

  • Worked for me when everything else didn't ! I'm not found of pip command but i couldn't manage to install basemap with conda. Thank you ! – Lalastro Jan 06 '23 at 15:35