Menu

Installing in my home directory?

Help
2005-06-10
2012-09-19
  • Juris Program

    Juris Program - 2005-06-10

    Hey guys,

    I'm trying to install the MySQLDB API at my web host. I only have
    limited permissions on the system so I want to install it in my home
    directory. I'm having a lot of trouble though.

    I don't understand why my install attempts aren't working?

    Here's my system info:
    >>> print sys.version
    2.4.1 (#1, Jun 6 2005, 13:31:05)
    [GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2)]

    Here are the steps I've taken trying to install it:

    1. Download MySQL-python-1.2.0.tar.gz from project page into my home directory
      http://sourceforge.net/projects/mysql-python

    2. tar xvzf MySQL-python-1.2.0.tar.gz

    3. Do these commands:
      >> cd MySQL-python-1.2.0
      >> python2.4 setup.py install --home=~
      running install
      running build
      running build_py
      running build_ext
      building '_mysql' extension
      gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
      -Wstrict-prototypes -fPIC -I/usr/local/include/python2.4 -c _mysql.c
      -o build/temp.linux-i686-2.4/_mysql.o
      -I'/usr/local/mysql/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
      _mysql.c:43:20: errmsg.h: No such file or directory
      error: command 'gcc' failed with exit status 1

    4. I also tried running build:
      >> python2.4 setup.py build
      running build
      running build_py
      running build_ext
      building '_mysql' extension
      gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
      -Wstrict-prototypes -fPIC -I/usr/local/include/python2.4 -c _mysql.c
      -o build/temp.linux-i686-2.4/_mysql.o
      -I'/usr/local/mysql/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
      _mysql.c:43:20: errmsg.h: No such file or directory
      error: command 'gcc' failed with exit status 1

    (I don't know if I need to run build first or what)

    I found some help on http://docs.python.org/inst/inst.html
    but I don't really understand what it's talking about.
    I also read the README file in the download but it didn't help either.

    Any ideas would be greatly appriciated.

    Thanks,

    Greg

     
    • Andy Dustman

      Andy Dustman - 2005-06-10

      It's not finding the MySQL development headers. You have an old version of MySQL where mysql_config returns bad values for --include. Note that single quotes in -l'/usr/local/mysql/include/mysql'

      How to work around this in setup.py:

      include_dirs = [ '/usr/local/mysql/include/mysql' ]

      sometime before setup() is called.

       
    • Juris Program

      Juris Program - 2005-06-10

      I added the line so now that section of setup.py looks like this:
      include_dirs = [ d for d in include_dirs if os.path.isdir(d) ]
      library_dirs = [ d for d in library_dirs if os.path.isdir(d) ]
      include_dirs = ['/usr/local/mysql/include/mysql']

      I tried running it again and got these results:

      >> python2.4 setup.py build
      running build
      running build_py
      running build_ext
      building '_mysql' extension
      gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/mysql/include/mysql -I/usr/local/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -I'/usr/local/mysql/include/mysql'
      _mysql.c: In function _mysql_server_init': _mysql.c:187: warning: unused variableitem'
      _mysql.c:186: warning: unused variable groupc' _mysql.c:186: warning: unused variablei'
      _mysql.c:186: warning: unused variable cmd_argc' _mysql.c:185: warning: unused variables'
      _mysql.c:262: warning: label finish' defined but not used _mysql.c: At top level: _mysql.c:172: warning:_mysql_server_initdoc' defined but not used
      _mysql.c:267: warning: `_mysql_server_enddoc' defined but not used
      gcc -pthread -shared build/temp.linux-i686-2.4/_mysql.o -lmysqlclient -lz -lcrypt -lnsl -lm] -lmysqlclient_r -o build/lib.linux-i686-2.4/_mysql.so
      /usr/bin/ld: cannot find -lmysqlclient
      collect2: ld returned 1 exit status
      error: command 'gcc' failed with exit status 1

      >> python2.4 setup.py install --home=~
      running install
      running build
      running build_py
      running build_ext
      building '_mysql' extension
      gcc -pthread -shared build/temp.linux-i686-2.4/_mysql.o -lmysqlclient -lz -lcrypt -lnsl -lm] -lmysqlclient_r -o build/lib.linux-i686-2.4/_mysql.so
      /usr/bin/ld: cannot find -lmysqlclient
      collect2: ld returned 1 exit status
      error: command 'gcc' failed with exit status 1

      Do I maybe need a special build process since I only have limited access to most of the system beyond my home directory?

      -Greg

       
      • Andy Dustman

        Andy Dustman - 2005-06-10

        For some reason, your link line has both -lmysqlclient and -lmysqlclient_r. Only one is needed. Anyway, I don't think install will work in your case, unless you are using a Python installation in your own home directory.. You'll probably need to do setup.py bdist, and then unpack the resulting tarball someplace where Python can find it.

        Ah, I also see you have -lm] in your link line. That's an indication that mysql_config has failed in some interesting way. That problem should be fixed in 1.2.1c1.

         
    • Juris Program

      Juris Program - 2005-06-10

      How do I get 1.2.1c1, or is it not released yet?

      What does bdist do, how will it help? I looked it up in the python docs but I didn't understand it.

      Thanks again,

      Greg

       
    • Juris Program

      Juris Program - 2005-06-13

      I installed 1.2.1c1 but I'm still having trouble. I tried the bdist command. Below are the results. I do want to install this in my home directory.

      Below I tried setup.py build, setup.py install --home=~ and finally setup.py bdist:

      [gpinero@intel1 MySQL-python-1.2.1c3]$ python2.4 setup.py build
      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/usr/local/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -I'/usr/local/mysql/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
      _mysql.c:43:20: errmsg.h: No such file or directory
      error: command 'gcc' failed with exit status 1
      [gpinero@intel1 MySQL-python-1.2.1c3]$ python2.4 setup.py install --home=~
      running install
      running build
      running build_py
      running build_ext
      building '_mysql' extension
      gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -I'/usr/local/mysql/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
      _mysql.c:43:20: errmsg.h: No such file or directory
      error: command 'gcc' failed with exit status 1
      [gpinero@intel1 MySQL-python-1.2.1c3]$ python2.4 setup.py bdist
      running bdist
      running bdist_dumb
      running build
      running build_py
      running build_ext
      building '_mysql' extension
      gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -I'/usr/local/mysql/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
      _mysql.c:43:20: errmsg.h: No such file or directory
      error: command 'gcc' failed with exit status 1

       
    • Juris Program

      Juris Program - 2005-06-15

      Hey guys,

      I'm still working on this. I started a thread over at the python lists, and they have a few ideas, none have worked yet though.

      http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/d34d658b6e77d5d1/8e70d096817c9dd8?q=%22%2Fusr%2Fbin%2Fld:+cannot+find+-lmysqlclient_r%22&rnum=1&hl=en#8e70d096817c9dd8

      I'm really running out of ideas though.

      Thanks,

      Greg

       
      • Andy Dustman

        Andy Dustman - 2005-06-15

        Did you try 1.2.1c3?

        Did you try setting the environment variable mysqlclient=mysqlclient? This is in README.

        Do you have either libmysqlclient.so or libmysqlclient_r.so on your system? If you only have libmysqlclient.(_r).a, then you should set the environment variable mysqlstatic=True. If you don't have that, then your system does not have the necessary libraries installed.

         
    • Juris Program

      Juris Program - 2005-06-15

      Do I do all of this in setup.py? I'll look at the readme again.

       
    • Juris Program

      Juris Program - 2005-06-16

      Thanks! That worked. I just did the two export commands to set my env variables:
      (I guess that's in addition to all the other things I did)

      $export mysqlclient=mysqlclient
      $export mysqlstatic=True

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.