This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Assertion error os.path.exists(pyc_path) while building Python 3.8.6 with-ensurepip
Type: behavior Stage: resolved
Components: Build Versions: Python 3.8
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, thoradia
Priority: normal Keywords:

Created on 2020-11-23 17:00 by thoradia, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg381680 - (view) Author: Thoradia Quack (thoradia) Date: 2020-11-23 17:00
I try building Python 3.8.6 with-ensurepip (see configuration below) but this fails with an assertion error (see error below).

I do not understand the error and I do not know how to fix it.

For what it is worth, I used to successfully build Python 3.8.5 with the same configuration.

Thank you for any help with this.

home/thoradia/9.80.8/build.LibreELEC-RPi4.arm-9.80-devel/build/Python3-3.8.6/configure --host=x86_64-linux-gnu --build=x86_64-linux-gnu --prefix=/home/thoradia/9.80.8/build.LibreELEC-RPi4.arm-9.80-devel/toolchain --bindir=/home/thoradia/9.80.8/build.LibreELEC-RPi4.arm-9.80-devel/toolchain/bin --sbindir=/home/thoradia/9.80.8/build.LibreELEC-RPi4.arm-9.80-devel/toolchain/sbin --sysconfdir=/home/thoradia/9.80.8/build.LibreELEC-RPi4.arm-9.80-devel/toolchain/etc --libexecdir=/home/thoradia/9.80.8/build.LibreELEC-RPi4.arm-9.80-devel/toolchain/lib --localstatedir=/home/thoradia/9.80.8/build.LibreELEC-RPi4.arm-9.80-devel/toolchain/var --disable-static --enable-shared ac_cv_prog_HAS_HG=/bin/false

if test "xupgrade" != "xno"  ; then \
	case upgrade in \
		upgrade) ensurepip="--upgrade" ;; \
		install|*) ensurepip="" ;; \
	esac; \
	LD_LIBRARY_PATH=/home/thoradia/9.80.8/build.LibreELEC-RPi4.arm-9.80-devel/build/Python3-3.8.6/.x86_64-linux-gnu ./python -E -m ensurepip \
		$ensurepip --root=/ ; \
Looking in links: /tmp/tmpm7whdxa4
Requirement already up-to-date: setuptools in /home/thoradia/9.80.8/build.LibreELEC-RPi4.arm-9.80-devel/toolchain/lib/python3.8/site-packages (49.2.1)
Processing /tmp/tmpm7whdxa4/pip-20.2.1-py2.py3-none-any.whl
Installing collected packages: pip
ERROR: Exception:
Traceback (most recent call last):
  File "/tmp/tmpm7whdxa4/pip-20.2.1-py2.py3-none-any.whl/pip/_internal/cli/", line 216, in _main
    status =, args)
  File "/tmp/tmpm7whdxa4/pip-20.2.1-py2.py3-none-any.whl/pip/_internal/cli/", line 182, in wrapper
    return func(self, options, args)
  File "/tmp/tmpm7whdxa4/pip-20.2.1-py2.py3-none-any.whl/pip/_internal/commands/", line 412, in run
    installed = install_given_reqs(
  File "/tmp/tmpm7whdxa4/pip-20.2.1-py2.py3-none-any.whl/pip/_internal/req/", line 82, in install_given_reqs
  File "/tmp/tmpm7whdxa4/pip-20.2.1-py2.py3-none-any.whl/pip/_internal/req/", line 813, in install
  File "/tmp/tmpm7whdxa4/pip-20.2.1-py2.py3-none-any.whl/pip/_internal/operations/install/", line 852, in install_wheel
  File "/tmp/tmpm7whdxa4/pip-20.2.1-py2.py3-none-any.whl/pip/_internal/operations/install/", line 734, in _install_wheel
    assert os.path.exists(pyc_path)
msg381681 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-11-23 17:13
Your problem could be related to --disable-pyc-build. It sounds like it disables pyc compilation, which may explain the exception.

--disable-pyc-build is not supported by official releases of Python. Are you building Python with additional distribution-specific patches?
msg381687 - (view) Author: Thoradia Quack (thoradia) Date: 2020-11-23 18:32
I get the same error when I build without -disable-pyc-build.

I could create the missing directory if only I knew what directory ensurepip is expecting.
msg381691 - (view) Author: Thoradia Quack (thoradia) Date: 2020-11-23 19:44
I build Python with the LibreELEC toolchain.
I removed the --disable-pyc-build and a patch to generate legacy bytecode.
That fixed the issue.
Thank you for the fast answer and for pointing me to the solution.
Date User Action Args
2022-04-11 14:59:38adminsetgithub: 86612
2020-11-23 19:44:03thoradiasetstatus: open -> closed

messages: + msg381691
stage: resolved
2020-11-23 18:32:39thoradiasetmessages: + msg381687
2020-11-23 17:13:33christian.heimessetnosy: + christian.heimes
messages: + msg381681
2020-11-23 17:00:36thoradiacreate