Python 2.5 incompatible with Fedora Core 6 - packaging problems again

John Nagle nagle at animats.com
Sun Mar 4 07:42:38 CET 2007


   I've been installing Python and its supporting packages on
a dedicated server with Fedora Core 6 for about a day now.
This is a standard dedicated rackmount server in a colocation
facility, controlled via Plesk control panel, and turned over
to me with Fedora Core 6 in an empty state.  This is the
standard way you get a server in a colo today.

   Bringing Python up in this completely clean environment is
a huge hassle, and it doesn't really work.

   Fedora Core 6 ships with Python 2.4, which appears to be a
good decision on someone's part.  Of course, there's no
standard RPM for a Python 2.5 install on Linux.  Packaging is
someone else's problem, according to the Python developers.
So it's necessary to build from source.  And the "python.org"
FTP server is down, so even getting the source onto a remote
server is a pain.  So I have to download it on another machine
and bring it over with FTP.

   Trying to install Python 2.5 yields at least the following problems:

   Fedora Core 6 comes with GCC 4.1.1, but the README file
with Python 2.5 says this:

GCC 4.1,
GCC 4.2: There is a known incompatibility between Python and GCC,
          where GCC 4.1 and later uses an interpretation of C
          different to earlier GCC releases in an area where the C
          specification has undefined behaviour (namely, integer arithmetic
          involving -sys.maxint-1).

          As a consequence, compiling Python with GCC 4.1/4.2 is not
          recommended. It is likely that this problem will be resolved
          in future Python releases. As a work-around, it seems that
          adding -fwrapv to the compiler options restores the earlier
          GCC behaviour.

    OK, given that, presumably "./configure" takes care of that problem,
right?  Anybody know for sure?

    "make" runs fine after "./configure".

    But "make install" does some compiles, something "install" probably
shouldn't be doing.  Some of these compiles fail, with error messages
like 
"/var/www/vhosts/sitetruth.com/private/downloads/python/Python-2.5/Modules/_curses_panel.c:271: 
error: "PyCursesPanelObject" has no member named "pan"

But the install script plunges blindly on, presumably installing a broken
Python 2.5.  Apparently Fedora Core 6 doesn't come with "curses" preinstalled,
but the Python installer assumes it is there.  What's inexcusable is
just plowing on after failed compiles, resulting in a broken install.

It's probably necessary to install something before building Python,
but the README file is silent on this.

     OK.  Plunging onward, and not really needing the "curses" library,
we try to install MySQLdb.  We get that with FTP,
unpack it, go to the approprate directory, and run "python setup.py".
This fails because the MySQL headers aren't installed:

"_mysql.c:35:23: error: my_config.h: No such file or directory"

OK, looks like we need to install "mysql-devel", so we do that,
using "yum".   This forces an update of OpenSSL, Kerberos, and
"e2fsprogs-dev".  Which means we should reboot at some point.

But now we can build MySQLdb.  So we build and install it.

So then we try "import MySQLdb" in Python 2.5.  And we get this:

> /usr/local/lib/python2.5/site-packages/MySQL_python-1.2.2-py2.5-linux-i686.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/local/lib/python2.5/site-packages/MySQL_python-1.2.2-py2.5-linux-i686.egg/_mysql.pyc, but /var/www/vhosts/sitetruth.com/private/downloads/MySQLdb/MySQL-python-1.2.2 is being added to sys.path
>   import sys, pkg_resources, imp
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "MySQLdb/__init__.py", line 19, in <module>
>     import _mysql
>   File "build/bdist.linux-i686/egg/_mysql.py", line 7, in <module>
>   File "build/bdist.linux-i686/egg/_mysql.py", line 4, in __bootstrap__
>   File "/usr/local/lib/python2.5/site-packages/setuptools-0.6c5-py2.5.egg/pkg_resources.py", line 800, in resource_filename
>   File "/usr/local/lib/python2.5/site-packages/setuptools-0.6c5-py2.5.egg/pkg_resources.py", line 1228, in get_resource_filename
>   File "/usr/local/lib/python2.5/site-packages/setuptools-0.6c5-py2.5.egg/pkg_resources.py", line 1250, in _extract_resource
>   File "/usr/local/lib/python2.5/site-packages/setuptools-0.6c5-py2.5.egg/pkg_resources.py", line 880, in get_cache_path
>   File "/usr/local/lib/python2.5/site-packages/setuptools-0.6c5-py2.5.egg/pkg_resources.py", line 846, in extraction_error
> pkg_resources.ExtractionError: Can't extract file(s) to egg cache
> 
> The following error occurred while trying to extract file(s) to the Python egg
> cache:
> 
>   [Errno 13] Permission denied: '/var/www/vhosts/sitetruth.com/.python-eggs'
> 
> The Python egg cache directory is currently set to:
> 
>   /var/www/vhosts/sitetruth.com/.python-eggs
> 
> Perhaps your account does not have write access to this directory?  You can
> change the cache directory by setting the PYTHON_EGG_CACHE environment
> variable to point to an accessible directory.

So what's going on?  We've run into a conflict between an assumption of Python 
and of the Plesk control panel.  Plesk doesn't let the user create files
in their own home directory.  This installer assumes it can.  Oops.
(Plesk sets up a very locked down environment, which is a good thing on
a web server.)

So, becoming the super-user, we create .python-eggs and change its ownership.
Now we can import MySQLdb into Python.

Now it turns out that we have Python 2.4 in /usr/bin, and Python 2.5
in /usr/local/bin.  That's where the installer put it.  So the CGI
scripts are invoking the wrong version of Python.  The scripts had to
be changed.

At last, MySQLdb is connecting to MySQL properly.  However, the SSL module
seems to be broken.  Tomorrow I'll deal with that, and try to get
M2Crypto installed, always a tough job.

This kind of nonsense is why hosting companies don't want to support Python.
Perl and PHP may be dumb, but they just work.  Java has a company behind it.
Python just isn't ready.  Which is embarassing, ten years on.

If the Python crowd wants market share, attention, and a career path,
this has to be fixed.

				John Nagle



More information about the Python-list mailing list