Skip to content

Install 32bit python on 64bit system #66

Closed

Description

@s1341

Some applications require a 32bit python. These apps link (dynamically) against the libpythonXX.so.

I'm working on adding support for installing a 32bit python using pyenv install and will submit a pull request if necessary when I'm done.

Is this something others are interested in?

Activity

  1. yyuu commented on Oct 16, 2013

    @yyuu
    Contributor

    I have never ran into similar problems. Though, the patches are welcome 👍

  2. s1341 commented on Nov 3, 2013

    @s1341
    ContributorAuthor

    Hi,

    So I've played with it a bit and I have found the following to work:

    This works, but requires LD_LIBRARY_PATH to be set at run time:

    CONFIGURE_OPTS="LDFLAGS=-m32 CFLAGS=-m32 --enable-shared" LD_LIBRARY_PATH=`pwd`/versions/2.7.4/lib:$LD_LIBRARY_PATH pyenv install 2.7.4 -vfk
    

    This is better. It doesn't require LD_LIBRARY_PATH at all. There is, however, an issue with bash quoting or whatever which causes this to fail on stock pyenv. Echoing the command at line 541 in pyenv-build to a file and then executing that file solves this issue.

    PYTHON_CONFIGURE_OPTS='LDFLAGS="-m32 -Wl,-rpath=/root/pyenv-tests/pyenv/versions/2.7.3_32bit/lib" CFLAGS=-m32 --enable-shared' VERSION_NAME=2.7.3_32bit pyenv install 2.7.3 -vfk
    

    The following seems to work on OSX, somehow without any DYLIB paths or PYTHONHOME: Note that you need to brew install zlib, readline and sqlite with --universal, and the same bash quoting issue needs to be worked around here too.

    PYTHON_CONFIGURE_OPTS='LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/sqlite/lib -m32" CFLAGS="-m32 -I/usr/local/opt/zlib/include -I/usr/local/opt/readline/include -I/usr/local/opt/sqlite/include" --enable-shared' VERSION_NAME=2.7.3_32bit pyenv install 2.7.3 -vfk
    

    It's probably worth determining how to add rpaths here too.

    All in all, changes to stock pyenv:

    • comment out the unset of VERSION_NAME in order to be able to give 'aliased' names for e.g. 2.7.3-32bit. Perhaps it would be useful to add an --as argument to pyenv install.
    • work around the bash quoting issue in order to be able to specify LDFLAGS containing spaces. I would be very grateful for assistance in resolving this issue properly. I couldn't figure out how to quote the LDFLAGS correctly so that it would be passed sanely to configure.

    How would it be best to integrate this into pyenv? Custom definitions? A patch to add -32 (like --debug)? Is anyone else even interested in this?

  3. jstarsky commented on Dec 5, 2013

    @jstarsky

    I am sorry i am new with pyenv. what i need to do for have python 2.6.9 in 32bit and also install python 3.3.0 32bits and 64 bits. i cant do it. thanks

  4. s1341 commented on Dec 5, 2013

    @s1341
    ContributorAuthor

    I have not yet completed implementing this. Waiting for some feedback from @yyuu.

    What os are you running?

    On Dec 5, 2013, at 19:29, Starsky Lara [email protected] wrote:

    I am sorry i am new with pyenv. what i need to do for have python 2.6.9 in 32bit and also install python 3.3.0 32bits and 64 bits. i cant do it. thanks

    —
    Reply to this email directly or view it on GitHub.

  5. jstarsky commented on Dec 5, 2013

    @jstarsky

    i am running osx maverick

  6. jstarsky commented on Dec 5, 2013

    @jstarsky

    or at less do you known how to install python 2.6.9 with pyenv but 32 bits

  7. yyuu commented on Dec 6, 2013

    @yyuu
    Contributor

    @s1341 Sorry to be late. I don't like to have definitions per target architectures. I think that doing like pyenv install --debug is fair.

    I created my workaround to build 32bit binary as 387d69a (on the branch named 32), please try it later.

  8. s1341 commented on Dec 8, 2013

    @s1341
    ContributorAuthor

    @yyuu I looked at your branch. I think we need to add the rpath stuff and enable shared for this to really work properly. In most of the cases I've encountered, the reason for having a 32bit python in the first place is because some 32bit application wants to link against it.

  9. yyuu commented on Dec 20, 2013

    @yyuu
    Contributor

    I pushed 43212f6 which will set rpath if --enable-shared was given in PYTHON_CONFIGURE_OPTS. With this fix, following one liner will build 32bit Python with shared library.

    % env PYTHON_CONFIGURE_OPTS="--enable-shared" CFLAGS="-m32" LDFLAGS="-m32" pyenv install 2.7.6
    
  10. added a commit that references this issue on Jan 24, 2014
  11. yyuu commented on Feb 7, 2014

    @yyuu
    Contributor

    I don't like to add special feature for building 32bit binaries. Please use CFLAGS and LDFLAGS to specify compiler/linker flags.

  12. added a commit that references this issue on Apr 4, 2014
  13. disconnect3d commented on Apr 23, 2017

    @disconnect3d

    I know that this is old and closed but 👍 for 32 bit targets. Any possibility to rethink adding this into Pyenv?

    Shouldn't pyenv be an ultimate and easy installer for any Python version?

    Or at least please state in the README how one can use CFLAGS/LDFLAGS to install 32bit Python
    (so ppl won't have to search for this issue in the future ^^).

  14. added a commit that references this issue on May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions