import error with Basemap

Hello,
using the basemap toolkit on Windows with Python 2.5 I get the following import
error:

In [1]: from matplotlib.toolkits.basemap import Basemap

···

---------------------------------------------------------------------------
<type 'exceptions.ImportError'> Traceback (most recent call last)

M:\<ipython console> in <module>()

C:\python\Lib\site-packages\matplotlib\toolkits\basemap\__init__.py in <module>()
----> 1 from basemap import __doc__, __version__
      2 from basemap import *

C:\python\Lib\site-packages\matplotlib\toolkits\basemap\basemap.py in <module>()
     36 from numpy import linspace, squeeze, ma
     37 from shapelib import ShapeFile
---> 38 import _geos, pupynere, netcdftime
     39
     40 # basemap data files now installed in lib/matplotlib/toolkits/basemap/data

C:\python\Lib\site-packages\matplotlib\toolkits\basemap\pupynere.py in <module>()
     35 import numpy
     36
---> 37 from dap.client import open as open_remote
     38 from dap.dtypes import ArrayType, GridType, typemap
     39

C:\python\Lib\site-packages\dap\client.py in <module>()
      2
      3 import dap.lib
----> 4 from dap.util.http import openurl
      5 from dap.exceptions import ClientError
      6

C:\python\Lib\site-packages\dap\util\http.py in <module>()
      2
----> 3 import httplib2
      4
      5 import dap.lib
      6 from dap.exceptions import ClientError

<type 'exceptions.ImportError'>: No module named httplib2

In [2]:

Why does Basemap need any httplib? I am not needing any remote connection.
Any help greatly appreciated.

Thanks and kind regards,
Timmie

Tim Michelsen wrote:

Hello,
using the basemap toolkit on Windows with Python 2.5 I get the following import
error:

In [1]: from matplotlib.toolkits.basemap import Basemap
---------------------------------------------------------------------------
<type 'exceptions.ImportError'> Traceback (most recent call last)

M:\<ipython console> in <module>()

C:\python\Lib\site-packages\matplotlib\toolkits\basemap\__init__.py in <module>()
----> 1 from basemap import __doc__, __version__
      2 from basemap import *

C:\python\Lib\site-packages\matplotlib\toolkits\basemap\basemap.py in <module>()
     36 from numpy import linspace, squeeze, ma
     37 from shapelib import ShapeFile
---> 38 import _geos, pupynere, netcdftime
     39
     40 # basemap data files now installed in lib/matplotlib/toolkits/basemap/data

C:\python\Lib\site-packages\matplotlib\toolkits\basemap\pupynere.py in <module>()
     35 import numpy
     36
---> 37 from dap.client import open as open_remote
     38 from dap.dtypes import ArrayType, GridType, typemap
     39

C:\python\Lib\site-packages\dap\client.py in <module>()
      2
      3 import dap.lib
----> 4 from dap.util.http import openurl
      5 from dap.exceptions import ClientError
      6

C:\python\Lib\site-packages\dap\util\http.py in <module>()
      2
----> 3 import httplib2
      4
      5 import dap.lib
      6 from dap.exceptions import ClientError

<type 'exceptions.ImportError'>: No module named httplib2

In [2]:
  
Timmie: Did you install basemap from source or using the binary installer?
Why does Basemap need any httplib? I am not needing any remote connection.
Any help greatly appreciated.
  

Because it includes a module for reading remote datasets over http.

Basemap includes the httplib2 module (http://code.google.com/p/httplib2/), but if you're installing from source it will only install it if it thinks you don't already have it. The simple workaround is to grab it and install it yourself (it's a single file, pure-python module).

If you've used the binary installer, it should definitely have been installed - so if that's the case let me know and I'll investigate further.

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328

If you've used the binary installer, it should definitely have been installed - so if that's the case let me know and I'll investigate further.

I used the binary installer for windows that you can download from Sourceforge.net

In fact, the thing is strange: I developed a program which displays a map at the end. A simple one but it worked. I didn't use it for some time. Today I used it again and: it didn't for anymore. I only got that strange error.

May I have a module conflict?

Please tell be if you need more information.

Kind regards & thanks for your quick response.

Timmie

Tim Michelsen wrote:

If you've used the binary installer, it should definitely have been installed - so if that's the case let me know and I'll investigate further.
    

I used the binary installer for windows that you can download from Sourceforge.net

In fact, the thing is strange: I developed a program which displays a map at the end. A simple one but it worked. I didn't use it for some time. Today I used it again and: it didn't for anymore. I only got that strange error.

May I have a module conflict?

Please tell be if you need more information.

Kind regards & thanks for your quick response.

Timmie
  
Timmie: It's possible that the windows installer is missing the httplib2 module - I don't have access to windows right now to check. Could you try installing httplib2 and let me know if that fixes it?

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328