I'm installing on a server where I don't have root access. Everything is going into ~/opt.
The server is running MySQL 3.23.53.
I just now created a ~/opt directory, and successfully built and installed Python 2.4.2. It was just "cd ~/opt/src/Python-2.4.2; ./configure --prefix=/home/me/opt; make; make install".
Then I did "export PATH=/home/me/opt/bin:$PATH".
Python2.4 runs when I run the 'python' command. Ok.
Then I did, "cd ~/opt/src/MySQL-python-1.2.0; python setup.py install --home=~/opt" but got the following error:
I'm trying to install MySQLdb on a shared host. This still doesn't work
with MysqlDB 1.2.1p2, when attempting to build as non-root in a
user directory.
What seems to be happening is that the extra directories in
"site.cfg" aren't put on the GCC command line.
The latest MySQLdb distribution has been unpacked into "~/lib/python/src/MySQL-python-1.2.1_p2"
"mysql_config" is in the path:
$ which mysql_config
/usr/bin/mysql_config
(mysql_config --version reports 4.1.7).
The Python version is "Python 2.3.4 (#1, Feb 2 2005, 12:11:53)"
Operating system is Linux: "Linux main19.ezpublishing.com 2.6.11.12-xenU #6 Mon Sep 26 23:40:31 PDT 2005 i686 athlon i386 GNU/Linux"
Simply executing "python setup.py install --home=~" in that situation results
in the first compile not finding "mysql.h", and things go downhill from there.
I tried editing "site.cfg" as follows, so build should be able to
find the libraries:
$ python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.3/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -D_GNU_SOURCE -fPIC -fPIC -I/usr/include -I/usr/include/python2.3 -c _mysql.c -o build/temp.linux-i686-2.3/_mysql.o -mpentiumpro -DBIG_TABLES -Dversion_info="(1,2,1,'final',2)" -Dversion="1.2.1_p2"
_mysql.c:39:19: mysql.h: No such file or directory
_mysql.c:40:23: my_config.h: No such file or directory
_mysql.c:41:26: mysqld_error.h: No such file or directory
_mysql.c:42:20: errmsg.h: No such file or directory
...
Note that the gcc command line generated doesn't include any mention of "/usr/local/mysql/include", which is why it's not working. But why isn't the build script putting those arguments in?
John Nagle
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just tried that (after some experiments with bash aliases, which have no effect)
and now the build works with no errors. Thanks.
Trying to import "MySQLdb" doesn't quite work yet:
$ python
Python 2.3.4 (#1, Feb 2 2005, 12:11:53) [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "MySQLdb/init.py", line 19, in ?
import _mysql
ImportError: No module named _mysql
>>>
The build process did build and install a
"~/lib/python/_mysql.so" file, so the module is there, but Python's searcher
doesn't know where to look yet. But that can be worked around. I've been able to load MySQLdb successfully once.
Thanks.
It still looks like "site.cfg" doesn't override "mysql_config", though. That should be documented.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry -- not sure why all my double quotes come out as ". I just typed them like regular double quotes. Same with the greater-thans and less-thans.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Trying to override that problem via "site.cfg" doesn't seem to have any effect.
Maybe I can do something with paths and aliases. But "site.cfg" should override
that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm installing on a server where I don't have root access. Everything is going into ~/opt.
The server is running MySQL 3.23.53.
I just now created a ~/opt directory, and successfully built and installed Python 2.4.2. It was just "cd ~/opt/src/Python-2.4.2; ./configure --prefix=/home/me/opt; make; make install".
Then I did "export PATH=/home/me/opt/bin:$PATH".
Python2.4 runs when I run the 'python' command. Ok.
Then I did, "cd ~/opt/src/MySQL-python-1.2.0; python setup.py install --home=~/opt" but got the following error:
$ python setup.py install --home=~/opt
running install
running build
running build_py
creating build
creating build/lib.linux-i686-2.4
copying _mysql_exceptions.py -> build/lib.linux-i686-2.4
creating build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/init.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/sets.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/stringtimes.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/mxdatetimes.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/pytimes.py -> build/lib.linux-i686-2.4/MySQLdb
creating build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/init.py -> build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-i686-2.4/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-i686-2.4
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/home/me/opt/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -I'/usr/local/include/mysql'
_mysql.c:41:19: mysql.h: No such file or directory
_mysql.c:42:26: mysqld_error.h: No such file or directory
{snip}
But that header (mysql.h) is right there where it's supposed to be:
$ ls /usr/local/include/mysql/
chardefs.h keymaps.h my_global.h my_pthread.h mysql_version.h sslopt-case.h tilde.h
dbug.h m_ctype.h my_list.h my_sys.h mysqld_error.h sslopt-longopts.h
errmsg.h m_string.h my_net.h mysql.h raid.h sslopt-usage.h
history.h my_config.h my_no_pthread.h mysql_com.h readline.h sslopt-vars.h
Did I forget to set some other necessary environment variable?
Thanks.
I'm trying to install MySQLdb on a shared host. This still doesn't work
with MysqlDB 1.2.1p2, when attempting to build as non-root in a
user directory.
What seems to be happening is that the extra directories in
"site.cfg" aren't put on the GCC command line.
The latest MySQLdb distribution has been unpacked into "~/lib/python/src/MySQL-python-1.2.1_p2"
"mysql_config" is in the path:
$ which mysql_config
/usr/bin/mysql_config
(mysql_config --version reports 4.1.7).
The Python version is "Python 2.3.4 (#1, Feb 2 2005, 12:11:53)"
Operating system is Linux: "Linux main19.ezpublishing.com 2.6.11.12-xenU #6 Mon Sep 26 23:40:31 PDT 2005 i686 athlon i386 GNU/Linux"
Simply executing "python setup.py install --home=~" in that situation results
in the first compile not finding "mysql.h", and things go downhill from there.
I tried editing "site.cfg" as follows, so build should be able to
find the libraries:
$ diff site.cfg site.cfg.orig
18,20c18,20
< mysql_root: /usr/local/mysql
< library_dirs: /usr/local/mysql/lib
< include_dirs: /usr/local/mysql/include
> #mysql_root: /usr/local/mysql
> #library_dirs: %(mysql_root)s/lib
> #include_dirs: %(mysql_root)s/include
That doesn't work either:
$ python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.3/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -D_GNU_SOURCE -fPIC -fPIC -I/usr/include -I/usr/include/python2.3 -c _mysql.c -o build/temp.linux-i686-2.3/_mysql.o -mpentiumpro -DBIG_TABLES -Dversion_info="(1,2,1,'final',2)" -Dversion="1.2.1_p2"
_mysql.c:39:19: mysql.h: No such file or directory
_mysql.c:40:23: my_config.h: No such file or directory
_mysql.c:41:26: mysqld_error.h: No such file or directory
_mysql.c:42:20: errmsg.h: No such file or directory
...
Note that the gcc command line generated doesn't include any mention of "/usr/local/mysql/include", which is why it's not working. But why isn't the build script putting those arguments in?
John Nagle
If mysql_config is working, you don't need to edit site.cfg.
What is the output of: mysql_config --include
And does mysql.h exist in the directory that the above command gives you?
Just tried that (after some experiments with bash aliases, which have no effect)
and now the build works with no errors. Thanks.
Trying to import "MySQLdb" doesn't quite work yet:
$ python
Python 2.3.4 (#1, Feb 2 2005, 12:11:53)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "MySQLdb/init.py", line 19, in ?
import _mysql
ImportError: No module named _mysql
>>>
The build process did build and install a
"~/lib/python/_mysql.so" file, so the module is there, but Python's searcher
doesn't know where to look yet. But that can be worked around. I've been able to load MySQLdb successfully once.
Thanks.
It still looks like "site.cfg" doesn't override "mysql_config", though. That should be documented.
It's not enough to build; you have to install, and the modules have to go on your PYTHONPATH.
Sorry -- not sure why all my double quotes come out as ". I just typed them like regular double quotes. Same with the greater-thans and less-thans.
Try 1.2.1rc3; there's already a bug open for build errors like this which crop up on old versions of MySQL.
Thanks for the quick reply. Here's part of the problem. This system has
two versions of mysql_config installed. And they return different results:
$ /usr/bin/mysql_config --include
-I/usr/include
$ /usr/local/mysql/bin/mysql_config --include
-I/usr/local/mysql/include
Trying to override that problem via "site.cfg" doesn't seem to have any effect.
Maybe I can do something with paths and aliases. But "site.cfg" should override
that.
Just change your PATH so that /usr/local/mysql/bin comes first:
export PATH=/usr/local/mysql/bin:$PATH