0

I am running Enthought Canopy, python version 2.7.3, and am having difficulties using the module MySQLdb. I installed MySQL_Python 1.2.3 from the Canopy Package Manager, but when I run my code I get

  File "pyfits_test.py", line 2, in <module>
    import MySQLdb as mdb
  File "/home/cmessick/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/MySQLdb/__init__.py", line 19, in <module>
    import _mysql
ImportError: libssl.so.6: cannot open shared object file: No such file or directory

Line 2 of my code simply says

import MySQLdb as mdb

I also tried

from MySQL_python import MySQLdb as mdb

and got

Traceback (most recent call last):
  File "pyfits_test.py", line 2, in <module>
    from MySQL_python import MySQLdb as mdb
ImportError: No module named MySQL_python

Does anybody have any suggestions to make Enthought Canopy work with MySQLdb?

Edit: Not sure it matters, but I'm running Ubuntu 12.04.

Second Edit: I figured out how to add to the module search path, so at the beginning of my code before anything else I now have:

import sys
sys.path.append('/usr/lib/python2.7/dist-packages/')

Once I do this, it works. Does anybody have a more permanent solution that I won't have to implement every time?

Roman C
  • 49,761
  • 33
  • 66
  • 176

1 Answers1

0

This is an old question now, but I just ran into the same problem with EPD 7.3-2 64-bit (not Canopy) on Ubuntu 13.10. The following approach fixed the issue for me:

cd /path/to/epd/lib
sudo ln -s libcrypto.so libcrypto.so.6
sudo ln -s libssl.so libssl.so.6

After this change, you should be able to import MySQLdb.

In your "fix," it appears you are adding the system python dist-packages directory to your EPD python search path; in general, you probably don't want to do this. Use enpkg to manage your EPD installation, and don't make your EPD python installation dependent upon the configuration of your system python.

Rich K.
  • 1
  • 1