[egenix-users] Installation of egenix-mx-base sometimes failing with tox

M.-A. Lemburg mal at egenix.com
Tue Apr 28 16:52:58 CEST 2015

Some time ago we had a report by Albert-Jan Roskam about tox
sometimes failing to run tests which included egenix-mx-base
as dependency.

Here's an example test run output:

restoring build data from a previous build run
running build
skipping the build process and reusing existing build files
running install_lib
running build_py
error: package directory 'mx' does not exist

Now this only happened sometimes, not always, and for quite a while
we were not able to reproduce this problem on our systems.

After several weeks of trying to debug the problem, we finally found
that it seemed to have to do with the new hash randomization available
in Python 2.7.3 and later which tox uses to run tests.

With certain hash seeds we were able to reproduce the problem
consistently (but not with the default hash seed of 0).

Technical Explanation

After another long hunt through the code, we then found the
cause which is rather technical:

The hash randomization was causing the prebuilt build pickle
restoration to partially overwrite the distribution.have_run
dictionary in distutils with some hash seeds.

As a result, distutils was trying to rebuild the already
built package from source, but this could not succeed, since
the prebuilt archives don't come with source files (only with
the already built files).

The cause for all this was the order of dictionary keys
implied by the string hash function in Python. With some
seeds the state of e.g. the build_py command in distutils
was restored after the distribution object, resetting the
have_run state as a result.

Here's one hash seed which causes the problem consistently
on a 64-bit Linux on our systems:

export PYTHONHASHSEED=1054368386


If you don't want to wait for the new releases, you can
work around the problem by following the instructions here:


If you get similar problems in other setting, you can set
the hash seed to 0 like this:


before running pip.

The egenix-mx-base package itself (apart from the included
mxSetup.py) is not affected.

Anyway, long story short: we'll fix this in our next eGenix package

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Apr 28 2015)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> mxODBC Plone/Zope Database Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the egenix-users mailing list