Pass through LD_LIBRARY_PATH environment variable by default

Issue #265 on hold
David Riddle created an issue

I develop on RHEL6 using Python 2.7.8. I am having trouble using tox. When I run

$ tox -e py27

I receive the following error message:

sqlparse-0.1.14/.tox/py27/bin/python2: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

The reason for this error is because the environment variable LD_LIBRARY_PATH is not being passed. I can work around this by passing it in tox.ini which does work. The reason I bring this up is that this variable is of fundamental importance to how RedHat Software Collections work and I think this variable should be passed by default on Unix systems. In the next paragraph I will briefly describe what Software Collections are and how they work.

RedHat installs alternative versions of Python, distinct from the system version, in what they call Software Collections (SCLs). These software collections are separate self-contained trees of software that are installed in /opt. There are SCLs for Python27, Python33, and Python34. The default python interpreter for RHEL6 is Python26. These alternative interpreters can be enabled by the user either individually or collectively using a command line script called scl. This script works simply by setting the users PATH and LD_LIBRARY_PATH, among other environment variables.

When tox -e py27 runs it will find the python27 interpreter on the PATH but the interpreter will fail because it can not find its necessary libraries because LD_LIBRARY_PATH is not being properly set by tox. If this environment variable is not set any software on the PATH that is in an SCL will fail if it has a library dependency installed in an SCL. I would recommend that you add LD_LIBRARY_PATH as a default environment variable to be passed by tox. You may also want to consider the following which are also set by SCLs:

MANPATH, PKG_CONFIG_PATH, XDG_DATA_DIRS

Comments (8)

  1. Holger Krekel repo owner

    thanks for the explanations. could you do a little PR to add LD_LIBRARY_PATH and amend the existing test?

  2. Holger Krekel repo owner

    Fix issue #265 - Pass LD_LIBRARY_PATH by default

    This fix passes the LD_LIBRARY_PATH environment variable by default. This was done to support RedHat Software Collections.

    → <<cset efb154f85eff>>

  3. Log in to comment