2.5 from source install problem with extensions

Florian Demmer fdemmer at gmail.com
Thu Apr 19 09:04:03 CEST 2007


On Apr 18, 7:39 pm, Anton Hartl <anton.ha... at gmail.com> wrote:
> Hi,
>
> On 2007-04-18, Florian Demmer <fdem... at gmail.com> wrote:
>
> > On Apr 18, 12:36 pm, Florian  Demmer <fdem... at gmail.com> wrote:
> >> Hi!
>
> >> I am doing a from source installation of Python 2.5 on some old Debian
> >> machine. As the target directoy I want /opt/somename so i added it to
> >> the configure like so:
>
> >> ./configure --prefix=/opt/somedir
>
> >> The following make works fine as far as I can see. Then the make
> >> install also actually works and installs python in /opt/somedir with
> >> all its subdirectoris (bin, lib, man, include).
> >> The extensions (*.so) however get put in /usr/local/lib/... and there
> >> also in the wrong python directoy: 2.4
>
> Basically I had the same problem(s).
>
> >> (How) can I change the install_dir for the extensions?
> >> Why does it use python2.4 anyway?! What env var or else is set here
> >> that I cannot find?
>
> I've patched setup.py as follows:
>
> --- setup.py.orig       Thu Aug 10 01:42:18 2006
> +++ setup.py    Mon Dec 25 19:05:29 2006
> @@ -147,6 +147,14 @@
>              if ext.name in sys.builtin_module_names:
>                  self.extensions.remove(ext)
>
> +           # so -lpython2.5 works in the build
> +           ext.library_dirs.append('.')
> +
> +           # so shared libs requiring libpython2.5.so work
> +           py_instdir = os.environ.get("INSTDIR_PYTHON", None)
> +           if py_instdir:
> +               ext.library_dirs.append(os.path.join(py_instdir, 'lib'))
> +
>          if platform != 'mac':
>              # Parse Modules/Setup and Modules/Setup.local to figure out which
>              # modules are turned on in the file.
>
> Then you have to add INSTDIR_PYTHON to your shell environment, i.e.
>
> INSTDIR_PYTHON=/opt/somedir ; export INSTDIR_PYTHON
>
> or whatever your shell requires.
>
> This works for me.  Hope it helps,

nice workaround (and it does work), thank you...
at least until when i try to install Python2.6 and forget about that
again ;)

since i was not quite satisfied by the solution (i will have to
install py25 from source on a customer's system that i dont know much
about yet at a later time and that _has_ to work then), i searched for
more reasons why it fails in the first place... and actually found
something:

~/.pydistutils.cfg
--> install_lib = /usr/local/lib/python2.4/site-packages

... uncommented it and ran make install again --> works! :D

br
Florian




More information about the Python-list mailing list