How to install Matplotlib's basemap?
Asked Answered
D

5

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.

Divulsion answered 8/10, 2015 at 15:37 Comment(2)
@Leb: I got errors. That's why I got stuck.Divulsion
You didn't list any, you said you're stuck. Have you tried using whl package?Cowcatcher
C
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.

Cowcatcher answered 8/10, 2015 at 15:53 Comment(3)
You're welcome. It also got Shapely if you need it. Very useful.Cowcatcher
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.Lonely
@Lonely 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).Economical
P
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.

Pentothal answered 28/7, 2020 at 14:16 Comment(0)
B
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.

Bloomery answered 2/4, 2021 at 15:58 Comment(0)
S
0

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

For me This Worked Like charm:

pip install basemap

Salty answered 18/2, 2022 at 13:34 Comment(2)
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 !Runnel
you could try to install using this command conda install -c conda-forge basemap, but it will take quite some times for the machine to find the compatible version that match your current system. or may be you could try to use mamba...a bit faster than condaSimonsimona
S
0

Currently there is fastest way to install basemap using mamba. Infact, you can install any library from mamba. first thing to do you must install mamba, with this command; conda install mamba -n base -c conda-forge, then you can proceed installing basemap using the command mamba install basemap. After completion the installation, please set your path environment as PROJ_LIB in user variable and set your packages proj-7.2.0 location.

Simonsimona answered 22/4 at 3:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.