Bug 2059268

Summary: venv set up incorrectly: "Virtual environment creation failed, executable /tmp/build-env-9y6cy_l5/local/bin/python missing"
Product: [Fedora] Fedora Reporter: Tomas Tomecek <ttomecek>
Component: python-buildAssignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 36CC: lbalhar, mhroncok, python-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-build-0.7.0-3.fc37 python-build-0.7.0-3.fc36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-21 09:04:02 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 Tomas Tomecek 2022-02-28 16:06:50 UTC
Description of problem:
I am trying to build ansible-lint using Packit in Copr and running into this traceback:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/build/__main__.py", line 372, in main
    built = build_call(
  File "/usr/lib/python3.10/site-packages/build/__main__.py", line 202, in build_package
    out = _build(isolation, builder, outdir, distribution, config_settings, skip_dependency_check)
  File "/usr/lib/python3.10/site-packages/build/__main__.py", line 140, in _build
    return _build_in_isolated_env(builder, outdir, distribution, config_settings)
  File "/usr/lib/python3.10/site-packages/build/__main__.py", line 104, in _build_in_isolated_env
    with _IsolatedEnvBuilder() as env:
  File "/usr/lib/python3.10/site-packages/build/env.py", line 104, in __enter__
    executable, scripts_dir = _create_isolated_env_venv(self._path)
  File "/usr/lib/python3.10/site-packages/build/env.py", line 258, in _create_isolated_env_venv
    executable, script_dir, purelib = _find_executable_and_scripts(path)
  File "/usr/lib/python3.10/site-packages/build/env.py", line 303, in _find_executable_and_scripts
    raise RuntimeError(f'Virtual environment creation failed, executable {executable} missing')
RuntimeError: Virtual environment creation failed, executable /tmp/build-env-9y6cy_l5/local/bin/python missing

The command is: `python3 -m build --sdist --outdir dist`

There is a long, related discussion over here https://github.com/pypa/build/issues/215 which makes me ask you if python3 syspath in Fedora is patched in a way that python-build cannot create the venv correctly.

Full logs: https://download.copr.fedorainfracloud.org/results/packit/TomasTomecek-ansible-lint-1-stg/srpm-builds/03580890/builder-live.log.gz

code: https://github.com/TomasTomecek/ansible-lint/pull/1

Version-Release number of selected component (if applicable):
python3-build-0.7.0-2.fc36.noarch
python3-3.10.2-3.fc36.x86_64

Comment 1 Miro Hrončok 2022-03-02 17:20:33 UTC
Lumír asked me to pitch in, This is in fact very complicated.


As of today, this pull request would make it work https://github.com/pypa/build/pull/434


However, in Python upstream, core committers requested the installation scheme should not be named "venv" but rather "posix_venv" or "nt_venv" and the entire thing is taking longer than expected https://github.com/python/cpython/pull/31034


If you need this fixed ASAP, we can backport https://github.com/pypa/build/pull/434 as is and change it later.

If you can wait a few more days, I'd rather land the change in CPython first and then change https://github.com/pypa/build/pull/434 accordingly.

Comment 2 Tomas Tomecek 2022-03-03 14:22:17 UTC
Thank you for a clear response, Miro.

I can easily wait, mainly wanted to report this so the problem is tracked.

Comment 4 Miro Hrončok 2022-03-18 22:37:22 UTC
Before:

<mock-chroot> sh-5.1$ rpm -q python3-build
python3-build-0.7.0-2.fc36.noarch

<mock-chroot> sh-5.1$ python3 -m build --sdist --outdir dist
* Creating venv isolated environment...

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/build/__main__.py", line 372, in main
    built = build_call(
  File "/usr/lib/python3.10/site-packages/build/__main__.py", line 202, in build_package
    out = _build(isolation, builder, outdir, distribution, config_settings, skip_dependency_check)
  File "/usr/lib/python3.10/site-packages/build/__main__.py", line 140, in _build
    return _build_in_isolated_env(builder, outdir, distribution, config_settings)
  File "/usr/lib/python3.10/site-packages/build/__main__.py", line 104, in _build_in_isolated_env
    with _IsolatedEnvBuilder() as env:
  File "/usr/lib/python3.10/site-packages/build/env.py", line 104, in __enter__
    executable, scripts_dir = _create_isolated_env_venv(self._path)
  File "/usr/lib/python3.10/site-packages/build/env.py", line 258, in _create_isolated_env_venv
    executable, script_dir, purelib = _find_executable_and_scripts(path)
  File "/usr/lib/python3.10/site-packages/build/env.py", line 303, in _find_executable_and_scripts
    raise RuntimeError(f'Virtual environment creation failed, executable {executable} missing')
RuntimeError: Virtual environment creation failed, executable /tmp/build-env-e0y45nkh/local/bin/python missing

ERROR Virtual environment creation failed, executable /tmp/build-env-e0y45nkh/local/bin/python missing



After:

<mock-chroot> sh-5.1$ rpm -q python3-build
python3-build-0.7.0-3.fc37.noarch

<mock-chroot> sh-5.1$ python3 -m build --sdist --outdir dist
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools, wheel)
* Getting dependencies for sdist...
running egg_info
creating Pello.egg-info
writing Pello.egg-info/PKG-INFO
writing dependency_links to Pello.egg-info/dependency_links.txt
writing entry points to Pello.egg-info/entry_points.txt
writing requirements to Pello.egg-info/requires.txt
writing top-level names to Pello.egg-info/top_level.txt
writing manifest file 'Pello.egg-info/SOURCES.txt'
reading manifest file 'Pello.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE.txt'
writing manifest file 'Pello.egg-info/SOURCES.txt'
* Building sdist...
running sdist
running egg_info
writing Pello.egg-info/PKG-INFO
writing dependency_links to Pello.egg-info/dependency_links.txt
writing entry points to Pello.egg-info/entry_points.txt
writing requirements to Pello.egg-info/requires.txt
writing top-level names to Pello.egg-info/top_level.txt
reading manifest file 'Pello.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE.txt'
writing manifest file 'Pello.egg-info/SOURCES.txt'
running check
creating Pello-1.0.2
creating Pello-1.0.2/Pello.egg-info
creating Pello-1.0.2/pello
copying files to Pello-1.0.2...
copying LICENSE.txt -> Pello-1.0.2
copying MANIFEST.in -> Pello-1.0.2
copying README.md -> Pello-1.0.2
copying pyproject.toml -> Pello-1.0.2
copying setup.py -> Pello-1.0.2
copying Pello.egg-info/PKG-INFO -> Pello-1.0.2/Pello.egg-info
copying Pello.egg-info/SOURCES.txt -> Pello-1.0.2/Pello.egg-info
copying Pello.egg-info/dependency_links.txt -> Pello-1.0.2/Pello.egg-info
copying Pello.egg-info/entry_points.txt -> Pello-1.0.2/Pello.egg-info
copying Pello.egg-info/not-zip-safe -> Pello-1.0.2/Pello.egg-info
copying Pello.egg-info/requires.txt -> Pello-1.0.2/Pello.egg-info
copying Pello.egg-info/top_level.txt -> Pello-1.0.2/Pello.egg-info
copying pello/__init__.py -> Pello-1.0.2/pello
copying pello/__main__.py -> Pello-1.0.2/pello
copying pello/pello_greeting.py -> Pello-1.0.2/pello
Writing Pello-1.0.2/setup.cfg
Creating tar archive
removing 'Pello-1.0.2' (and everything under it)
Successfully built Pello-1.0.2.tar.gz

Comment 5 Fedora Update System 2022-03-21 09:02:36 UTC
FEDORA-2022-2e1d0517b8 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-2e1d0517b8

Comment 6 Fedora Update System 2022-03-21 09:04:02 UTC
FEDORA-2022-2e1d0517b8 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Fedora Update System 2022-03-21 09:34:47 UTC
FEDORA-2022-c216d3d080 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-c216d3d080

Comment 8 Fedora Update System 2022-03-21 15:49:43 UTC
FEDORA-2022-c216d3d080 has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-c216d3d080`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-c216d3d080

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2022-03-26 15:27:45 UTC
FEDORA-2022-c216d3d080 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.