0

I want to plot some GPS-data using python 2.7 using matplotlibs basemap.

I download the binary windows installer and it executes and run without any problems. However, when I try to import and run in python I get:

from mpl_toolkits.basemap import basemap
ImportError: No module named basemap

I tried the

python setup.py 

and

pip install basemap-1.0.8-cp27-none-win_amd64

in prompt which seems to be succesful. GEOS, which is a dependency should be involved in the Basemap installer but I installed OSGeo4w64 separately to make sure geos_c and init is in place.

I hope someone can help me out. This feels like it is well above my level.

I have ofcourse looked through other threads on this page, but none of them seem to offer a solution.

Best regards

Mathias
  • 578
  • 2
  • 8
  • 15

1 Answers1

-1

Instead of this:

from mpl_toolkits.basemap import basemap

do this:

from mpl_toolkits.basemap import Basemap

Check this as well.

Qriss
  • 68
  • 8
  • Check Path_to_Python/Lib/site-packages/mpl_toolkits\basemap. Have your more than one Pyton installation running? Are u using an IDE? Is it configured well? Can you post the error code with the capital B? I tested it and it seems to be the problem. – Qriss Apr 30 '15 at 09:06
  • I have only Python 2.7 - At the moment the error is : Traceback (most recent call last): File "C:\Users\Mat\Desktop\mpltoolkits.py", line 4, in from mpl_toolkits.basemap import Basemap File "C:\Python27\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 30, in from mpl_toolkits.basemap import pyproj File "C:\Python27\lib\site-packages\mpl_toolkits\basemap\pyproj.py", line 50, in from mpl_toolkits.basemap import _proj ImportError: cannot import name _proj [Finished in 0.5s] – Mathias Apr 30 '15 at 16:24
  • There is a problem with your pyproj installation. Check if you have installed pyproj, you PATH is set correctly. You problem importing Basemap is solved anyway. – Qriss Apr 30 '15 at 20:00
  • I did a succesful pip install pyproj. But Sublime Text 3 (only editor) returns same error. – Mathias Apr 30 '15 at 20:10
  • I agree that it is probably my Pyproj that is messing with me, but when I run a 'python -c "import pyproj; pyproj.test()"' it returns succesfully, as did the pip install. I cant install via the Github master with a 'python setup.py install'. It returnds that it cannot find 'vcvarsal.bat'. Hope you have more patience, your help is most appreciated. – Mathias May 01 '15 at 07:11
  • I know this issue: Set your PATH to the correspodning Visual Studio Version you have to use for Python. There are special Microsoft Visual Studio version like [this](http://www.microsoft.com/en-us/download/details.aspx?id=44266). For further solution check [this](http://stackoverflow.com/questions/2667069/cannot-find-vcvarsall-bat-when-running-a-python-script). – Qriss May 01 '15 at 10:15