★ wanayoo — archive 1999 https://github.com/python-cmake-buildsystem/python-cmake-buildsystem/issues/229Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find platform independent libraries <prefix> #229

Open
madebr opened this issue Jun 20, 2018 · 5 comments
Open

Could not find platform independent libraries <prefix> #229

madebr opened this issue Jun 20, 2018 · 5 comments

Comments

@madebr
Copy link
Contributor

@madebr madebr commented Jun 20, 2018

Hey,

I'm trying to package python for conan, which is a package manager for C/C++ libraries.
Conan will provide (and eventually build) the dependencies.

Building python fails at the latest step:

[100%] Relocate _sysconfigdata_m_linux2_.py and update pybuilddir.txt
cd /tmp/conan-cpython/build/build/bin && /tmp/conan-cpython/build/build/bin/python -E -S -m sysconfig --generate-posix-vars
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Also, the python binary in the build directory fails with the same error.

What option am I missing?

Steps to reproduce

#!/bin/bash

set -e

pip3 install --user conan

WD="$PWD"
CONAN_DIR="$WD/conan-cpython"
conan remote add -f bincrafters https://api.bintray.com/conan/bincrafters/public-conan
git clone https://github.com/madebr/conan-cpython.git "$CONAN_DIR" --branch alpha


SRC_DIR="$CONAN_DIR/build/source"   # dir with sources (python + cmake)
BIN_DIR="$CONAN_DIR/build/build"    # dir where cmake will build python
PKG_DIR="$CONAN_DIR/build/package"  # dir where cmake will install python to

# Download python source and python-cmake-buildsystem
conan source "$CONAN_DIR" --source-folder="$SRC_DIR"

# Download and build the python dependencies using conan
conan install "$CONAN_DIR" --install-folder="$BIN_DIR" --build=missing

# Build and install python using python-cmake-buildsystem
conan build "$CONAN_DIR" --source-folder="$SRC_DIR" --install-folder="$BIN_DIR" --build-folder="$BIN_DIR" --package-folder="$PKG_DIR"

# Create a package that can be shared
conan package "$CONAN_DIR" --source-folder="$SRC_DIR" --build-folder="$BIN_DIR" --package-folder="$PKG_DIR"
@boberfly
Copy link

@boberfly boberfly commented Jun 19, 2019

+1 I am getting this too, using CentOS 7 docker latest master with Python 2.6.16, using these defines:

-D PYTHON_VERSION=2.7.15
-D DOWNLOAD_SOURCES=OFF
-D BUILD_LIBPYTHON_SHARED=OFF
-D BUILD_EXTENSIONS_AS_BUILTIN=ON
-D Py_UNICODE_SIZE=4
-D USE_LIB64=ON
-D INSTALL_TEST=OFF

I supply my own OpenSSL and ZLib static libs which work with the regular automake system.

@jcfr
Copy link
Contributor

@jcfr jcfr commented Jun 19, 2019

Thanks for providing additional details. 👍

To better address the problem, could you provide the complete set of command leading to the error. For example:

docker pull imagename:tag
docker run --rm -ti imagename:tag bash

# followed by the list of command to run in the container
@boberfly
Copy link

@boberfly boberfly commented Jun 19, 2019

Hey @jcfr

This is my own custom docker build thing actually. I got digging and found a partial fix here:

0001-pythonhome-fix.patch.txt

It will install finally, but then it ends with:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site

Probably 2 post-install calls to python?

I think the issue is because my docker build is actually launching from the OS python subprocess module. You can see my docker building script here (the actual build works inside of the container):
https://github.com/boberfly/pipe-bootstrap

@jcfr
Copy link
Contributor

@jcfr jcfr commented Jun 19, 2019

Thanks for the update.

my docker build is actually launching from the OS python subprocess module

To summarize, trying to build the docker image associated with https://github.com/boberfly/pipe-bootstrap should allow to reproduce the problem ?

@boberfly
Copy link

@boberfly boberfly commented Jun 19, 2019

@jcfr yep! Just remove:
https://github.com/boberfly/pipe-bootstrap/blob/master/dependencies/Python/patches/0001-pythonhome-fix.patch
If you want to run without the patch I posted above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.