It claims the problem is caused when MySQLdb/init.py imports _mysql
The only abnormal thing I needed to do to install MySQL-python was to change include_dirs in site.cfg to %(mysql_root)s/include/mysql (rather than %(mysql_root)s/include).
Having googled & searched the forum I cant find any reference to "undefined symbol" import errors.
Thanks for taking the time to look at this
Giles
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've (more or less) beaten this issue now, although not in a particularly intellectual way...
What I've done, for anyone else who suffers a similar problem, is to simply /not/ install MySQL from source. If I install MySQL when initially installing slackware, or via slapt-get at a later stage, MySQL-python will install perfectly happily on top.
I guess that this suggests that there's something specific to my computer which causes the MySQL ./configure script to change the defaults for the MySQL installation in such a way that prevents MySQL-python from being able to work with it. I couldn't tell you what that change might be, though.
However, this new approach of a generic installation has sorted me out, and I'm now happily accessing my MySQL db with python scripts. The only slight downside is that MySQL 5 isn't yet available in the slapt-get repositories, so I'm having to use version 4 instead, but that's a small price to pay for getting it working as far as I'm concerned.
Thanks for the top program
Giles
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You probably have a library mismatch. Make sure the client library you are compiling against is the one you are getting at run-time. Normally you should not change site.cfg; you should let mysql_config do it's job.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for that mention of mysql_config - that pointed out an obvious mistake to me. (mysql_config wasn't being found until I created a symlink from /usr/bin to /usr/local/mysql/bin/mysql_config - ooops). I've re-run the setup commands with an unedited version of site.cfg, and the output looks far less worrying, but I'm still getting the same import error.
My line of attack next would be to try to uninstall so that I can then reinstall in a "clean" environment, so I can be sure that there's no remnants from my past mistakes lurking around., but I can't work out how to uninstall. Is there a command that I should pass to setup.py (I tried python setup.py uninstall, but that's clearly not right).
I'm sorry if this is a really newb question.
Thanks again for your help
Giles
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sounds like the correct libraries may not be on your loader path. On Linux you may need to add /usr/local/mysql/lib (or wherever your libraries are) to /etc/ld.so.conf and then run ldconfig; or else edit site.cfg to enable a static build.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When trying to import MySQLdb into the python environment I get the error:
ImportError: /usr/lib/python2.4/site-packages/_mysql.so: undefined symbol: mysql_set_character_set
It claims the problem is caused when MySQLdb/init.py imports _mysql
The only abnormal thing I needed to do to install MySQL-python was to change include_dirs in site.cfg to %(mysql_root)s/include/mysql (rather than %(mysql_root)s/include).
Having googled & searched the forum I cant find any reference to "undefined symbol" import errors.
Thanks for taking the time to look at this
Giles
I've (more or less) beaten this issue now, although not in a particularly intellectual way...
What I've done, for anyone else who suffers a similar problem, is to simply /not/ install MySQL from source. If I install MySQL when initially installing slackware, or via slapt-get at a later stage, MySQL-python will install perfectly happily on top.
I guess that this suggests that there's something specific to my computer which causes the MySQL ./configure script to change the defaults for the MySQL installation in such a way that prevents MySQL-python from being able to work with it. I couldn't tell you what that change might be, though.
However, this new approach of a generic installation has sorted me out, and I'm now happily accessing my MySQL db with python scripts. The only slight downside is that MySQL 5 isn't yet available in the slapt-get repositories, so I'm having to use version 4 instead, but that's a small price to pay for getting it working as far as I'm concerned.
Thanks for the top program
Giles
You probably have a library mismatch. Make sure the client library you are compiling against is the one you are getting at run-time. Normally you should not change site.cfg; you should let mysql_config do it's job.
Thanks for that mention of mysql_config - that pointed out an obvious mistake to me. (mysql_config wasn't being found until I created a symlink from /usr/bin to /usr/local/mysql/bin/mysql_config - ooops). I've re-run the setup commands with an unedited version of site.cfg, and the output looks far less worrying, but I'm still getting the same import error.
My line of attack next would be to try to uninstall so that I can then reinstall in a "clean" environment, so I can be sure that there's no remnants from my past mistakes lurking around., but I can't work out how to uninstall. Is there a command that I should pass to setup.py (I tried python setup.py uninstall, but that's clearly not right).
I'm sorry if this is a really newb question.
Thanks again for your help
Giles
Sounds like the correct libraries may not be on your loader path. On Linux you may need to add /usr/local/mysql/lib (or wherever your libraries are) to /etc/ld.so.conf and then run ldconfig; or else edit site.cfg to enable a static build.