Menu

Impossible to install MySQLPython on Win?

Help
2006-04-10
2012-09-19
  • hawkeye2063

    hawkeye2063 - 2006-04-10

    Hi,
    Just tried to build/install MySQL-Python on WinXP. I got zlib, openssl and I took the MinGW-gcc compiler. But, apparently, Python is compiled using the Microsoft VC compiler, so I get an error message that I cannot use a different compiler.

    Basically, that means, that if I am unwilling to buy the MS VC compiler, I cannot install MySQL-Python on WinXP, right? Or... did I make a stupid mistake? Are there precompiled binaries for Python2.4 somewhere?

    Cheers

     
    • Andy Dustman

      Andy Dustman - 2006-04-10

      I don't use Windows but that sounds pretty much true. Binaries for 1.2.1 aren't available yet; I depend on end-users to produce these for me.

       
      • adealex

        adealex - 2006-04-24

        Hi,

        I think it is really important for a platorm independent language like Python to have full support for windows if someone wants to write code to connect to a mysql database.

        I am happy to have a go at compiling the latest release with the newly issued Visual Studio 2005 Express but I will need help with the configs and paths that are needed in setup.cfg. If I succeed I would send you the compiled winstaller to post on your release area.

        Please can you provide an example of what setup.cfg should look like on windows.

        Thanks for creating this great project.

         
        • James Pretorius

          James Pretorius - 2006-05-06

          I also didn't have any luck getting this working for Python 2.4 & MySQL 5. Simply too much time sorting out issues with registry settings, msvcompiler.py, and using the correct version of the .NET SDK (I first tried 1.0 via VS.NET 2002, then 2.0, before discovering that Python 2.4 wants 1.1, which still didn't work).

          Fortunately there is an alternative implementation:

          http://www.egenix.com/files/python/mxODBC.html

          I don't know what the relative strengths of these two MySQL interfaces are, apart from the fact that mxODBC can be installed on Windows :)

           
          • Andy Dustman

            Andy Dustman - 2006-05-08

            Well, it's been done before with 1.2.0, so it's obviously not impossible. Someone who is competent with building Python extensions on Windows needs to figure it out, though.

             
            • sjq

              sjq - 2006-05-09

              I'm having the same problems. I even tried building an older version, 1.0.0, to make sure it was me going wrong somewhere and not something up with the latest version. Still no joy, so it seems fairly certain it's me that is at fault.
              Any chance the admin could contact someone who has successfully done this before, maybe whoever posted the last windows install, so they can set us straight.

              Thanks.

               
              • Andy Dustman

                Andy Dustman - 2006-05-09

                That's been done, and there are people working out a Windows package, but I don't know when it will be available.

                 
                • sjq

                  sjq - 2006-05-11

                  I've had some success with this. I managed to build against MySQL-4.1.19 amd Python-2.4.3.

                  I had to make a couple of changes to _mysql.c...
                  Insert these 2 lines at start

                  define version_info "(1,2,1,'final',2)"

                  define version "1.2.1_p2"

                  And change line 1349 from "unsigned int" to "int".

                  Here is my site.cfg for anyone that is interested.
                  [snip]

                  Options:

                  embedded: link against the embedded server library

                  threadsafe: use the threadsafe client

                  static: link against a static library (probably required for embedded)

                  [options]
                  embedded = False
                  threadsafe = True
                  static = False

                  Use the compiler section to add additional options for the extension build.

                  In particular, if your platform does not support mysql_config (like

                  Windows), you will have to set most of these. Note that each entry is split

                  into a list so that each line is one item.

                  [compiler]
                  mysql_root: D:\dev\mysql-41
                  library_dirs: %(mysql_root)s\lib\opt
                  include_dirs: %(mysql_root)s\include
                  libraries: mysqlclient
                  zlib
                  msvcrt
                  libcmt
                  wsock32
                  advapi32

                  extra_compile_args:

                  extra_objects:

                  [snip]

                  Also a batch file I use to set up my compiler paths etc...
                  set Path=C:\Python24;%Path%
                  set Path=C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin;%Path%
                  set Include=D:\Program Files\Microsoft Platform SDK\Include;%Include%
                  set Include=C:\Program Files\Microsoft Visual C++ Toolkit 2003\include;%Include%
                  set Lib=D:\Program Files\Microsoft Platform SDK\Lib;%Lib%
                  set Lib=C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib;%Lib%
                  set Lib=C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib;%Lib%

                  One other thing I had to do was copy my_config.h from the MySQL install to the MySQL no-install tree I built against.

                  Still can't get it to build against MySQL-5.0.21. Getting errors about redefining things in libcmt.lib that have already been defined in msvcrt.lib (MSVCR71.dll).

                  Andy, if you want the installer I've built just let me know where to send it.

                  Regards.

                   
        • Andy Dustman

          Andy Dustman - 2006-04-24

          You should look at site.cfg instead. I really have no idea what the correct values are except for libraries, which should be correct and just needs to be uncommented (it's a multi-line value). mysql_root is wherever MySQL is installed, and may be version-dependent. library_dirs and include_dirs can be uncommented and / changed to \ for Windows.

           
          • adealex

            adealex - 2006-04-25

            I modified the site.cfg file as you said and now it looks like something is compiling but throwing errors. Here is my dos session:

            C:\>c:\Python24\python.exe setup.py bdist_wininst
            c:\Python24\lib\distutils\extension.py:133: UserWarning: Unknown Extension options: 'mysql_root'
            warnings.warn(msg)
            running bdist_wininst
            running build
            running build_py
            copying MySQLdb\release.py -> build\lib.win32-2.4\MySQLdb
            running build_ext
            building '_mysql' extension
            c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -I"C:/Program -IFiles/MysqlNoInstall/mysql-5.0.19/include" -Ic:\Python24\include -Ic:\Python24\PC /Tc_mysql.c /Fobuild\temp.win32-2.4\Release_mysql.obj -Dversion_info="(1,2,1,'final',2)" -Dversion="1.2.1_p2"_mysql.c
            c:\Program Files\MysqlDB\MySQL-python-1.2.1_p2\my_config.h(587) : warning C4005: 'HAVE_PUTENV' : macro redefinition
            c:\Python24\include\pyconfig.h(375) : see previous definition of 'HAVE_PUTENV'
            c:\Program Files\MysqlDB\MySQL-python-1.2.1_p2\my_config.h(687) : warning C4005: 'HAVE_SNPRINTF' : macro redefinition
            c:\Python24\include\pyerrors.h(220) : see previous definition of 'HAVE_SNPRINTF'
            c:\Program Files\MysqlDB\MySQL-python-1.2.1_p2\my_config.h(724) : warning C4005: 'HAVE_STRERROR' : macro redefinition
            c:\Python24\include\pyconfig.h(38) : see previous definition of 'HAVE_STRERROR'
            c:\Program Files\MysqlDB\MySQL-python-1.2.1_p2\my_config.h(851) : warning C4005: 'HAVE_TEMPNAM' : macro redefinition
            c:\Python24\include\pyconfig.h(33) : see previous definition of 'HAVE_TEMPNAM'
            c:\Program Files\MysqlDB\MySQL-python-1.2.1_p2\my_config.h(875) : warning C4005: 'HAVE_TZNAME' : macro redefinition
            c:\Python24\include\pyconfig.h(312) : see previous definition of 'HAVE_TZNAME'
            c:\Program Files\MysqlDB\MySQL-python-1.2.1_p2\my_config.h(1027) : warning C4005: 'SIZEOF_OFF_T' : macro redefinition
            c:\Python24\include\pyconfig.h(257) : see previous definition of 'SIZEOF_OFF_T'
            _mysql.c(1350) : warning C4018: '<' : signed/unsigned mismatch
            _mysql.c(2804) : error C2015: too many characters in constant
            _mysql.c(2804) : warning C4047: 'function' : 'const char ' differs in levels of indirection from 'int'
            _mysql.c(2808) : error C2059: syntax error : 'bad suffix on number'
            _mysql.c(2808) : error C2440: 'function' : cannot convert from 'double' to 'const char
            '
            _mysql.c(2808) : warning C4024: 'PyString_FromString' : different types for formal and actual parameter 1
            _mysql.c(2808) : error C2143: syntax error : missing ')' before 'constant'
            error: command '"c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe"' failed with exit status 2

            Can you think what might be the cause of these problems?

            Thanks,
            A.

             
            • Andy Dustman

              Andy Dustman - 2006-04-25

              Not really.

               
    • Anonymous

      Anonymous - 2006-04-10

      The MS compiler used to build Python 2.4 on Windows is free: http://msdn.microsoft.com/visualc/vctoolkit2003/

      Peter

       
    • hawkeye2063

      hawkeye2063 - 2006-04-10

      You're right, Peter. I just realized that, too, and installed the vctoolkit2003. However, that doesn't work either, because the complete .NET Software Development Kit is required (at least, that's what the error message tells me when trying to build the package).

       
      • Andy Dustman

        Andy Dustman - 2006-04-10

        Keep in mind you will likely have to modify site.cfg before building so that the right libraries and such are specified, once you have the right compiler. And then you'll want to do:

        python setup.py bdist_wininst

        to make a Windows installer. In theory anyway. install should work. If you manage to make an installer, let me know, and specify your Python and MySQL versions.

         
    • elpargo

      elpargo - 2006-04-27

      UNIX users please post the output of yourmysql_config
      If we make a database of all the flags the installer needs we may be able to create windows installers using mingw. if you look carefully each mysql_config has most of its values hardcoded and this are the ones needed in site.cfg, also please DONT post repeated versions.
      $mysql_config
      Usage: /usr/bin/mysql_config [OPTIONS]
      Options:
      --cflags [-I/usr/include/mysql -mcpu=i686 -fomit-frame-pointer -pipe -DHAVE_ERRNO_AS_DEFINE=1]
      --include [-I/usr/include/mysql]
      --libs [-L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -lssl -lcrypto]
      --libs_r [-L/usr/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto]
      --socket [/var/run/mysqld/mysqld.sock]
      --port [3306]
      --version [4.1.14]
      --libmysqld-libs [-L/usr/lib/mysql -lmysqld -lpthread -lcrypt -lnsl -lm -lpthread -lrt]

       
      • Brett Powley

        Brett Powley - 2006-04-27

        Mac OS X 10.4.6 (Intel):

        Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
        Options:
        --cflags [-I/usr/local/mysql/include -Os -arch i386 -fno-common]
        --include [-I/usr/local/mysql/include]
        --libs [-L/usr/local/mysql/lib -lmysqlclient -lz -lm]
        --libs_r [-L/usr/local/mysql/lib -lmysqlclient_r -lz -lm]
        --socket [/tmp/mysql.sock]
        --port [3306]
        --version [4.1.18]
        --libmysqld-libs [-L/usr/local/mysql/lib -lmysqld -lz -lm]

         

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.