[Distutils] setuptools and shared library dependencies

Greg Landrum greg.landrum at gmail.com
Wed Feb 4 06:57:15 CET 2009

Dear all,

I'm in the process of shifting a project I run over to using
setuptools for distribution. Things have mostly worked quite well to
this point, so compliments to all involved. :-)

I'm just about finished, but I've run up against a problem with
extension modules that have shared library dependencies.

Here's a schematic of my directory structure:


modA.so is an extension module that is dynamically linked against libDepA.so.

I've managed to get everything setup so that I can create an egg
reproducing the directory structure above, install that egg (not
zipped) with easy_install, and do things like
  >>> from pydir import foo
However, when I try to import modA:
  >>> from pydir import modA
I get the (expected) "ImportError: libDepA.so: cannot open shared
object file: No such file or directory"

If I were not using setuputils, I would make sure that I had BASE/bin
in my LD_LIBRARY_PATH and everything would work without problems.

If I explictly add the bin directory from the egg
(/usr/lib/python2.5/site-packages/BASE-0.1-py2.5-linux-i686.egg) to
LD_LIBRARY_PATH things also work, but requiring this level of
involvement from the user isn't particularly pleasing.

Is there a solution to this problem or is this a use case that doesn't
fit with setuptools?


More information about the Distutils-SIG mailing list