Bug 2094352

Summary: Automake adds a folder "local" on top of the Python prefix when using the --with-python_prefix flag
Product: [Fedora] Fedora Reporter: Panos Asproulis <panos.asproulis>
Component: python3.10Assignee: Python Maintainers <python-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 36CC: cstratak, fberat, fjanus, jjanco, karsten, kasal, mhroncok, odubaj, panovotn, praiskup, python-maint, python-sig, thrnciar, torsava, vstinner
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-06-09 15:11:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Panos Asproulis 2022-06-07 13:08:19 UTC
Description of problem:

I encountered a problem with the version of automake in Fedora 36: when configuring a source project designed to build with the GNU automake tools one can use the option --with-python_prefix in order to specify the directory where the Python packages of this project (if it has any) are supposed to be installed e.g.

./configure --prefix=/opt/apps/my-project --with-python_prefix=/opt/apps/my-project

and in this case the application will be installed in

/opt/apps/my-project/

while the Python packages will be installed in

/opt/apps/my-project/lib/python3.10/site-packages/

However, in Fedora 36 this option results in the Python packages ending up in directory:

/opt/apps/my-project/local/lib/python3.10/site-packages/

So, automake adds a “local” folder to the Python prefix and this can create a lot of problems because applications may not be able to find the required Python packages as before.

I assume that this is a bug and not something added to automake on purpose.

How reproducible:

100%

Steps to Reproduce:

1. Open a project which uses the GNU Build system and it contains Python code among other things e.g. C, C++ etc.

2. Run the configure command with the --with-python_prefix option and specify a directory prefix to install the Python modules. 

3. After doing the building and the installation of the project examine the directory which contains the Python modules to see that it is under a "local" path added to the specified Python prefix.

Actual results:

The installed Python modules will be under a "local" subdirectory under the Python prefix directory as %python-prefix/local/lib/python3.10/site-packages.

Expected results:

The installed Python modules will be under the specified Python prefix subdirectory which is %python-prefix/lib/python3.10/site-packages.

Additional info:

Fedora 35 and RHEL9 do not have this issue.

Comment 1 Frédéric Bérat 2022-06-09 15:00:45 UTC
After some investigation, it looks like the problem doesn't come from automake, but from a change in behavior from python:

python -c "import sysconfig
    import sys
    sitedir = sysconfig.get_path('purelib', vars={'base':'/builddir/build/tmp/build/inst/'})
    sys.stdout.write(sitedir)"

/builddir/build/tmp/build/inst/local/lib/python3.10/site-packages

Whereas, on f35:
python -c "import sysconfig 
    import sys  
    sitedir = sysconfig.get_path('purelib', vars={'base':'/builddir/build/tmp/build/inst/'})  
    sys.stdout.write(sitedir)"

/builddir/build/tmp/build/inst/lib/python3.10/site-packages

Comment 2 Miro Hrončok 2022-06-09 15:11:55 UTC
Yes, this is a bug but it will not be easy to fix. Read https://docs.fedoraproject.org/en-US/fedora/latest/release-notes/developers/Development_Python/#sect-install_scheme for some possible workarounds.

*** This bug has been marked as a duplicate of bug 2026979 ***