Hello
I recently install MySQL-python-1.2.2 on a Macintosh running OS version 10.4.9
From the terminal I did the following...
edit site.cfg (to point to the mysql_config file, it was needing it to run setup.py)
python setup.py build
sudo python setup.py install
All appears to have completed fine.
I wanted to test it, so I ran import MySQLdb from the python shell and got the error message below.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "init.py", line 19, in ?
import _mysql
File "build/bdist.darwin-8.9.0-Power_Macintosh/egg/_mysql.py", line 7, in ?
File "build/bdist.darwin-8.9.0-Power_Macintosh/egg/_mysql.py", line 6, in bootstrap
ImportError: dlopen(/Users/ey/.python-eggs/MySQL_python-1.2.2-py2.3-macosx-10.4-ppc.egg-tmp/_mysql.so, 2): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient_r.15.dylib
Referenced from: /Users/ey/.python-eggs/MySQL_python-1.2.2-py2.3-macosx-10.4-ppc.egg-tmp/_mysql.so
Reason: image not found
Have not been able to find anything on this error message, so would appreciate any help you can offer.
Thanks
EY
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just got my new shiny MacBook Pro and had the exact same problem as I mentioned above. Once I copied the libraries into a secondary "mysql" directory everything ran just fine. Strange stuff.
J
btw, I was on a 600mhz G3 iBook that I bought way back in 02/2002. I must do so much stuff in the Terminal that I didn't realize just how freakin' slow that machine was! Wow! :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had the same error this evening. Played around with a lot of settings until I noticed this in the error message:
Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
Look at the path. There is an extra mysql in there for some reason.
As a test, I created another directory under lib called mysql and copied all the files from lib into that location. When I fired up the import again it worked just fine.
Now, it would be good to find out why that extra mysql is in there and get a clean compile.
Anyone out there know? Thanks!
Jamie
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I also recently upgraded to MySQLdb 1.2.2, when problems began.
First still running python 2.4, i gave me the error:
ImportError: Inappropriate file type for dynamic loading
Then after a restart it told me:
ExtractionError: Can't extract file(s) to egg cache\n\nThe following error occurred while trying to extract file(s) to the Python egg\ncache:\n\n [Errno 13] Permission denied: '/var/empty/.python-eggs'\n\nThe Python egg cache directory is currently set to:\n\n /var/empty/.python-eggs\n\nPerhaps your account does not have write access to this directory? You can\nchange the cache directory by setting the PYTHON_EGG_CACHE environment\nvariable to point to an accessible directory.\n
Then I decided to upgrade python first, installing python 2.5.1 with the Universal installer.
Now I am encountering a similar error message as the O.P. :
ImportError: dlopen(/Users/dirk/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg-tmp/_mysql.so, 2): image not found
Note however, that I am not experiencing these problems in the interactive interpreter, only from running Apache, with mod_python 3.3.1 installed. From the interpreter 'import MySQLdb' just works.
Any help in this area or improvements of the installer/documentation is greatly appreciated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I now fixed my problem. I don't know if it has any value to you guys since I was only experiencing this from within Apache with mod_python.
I noticed another error message every time after I rebooted my mac:
[Thu Jun 07 10:05:54 2007][error][client ::1] ExtractionError: Can't extract file(s) to egg cache\n\nThe following error occurred while trying to extract file(s) to the Python egg\ncache:\n\n [Errno 13] Permission denied: '/var/empty/.python-eggs'\n\nThe Python egg cache directory is currently set to:\n\n /var/empty/.python-eggs\n\nPerhaps your account does not have write access to this directory? You can\nchange the cache directory by setting the PYTHON_EGG_CACHE environment\nvariable to point to an accessible directory.\n
This error had something to do with the user Apache runs under not being able to write this PYTHON_EGG_CACHE to somewhere. This issue was fixed by making a extra_env_setting.py module containing:
import os
os.environ['PYTHON_EGG_CACHE'] = '/var/tmp'
(I was told this '/var/tmp' might be not very secure on a shared box, but since this mac is just for development this is not an issue. The '/var/tmp' should just be a directory the Apache user has write permissions to.)
And loading this module by Apache, by adding this to httpd.conf:
PythonImport /full/path/to/some/extra_env_setting.py mynetworkname.lan
I heard that you might also be able to accomplish this by using the SetEnv directive.
Anyway, after fixing this ExtractionError, the 'ImportError: dlopen(...' never occurred anymore. I guess my problem was just with the correct installation process of MySQLdb and this python eggs cache. But then again, this might be a totally different problem from what you guys are experiencing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
I recently install MySQL-python-1.2.2 on a Macintosh running OS version 10.4.9
From the terminal I did the following...
edit site.cfg (to point to the mysql_config file, it was needing it to run setup.py)
python setup.py build
sudo python setup.py install
All appears to have completed fine.
I wanted to test it, so I ran import MySQLdb from the python shell and got the error message below.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "init.py", line 19, in ?
import _mysql
File "build/bdist.darwin-8.9.0-Power_Macintosh/egg/_mysql.py", line 7, in ?
File "build/bdist.darwin-8.9.0-Power_Macintosh/egg/_mysql.py", line 6, in bootstrap
ImportError: dlopen(/Users/ey/.python-eggs/MySQL_python-1.2.2-py2.3-macosx-10.4-ppc.egg-tmp/_mysql.so, 2): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient_r.15.dylib
Referenced from: /Users/ey/.python-eggs/MySQL_python-1.2.2-py2.3-macosx-10.4-ppc.egg-tmp/_mysql.so
Reason: image not found
Have not been able to find anything on this error message, so would appreciate any help you can offer.
Thanks
EY
Hey folks.
Just got my new shiny MacBook Pro and had the exact same problem as I mentioned above. Once I copied the libraries into a secondary "mysql" directory everything ran just fine. Strange stuff.
btw, I was on a 600mhz G3 iBook that I bought way back in 02/2002. I must do so much stuff in the Terminal that I didn't realize just how freakin' slow that machine was! Wow! :)
I had the same error this evening. Played around with a lot of settings until I noticed this in the error message:
Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
Look at the path. There is an extra mysql in there for some reason.
As a test, I created another directory under lib called mysql and copied all the files from lib into that location. When I fired up the import again it worked just fine.
Now, it would be good to find out why that extra mysql is in there and get a clean compile.
Anyone out there know? Thanks!
Yep, same here, almost.
I also recently upgraded to MySQLdb 1.2.2, when problems began.
First still running python 2.4, i gave me the error:
ImportError: Inappropriate file type for dynamic loading
Then after a restart it told me:
ExtractionError: Can't extract file(s) to egg cache\n\nThe following error occurred while trying to extract file(s) to the Python egg\ncache:\n\n [Errno 13] Permission denied: '/var/empty/.python-eggs'\n\nThe Python egg cache directory is currently set to:\n\n /var/empty/.python-eggs\n\nPerhaps your account does not have write access to this directory? You can\nchange the cache directory by setting the PYTHON_EGG_CACHE environment\nvariable to point to an accessible directory.\n
Then I decided to upgrade python first, installing python 2.5.1 with the Universal installer.
Now I am encountering a similar error message as the O.P. :
ImportError: dlopen(/Users/dirk/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg-tmp/_mysql.so, 2): image not found
Note however, that I am not experiencing these problems in the interactive interpreter, only from running Apache, with mod_python 3.3.1 installed. From the interpreter 'import MySQLdb' just works.
Any help in this area or improvements of the installer/documentation is greatly appreciated.
Replying on myself.
I now fixed my problem. I don't know if it has any value to you guys since I was only experiencing this from within Apache with mod_python.
I noticed another error message every time after I rebooted my mac:
[Thu Jun 07 10:05:54 2007] [error] [client ::1] ExtractionError: Can't extract file(s) to egg cache\n\nThe following error occurred while trying to extract file(s) to the Python egg\ncache:\n\n [Errno 13] Permission denied: '/var/empty/.python-eggs'\n\nThe Python egg cache directory is currently set to:\n\n /var/empty/.python-eggs\n\nPerhaps your account does not have write access to this directory? You can\nchange the cache directory by setting the PYTHON_EGG_CACHE environment\nvariable to point to an accessible directory.\n
This error had something to do with the user Apache runs under not being able to write this PYTHON_EGG_CACHE to somewhere. This issue was fixed by making a extra_env_setting.py module containing:
import os
os.environ['PYTHON_EGG_CACHE'] = '/var/tmp'
(I was told this '/var/tmp' might be not very secure on a shared box, but since this mac is just for development this is not an issue. The '/var/tmp' should just be a directory the Apache user has write permissions to.)
And loading this module by Apache, by adding this to httpd.conf:
PythonImport /full/path/to/some/extra_env_setting.py mynetworkname.lan
I heard that you might also be able to accomplish this by using the SetEnv directive.
Anyway, after fixing this ExtractionError, the 'ImportError: dlopen(...' never occurred anymore. I guess my problem was just with the correct installation process of MySQLdb and this python eggs cache. But then again, this might be a totally different problem from what you guys are experiencing.