|
From: Fought, R. <ric...@gd...> - 2008-01-07 16:30:35
|
Hi all,
I'm trying to set up matplotlib with basemap on CentOS 4.6 with python
2.3.4
I installed setuptools 0.6c7, then numpy 1.0.4, then matplotlib
0.91.1_r0, then basemap 0.9.9 (building and installing the GEOS library
from source). When I try to run the example simpletest.py script, I get
the following message:
/usr/lib/python2.3/site-packages/matplotlib-0.91.1_r0-py2.3-linux-i686.e
gg/pytz/__init__.py:29: UserWarning: Module matplotlib was already
imported from
/usr/lib/python2.3/site-packages/matplotlib-0.91.1_r0-py2.3-linux-i686.e
gg/matplotlib/__init__.pyc, but
/usr/lib/python2.3/site-packages/basemap-0.9.9-py2.3-linux-i686.egg is
being added to sys.path
from pkg_resources import resource_stream
Traceback (most recent call last):
File "simpletest.py", line 1, in ?
from matplotlib.toolkits.basemap import Basemap
ImportError: No module named basemap
Any ideas what might have gone wrong? I was expecting basemap to
install under /site-packages/matplotlib/toolkits but it installed under
a site-package of it's own.
Thanks,
Rich
|
|
From: Jeff W. <js...@fa...> - 2008-01-07 19:26:15
|
Fought, Richard wrote: > Hi all, > > I'm trying to set up matplotlib with basemap on CentOS 4.6 with python > 2.3.4 > > I installed setuptools 0.6c7, then numpy 1.0.4, then matplotlib > 0.91.1_r0, then basemap 0.9.9 (building and installing the GEOS library > from source). When I try to run the example simpletest.py script, I get > the following message: > > /usr/lib/python2.3/site-packages/matplotlib-0.91.1_r0-py2.3-linux-i686.e > gg/pytz/__init__.py:29: UserWarning: Module matplotlib was already > imported from > /usr/lib/python2.3/site-packages/matplotlib-0.91.1_r0-py2.3-linux-i686.e > gg/matplotlib/__init__.pyc, but > /usr/lib/python2.3/site-packages/basemap-0.9.9-py2.3-linux-i686.egg is > being added to sys.path > from pkg_resources import resource_stream > Traceback (most recent call last): > File "simpletest.py", line 1, in ? > from matplotlib.toolkits.basemap import Basemap > ImportError: No module named basemap > > Any ideas what might have gone wrong? I was expecting basemap to > install under /site-packages/matplotlib/toolkits but it installed under > a site-package of it's own. > > Thanks, > Rich > Rich: Unfortunately, I've no idea what's wrong and don't have 2.3 to test on. The install process for 2.3 is a bit different in that it uses setuptools to substitute for features in distutils that didn't appear until python 2.4. Can you easily upgrade to 2.4? If not, can you send a listing of site-packages/matplotlib/toolkits to me, off-list? -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: Jeff W. <js...@fa...> - 2008-01-07 21:56:22
|
Fought, Richard wrote: > > > >> -----Original Message----- >> From: Jeff Whitaker [mailto:js...@fa...] >> Sent: Monday, January 07, 2008 1:26 PM >> To: Fought, Richard >> Cc: mat...@li... >> Subject: Re: [Matplotlib-users] Basemap installation question >> >> Fought, Richard wrote: >> >>> Hi all, >>> >>> I'm trying to set up matplotlib with basemap on CentOS 4.6 >>> >> with python >> >>> 2.3.4 >>> >>> I installed setuptools 0.6c7, then numpy 1.0.4, then matplotlib >>> 0.91.1_r0, then basemap 0.9.9 (building and installing the GEOS >>> library from source). When I try to run the example simpletest.py >>> script, I get the following message: >>> >>> >>> >> /usr/lib/python2.3/site-packages/matplotlib-0.91.1_r0-py2.3-linux-i686 >> >>> .e >>> gg/pytz/__init__.py:29: UserWarning: Module matplotlib was already >>> imported from >>> >>> >> /usr/lib/python2.3/site-packages/matplotlib-0.91.1_r0-py2.3-linux-i686 >> >>> .e >>> gg/matplotlib/__init__.pyc, but >>> >>> >> /usr/lib/python2.3/site-packages/basemap-0.9.9-py2.3-linux-i68 >> 6.egg is >> >>> being added to sys.path >>> from pkg_resources import resource_stream Traceback (most recent >>> call last): >>> File "simpletest.py", line 1, in ? >>> from matplotlib.toolkits.basemap import Basemap >>> ImportError: No module named basemap >>> >>> Any ideas what might have gone wrong? I was expecting basemap to >>> install under /site-packages/matplotlib/toolkits but it installed >>> under a site-package of it's own. >>> >>> Thanks, >>> Rich >>> >>> >> Rich: Unfortunately, I've no idea what's wrong and don't >> have 2.3 to test on. The install process for 2.3 is a bit >> different in that it uses setuptools to substitute for >> features in distutils that didn't appear until python 2.4. >> Can you easily upgrade to 2.4? If not, can you send a listing >> of site-packages/matplotlib/toolkits to me, off-list? >> >> -Jeff >> > > Hi Jeff, > > Thanks for your response. I might be able to upgrade my prototype > machine to Python 2.4, but I'm not sure about my customer's box. > > Here is the listing from > python2.3/site-packages/matplotlib-0.91.1_r0-py2.3-linux-i686.egg/matplo > tlib/toolkits: > > __init__.py > __init__.pyc > > Regards, > Rich Fought > Richard: I've confirmed your problem - in fact, it occurs whenever setuptools is used (and the package is installed as an egg), This happens by default with python2.3, but only if you use setupegg.py for python2.4 and python2.5. I haven't figured out why yet - perhaps someone on the list who knows more about eggs will chime in. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: Jeff W. <js...@fa...> - 2008-01-07 22:23:45
|
Fought, Richard wrote: >>> Hi Jeff, >>> >>> Thanks for your response. I might be able to upgrade my prototype >>> machine to Python 2.4, but I'm not sure about my customer's box. >>> >>> Here is the listing from >>> >>> >> python2.3/site-packages/matplotlib-0.91.1_r0-py2.3-linux-i686.egg/matp >> >>> lo >>> tlib/toolkits: >>> >>> __init__.py >>> __init__.pyc >>> >>> Regards, >>> Rich Fought >>> >>> >> Rich: That's it? I expected to see a basemap directory >> installed there. Can you send me a listing of the basemap >> directory in site-packages? >> >> -Jeff >> >> > > Directory listing of > python2.3/site-packages/basemap-0.9.9-py2.3-linux-i686.egg : > > drwxr-xr-x 4 root root 4096 Jan 4 17:33 dap > drwxr-xr-x 2 root root 4096 Jan 4 17:33 dbflib > -rwxr-xr-x 1 root root 258 Jan 4 17:33 dbflibc.py > -rwxr-xr-x 1 root root 614 Jan 4 17:33 dbflibc.pyc > -rwxr-xr-x 1 root root 74526 Jan 4 17:33 dbflibc.so > drwxr-xr-x 2 root root 4096 Jan 4 17:33 EGG-INFO > -rwxr-xr-x 1 root root 256 Jan 4 17:33 _geos.py > -rwxr-xr-x 1 root root 608 Jan 4 17:33 _geos.pyc > -rwxr-xr-x 1 root root 88557 Jan 4 17:33 _geos.so > drwxr-xr-x 2 root root 4096 Jan 4 17:33 httplib2 > drwxr-xr-x 3 root root 4096 Jan 4 17:33 matplotlib > drwxr-xr-x 2 root root 4096 Jan 4 17:33 shapelib > -rwxr-xr-x 1 root root 260 Jan 4 17:33 shapelibc.py > -rwxr-xr-x 1 root root 620 Jan 4 17:33 shapelibc.pyc > -rwxr-xr-x 1 root root 92671 Jan 4 17:33 shapelibc.so > -rwxr-xr-x 1 root root 258 Jan 4 17:33 shptree.py > -rwxr-xr-x 1 root root 614 Jan 4 17:33 shptree.pyc > -rwxr-xr-x 1 root root 19958 Jan 4 17:33 shptree.so > > As you can see, there is a matplotlib folder here with the following > structure: > > matplotlib > |_toolkits > |_basemap > > I created a symbolic link to this basemap directory in the > matplotlib/toolkits directory and simpletest.py works now, though I > still get the warning message > > /usr/lib/python2.3/site-packages/matplotlib-0.91.1_r0-py2.3-linux-i686.e > gg/pytz/ __init__.py:29: UserWarning: Module matplotlib was already > imported from /usr/li > b/python2.3/site-packages/matplotlib-0.91.1_r0-py2.3-linux-i686.egg/matp > lotlib/_ _init__.pyc, but > /usr/lib/python2.3/site-packages/basemap-0.9.9-py2.3-linux-i686 .egg is > being added to sys.path > from pkg_resources import resource_stream > > I guess the basemap installer just installed the toolkit in the wrong > place. > > Regards, > Rich > Rich: I think this is happening because matplotlib (and the basemap toolkit) needs to use namespace packages (http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages) in order for the basemap stuff to be picked up from the matplotlib.toolkits namespace when basemap is installed as an egg. If it's installed using distutils (instead of setuptools), the basemap stuff just gets written in the matplotlib toolkits directory directly, and everything works fine. I think namespace packages were being used before, but were removed. I don't remember why. Until we get this fixed, I think your symlink trick is the only way to get it to work with python2.3. The warning message appears to be harmless. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: John H. <jd...@gm...> - 2008-01-07 22:30:39
|
On Jan 7, 2008 2:15 PM, Jeff Whitaker <js...@fa...> wrote: > I think namespace packages were being used before, but were removed. I > don't remember why. We removed the namespace packages support because we were using it improperly. To do it correctly would require moving all of the functionality out of matplotlib/__init__.py. Since there is currently a fair amount of functionality there, adding namespace support would require moving it and breaking the current API. In addition, there are some ongoing issues with performance and namespace packages. Because of this, we had some ambivalence about namespace packages and decided to remove the broken support until we could add proper support, if we decide to go that route. A good time to do that, if indeed we want to, would be when we release Michael's transforms branch, so we can break as much as possible at once. JDH |
|
From: Jeff W. <js...@fa...> - 2008-01-07 22:39:49
|
John Hunter wrote: > On Jan 7, 2008 2:15 PM, Jeff Whitaker <js...@fa...> wrote: > > >> I think namespace packages were being used before, but were removed. I >> don't remember why. >> > > We removed the namespace packages support because we were using it > improperly. To do it correctly would require moving all of the > functionality out of matplotlib/__init__.py. Since there is currently > a fair amount of functionality there, adding namespace support would > require moving it and breaking the current API. In addition, there are > some ongoing issues with performance and namespace packages. Because > of this, we had some ambivalence about namespace packages and decided > to remove the broken support until we could add proper support, if we > decide to go that route. A good time to do that, if indeed we want > to, would be when we release Michael's transforms branch, so we can > break as much as possible at once. > > JDH > John: OK, then I can think of two options for basemap in the interim: 1) remove setuptools support, since basemap cannot be installed as an egg without namespace packages. This means that python2.3 support would have to be dropped. 2) move the toolkits to basemap_toolkits, as Philip Eby suggested, and make matplotlib_toolkits a namespace package. Unfortunately, this may break lots of existing code. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |