LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Can't compile mysqldb-python module in Slackware 12.2 (https://www.linuxquestions.org/questions/slackware-14/cant-compile-mysqldb-python-module-in-slackware-12-2-a-709748/)

croxen 03-06-2009 09:02 PM

Can't compile mysqldb-python module in Slackware 12.2
 
Trying to get Mytharchive working in Mythtv. A normal Slack 12.2 installation with mysql, Python, and Python-PIL (from linuxpackages.net) installed. The mythburn.py script complains that it can't find the mysqldb module.

All attempts to compile this module according to the instructions for MYSQL-python-1.2.2 using the command "python setup.py build" fail, with a screen output as follows


running build
running build_py
creating build
creating build/lib.linux-i686-2.5
copying _mysql_exceptions.py -> build/lib.linux-i686-2.5
creating build/lib.linux-i686-2.5/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-i686-2.5/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-i686-2.5/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-i686-2.5/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-i686-2.5/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-i686-2.5/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-i686-2.5/MySQLdb
creating build/lib.linux-i686-2.5/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-i686-2.5/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-i686-2.5/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-i686-2.5/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-i686-2.5/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-i686-2.5/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-i686-2.5/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-i686-2.5/MySQLdb/constants
running build_ext
building '_mysql' extension
Traceback (most recent call last):
File "setup.py", line 19, in <module>
setup(**metadata)
File "/usr/lib/python2.5/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.5/distutils/dist.py", line 974, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.5/distutils/dist.py", line 994, in run_command
cmd_obj.run()
File "/usr/lib/python2.5/distutils/command/build.py", line 112, in run
self.run_command(cmd_name)
File "/usr/lib/python2.5/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.5/distutils/dist.py", line 994, in run_command
cmd_obj.run()
File "build/bdist.linux-i686/egg/setuptools/command/build_ext.py", line 46, in run
File "/usr/lib/python2.5/distutils/command/build_ext.py", line 290, in run
self.build_extensions()
File "/usr/lib/python2.5/site-packages/Pyrex/Distutils/build_ext.py", line 82, in build_extensions
self.build_extension(ext)
File "build/bdist.linux-i686/egg/setuptools/command/build_ext.py", line 175, in build_extension
File "/usr/lib/python2.5/distutils/command/build_ext.py", line 453, in build_extension
sources = self.swig_sources(sources, ext)
File "build/bdist.linux-i686/egg/setuptools/command/build_ext.py", line 77, in swig_sources
TypeError: swig_sources() takes exactly 3 arguments (2 given)



Since I know absolutely zero about python in general, any idea what I'm doing wrong in the compiling of mysqldb-python? Or does anybody know where a precompiled binary of this python module may be had?

Thx in advance.

bgeddy 03-06-2009 09:31 PM

There is a build script on SlackBuilds which I have used (in Slackware 12.0) that works.

croxen 03-07-2009 12:11 PM

Quote:

Originally Posted by bgeddy (Post 3467489)
There is a build script on SlackBuilds which I have used (in Slackware 12.0) that works.

Thanks, but the slackbuilds.org script breaks down at exactly the same point with the same swig_sources error message as just running the setup.py script does.

I wonder whether the current 2.5.2 version of python in Slack 12.2 just happens to break the setup.py script in the mysqldb-python module source.

bgeddy 03-07-2009 12:48 PM

Well I just tried the Slackbuild on a clean Slackware 12.2 install (after installing pysetuptools). It worked fine so I suspect something else is wrong on your system. Sorry I can't be more helpful but look at what else you have installed.

croxen 03-07-2009 04:13 PM

Quote:

Originally Posted by bgeddy (Post 3467962)
Well I just tried the Slackbuild on a clean Slackware 12.2 install (after installing pysetuptools). It worked fine so I suspect something else is wrong on your system. Sorry I can't be more helpful but look at what else you have installed.

Thanks, will do. There's a fair amount of additional stuff on the box pursuant to dependencies necessary for compiling and running Mythtv. Mytharchive, nuvexport, and some of the maintenance perl scripts are pretty much the only bits I haven't got going yet.

But at least now I know the python module ought to compile on Slack 12.2. I guess I'll have to dig into the python script and try to figure out why the line is coming up one argument short.

All the best.

adriv 03-07-2009 04:36 PM

Remove PIL and install it again with this SlackBuild script.

With a bit of luck MYSQL-python will compile then.

croxen 03-08-2009 11:26 AM

Quote:

Originally Posted by adriv (Post 3468144)
Remove PIL and install it again with this SlackBuild script.

With a bit of luck MYSQL-python will compile then.

Thanks! But while the slackbuild you showed me for PIL works like a champ, and the reulting package installs fine, it doesn't seem to affect the compile for mysqldb-python for me, which still breaks down at the same point with:

File "build/bdist.linux-i686/egg/setuptools/command/build_ext.py", line 77, in swig_sources
TypeError: swig_sources() takes exactly 3 arguments (2 given)

So I guess I'll be needing to poke around in the inner workings of python scripts than I initially planned. Oh well...

adriv 03-08-2009 03:31 PM

I found a probable solution here.
I don't know anything about python, so I wouldn't even know how to implement it however...
But maybe you do (or someone else) and it leads to a compilation.

Good luck!

bgeddy 03-08-2009 03:58 PM

I've just uploaded my built package to a filesharing site if you want to download it i'ts here - it may be quicker to download and install this rather than mess around with your installed packages.

Sorry I didn't think of this earlier - better late than never !

croxen 03-09-2009 05:46 AM

Quote:

Originally Posted by bgeddy (Post 3468924)
I've just uploaded my built package to a filesharing site if you want to download it i'ts here - it may be quicker to download and install this rather than mess around with your installed packages.

Sorry I didn't think of this earlier - better late than never !

Thanks a million! The binary packege installed and functions flawlessly. Mythburn.py now initializes, and I can settle back down down to the more usual intractable problems with the always awful ffmpeg ... but that's another thread.

It does look as though adriv has found the trail to the complete solution, with mismatched "def swig_sources" lines in the setup.py and in the version of Python installed. I'll need to explore further as time permits how this is reflected in my own Python installation in 12.2.

I wonder if your compiled MySQL-python 1.2.2 package should perhaps be submitted to an archive like linuxpackages.net? It certainly falls within the scope of needs they traditionally address.

Thanks again!

All the best.

bgeddy 03-09-2009 08:41 AM

Quote:

It does look as though adriv has found the trail to the complete solution, with mismatched "def swig_sources" lines in the setup.py and in the version of Python installed. I'll need to explore further as time permits how this is reflected in my own Python installation in 12.2.
Yes it looks like adriv is on the right track with his information. I've had a quick look at the supplied link and it looks relevant - I'll be looking deeper when I get chance with a view to providing a patch possibly.
Quote:

I wonder if your compiled MySQL-python 1.2.2 package should perhaps be submitted to an archive like linuxpackages.net? It certainly falls within the scope of needs they traditionally address.
I'll have to have a think about this as LP doesn't have a good reputation and SlackBuilds provide a build for this (although it wouldn't work in your case !)

Glad it worked for you.

croxen 03-09-2009 04:14 PM

Quote:

Originally Posted by adriv (Post 3468912)
I found a probable solution here.
I don't know anything about python, so I wouldn't even know how to implement it however...
But maybe you do (or someone else) and it leads to a compilation.

Good luck!

Looks like you found it. Thanks!

bgeddy kindly passed a precompiled binary to me which works fine. But when I read (and reread) the thread you found on mismatched required arguments in the "def swig_sources" line, I began to wonder if, like in the Pyrex compile you found the thread on, the current 2.5.2 version of Python breaks the MySQL-python setup routine (which the README says is supported Python 2.3-2.5).

Sure enough, after a downgrade to Python 2.4.3 (Slack 11.0), the MySQL-python interface compiles perfectly. I guess "2.3-2.5" doesn't necessarily mean 2.5.2 !

Thanks again!

bgeddy 03-09-2009 07:57 PM

@croxen - as an experiment I uninstalled the pysetuptools I had built from SlackBuilds available here and uninstalled the MySQL-python-1.2.2 I had succesfully built. I then tried to run the SlackBuild for MySQL-python again and got exactly the same errors you originally reported.

So - in a nutshell - are you sure you built and installed pysetuptools from SlackBuilds as is recomended to build MySQL-python ?

croxen 03-10-2009 08:58 AM

Quote:

Originally Posted by bgeddy (Post 3470262)
@croxen - as an experiment I uninstalled the pysetuptools I had built from SlackBuilds available here and uninstalled the MySQL-python-1.2.2 I had succesfully built. I then tried to run the SlackBuild for MySQL-python again and got exactly the same errors you originally reported.

So - in a nutshell - are you sure you built and installed pysetuptools from SlackBuilds as is recomended to build MySQL-python ?

Ah ha!

You're right, I didn't specifically install pysetuptools. My initial attempt with the mysqldb module was to compile from source, in which process the setup.py in the MySQL-python-1.2.2 tarball went out and downloaded the pysetuptools it claimed it needed on its own. I went out to try the SlackBuilds script only after compiling from the tarball kept failing because of the swig_sources error.

Your experiment shows that setup.py must be downloading a version of pysetuptools not-quite-compatible with Python 2.5.2. In my own experiment, after I backleveled Python to 2.4.3 (from Slack 11), I had no further trouble from the SlackBuild script, and just compiling from source also works now.


All times are GMT -5. The time now is 09:42 PM.