0

I am setting up python/numpy/scipy/matplotlib/mysql on my Mac Lion. I first installed Python 2.7.3 and mysqldb. I then updated to XCode 4.3.3 and used the ScipySuperpack to install numpy, scipy, etc.

at this point I am able to import several packages in python without incident but matplotlib dies as follows:

Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import scipy
>>> import _mysql
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-           
packages/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg/_mysql.py:3: 
UserWarning: Module _mysql was already imported from  
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-   
packages/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg/_mysql.pyc, but 
/Users/myname/pypy is being added to sys.path
>>> import matplotlib
Error 2002: Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (2)

Sorry if the question is basic but I don't understand the warning, or what it may have to do with the eventual error...

randoo
  • 1
  • 1
    See [this previous question](http://stackoverflow.com/questions/1448429/how-to-install-mysqldb-python-data-access-library-to-mysql-on-mac-os-x), particularly Step 9 in one of the answers. – cosmosis Jul 10 '12 at 09:24
  • Thank you very much! Looks like I can import matplotlib fine as long as I am not in the directory that I used to install mysqldb! strange... – randoo Jul 10 '12 at 16:01

1 Answers1

0

Strange. There is probably some internal namespace collision going on (given that this doesn't happen if you are in the mysql build directory). Matplotlib does not use mysql in any way, I checked this from a clone of the matplotlib source with:

$> grep -ir mysql *

And got no hits. But I guess the obvious answer is not to import matplotlib from within the mysql build directory...

pelson
  • 21,252
  • 4
  • 92
  • 99