After installing matplotlib basemap via Macports, example python code for basemap is not running?

As you noted, MacPorts installs its own Python version (by default, at opt/local/bin/python2.6 ). If you install a Python package via MacPorts, like basemap, you normally will need to run everything under the MacPorts Python. Don't try to mix and match Python instances.

Packages that include C extension modules or depend on other packages which include C libraries have to be built in a way that is compatible with the way the Python interpreter was built. The Python 2.6 installers from python.org are 32-bit-only and built to be compatible with a range of OS X versions. By default, what MacPorts builds will be 64-bit on 10.6, if possible, and only tailored for 10.6 systems.

The safest and easiest option long term would be to switch to using the MacPorts Python, ensuring that all the packages you need are installed from MacPorts.

Up vote 1 down vote favorite share g+ share fb share tw.

I'm using Mac OS X 10.6.8. I installed Python 2.6 using the binary installer in python.org/. I've been using it along with SciPy and Matplotlib for my scientific computing needs since March 2011 without any problems.

Recently, I have the need for the matplotlib library called Basemap. I followed this article on modelingguru.nasa.gov/docs/DOC-1847. It states that the easiest way to install the Basemap library is through Macports (or Fink).

So I tried to install Basemap via Macports. I executed the command port install py-matplotlib-basemap and it seems to install so many things such as Python 2.4, etc. So to be specific, I used Macports again but this time using port install py26-matplotlib-basemap since I'm using Python 2.6. The installation didn't seem to have any problems. Now I tested if Basemap was properly installed by running a Python code example that uses basemap for graphing.

But the terminal says the following before coming back to the prompt: Traceback (most recent call last): File "basemap-test.py", line 1, in from mpl_toolkits. Basemap import basemap File "/Library/Frameworks/Python. Framework/Versions/2.6/lib/python2.6/site-packages/mpl_toolkits/basemap/__init__.

Py", line 45, in import _geoslib, netcdftime ImportError: dlopen(/Library/Frameworks/Python. Framework/Versions/2.6/lib/python2.6/site-packages/_geoslib. So, 2): Symbol not found: _GEOSArea Referenced from: /Library/Frameworks/Python.

Framework/Versions/2.6/lib/python2.6/site-packages/_geoslib. So Expected in: dynamic lookup What may be wrong here? I know that Macports installs its own Python version, I don't know if that has an effect on this problem.

Thanks a lot in advance! Python numpy matplotlib scipy link|improve this question asked Oct 16 '11 at 10:13Adler Santos61.

Just to note: if you don't get an answer here, you might want to try a matplotlib mailing list. – Thomas K Oct 16 '11 at 11:43.

As you noted, MacPorts installs its own Python version (by default, at /opt/local/bin/python2.6). If you install a Python package via MacPorts, like basemap, you normally will need to run everything under the MacPorts Python. Don't try to mix and match Python instances.

Packages that include C extension modules or depend on other packages which include C libraries have to be built in a way that is compatible with the way the Python interpreter was built. The Python 2.6 installers from python.org are 32-bit-only and built to be compatible with a range of OS X versions. By default, what MacPorts builds will be 64-bit on 10.6, if possible, and only tailored for 10.6 systems.

The safest and easiest option long term would be to switch to using the MacPorts Python, ensuring that all the packages you need are installed from MacPorts.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions