11

I am using Ubuntu 10.10 (Linux pc07 2.6.35-27-generic #48-Ubuntu SMP Tue Feb 22 20:25:46 UTC 2011 x86_64 GNU/Linux) and the default python package (Python 2.6.6).

I would like to install python-psyco to improve the performance of one of my scripts, but only python-psyco-doc is available for 64 bit. I tried a virtual machine, but the the performance boost is much less on the virtual machine than on a "real" installed 32-bit Ubuntu.

So my question is: How can I install a 32Bit Python with psyco on my 64Bit Ubuntu machine?

edit: I've found this article and made this:

  • Download "Python 2.7.1 bzipped source tarball" from http://python.org/download/
  • Go in the directory where you decompressed "Python 2.7.1"
  • OPT=-m32 LDFLAGS=-m32 ./configure --prefix=/opt/pym32
  • make

But I got this error:

gcc -pthread -m32 -Xlinker -export-dynamic -o python \
            Modules/python.o \
            libpython2.7.a -lpthread -ldl  -lutil   -lm  
libpython2.7.a(posixmodule.o): In function `posix_tmpnam':
/home/moose/Downloads/Python-2.7.1/./Modules/posixmodule.c:7346: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
libpython2.7.a(posixmodule.o): In function `posix_tempnam':
/home/moose/Downloads/Python-2.7.1/./Modules/posixmodule.c:7301: warning: the use of `tempnam' is dangerous, better use `mkstemp'
Segmentation fault
make: *** [sharedmods] Fehler 139

edit2: Now I've found http://indefinitestudies.org/2010/02/08/how-to-build-32-bit-python-on-ubuntu-9-10-x86_64/ and it seems like this worked:

  • cd Python-2.7.1
  • CC="gcc -m32" LDFLAGS="-L/lib32 -L/usr/lib32 \ -Lpwd/lib32 -Wl,-rpath,/lib32 -Wl,-rpath,/usr/lib32" \ ./configure --prefix=/opt/pym32
  • make
  • sudo make install

But installing psyco didn't work:

This error appeared:

PROCESSOR = 'ivm'
running install
running build
running build_py
running build_ext
building 'psyco._psyco' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DALL_STATIC=1 -Ic/ivm -I/usr/include/python2.6 -c c/psyco.c -o build/temp.linux-x86_64-2.6/c/psyco.o
In file included from c/psyco.c:1:
c/psyco.h:9: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden
compilation terminated.
error: command 'gcc' failed with exit status 1

Installing the package python-dev solved the problem, but I still could not use psyco. Now I've installed a 32Bit Ubuntu System.

2
  • why not just compile for 64bit, since python is an interpreted language?
    – RolandiXor
    Mar 7, 2011 at 16:13
  • The compilation fails for me. Output of make says Could not build the ssl module! Python requires a OpenSSL 1.1.1 or newer
    – Ralph
    Sep 27, 2022 at 17:43

3 Answers 3

7

To run 32 bit applications on a 64 bit Ubuntu system, you will need ia32-libs. From a terminal, validate if you have this using

dpkg -l ia32-libs

If you've installed it, the output should looks like:

ii   ia32-libs ...

If it looks like un ia32-libs, you need to install it using:

sudo apt-get install ia32-libs
2
  • 1
    Unfortunately, this isn't working in Ubutu 14.04 vharron@tifa:~/ll/googd/build/x86l$ sudo apt-get install ia32-libs Reading package lists... Done Building dependency tree Reading state information... Done Package ia32-libs is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: lib32z1 lib32ncurses5 lib32bz2-1.0 E: Package 'ia32-libs' has no installation candidate
    – vharron
    Dec 6, 2014 at 22:28
  • This doesn't answer the question. I am still not sure how to download / compile python 32bit.
    – Ralph
    Sep 27, 2022 at 17:41
4

I finally got this to work by installing a 32-bit schroot'ed environment. Follow the directions here: https://help.ubuntu.com/community/DebootstrapChroot

I used the following configuration file for my schroot (/etc/schroot/chroot.d/natty32.conf):

[natty32]
description=Ubuntu 11 for i386
directory=/srv/chroot/natty32
personality=linux32
root-users=myloginname
type=directory
users=myloginname

Once installed, start the schroot session:

schroot -c natty32 -u root

Then install python2.6 with apt-get, install pip using it ( http://guide.python-distribute.org/installation.html ), then pip install psyco, numpy, &c.

0

I got this to work with the following:

for pkg in build-essential:i386 gdb:i386 lcov:i386 pkg-config:i386 libbz2-dev:i386 libffi-dev:i386 libgdbm-dev:i386 libgdbm-compat-dev:i386 liblzma-dev:i386 libncurses5-dev:i386 libreadline6-dev:i386 libsqlite3-dev:i386 libssl-dev:i386 lzma:i386 lzma-dev:i386 tk-dev:i386 uuid-dev:i386 zlib1g-dev:i386
do
apt-get -y install $pkg
done

then running Martin Thoma's script (I needed --enable-shared in order to produce libpython*.so files):

CC="gcc -m32" LDFLAGS="-L/lib32 -L/usr/lib32 \
-Lpwd/lib32 -Wl,-rpath,/lib32 -Wl,-rpath,/usr/lib32" \
./configure --prefix=/opt/pym32 --enable-shared
make
sudo make install

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .