Skip to content

gh-89830: Show a better error message on failing to create a venv due to failing ensurepip#151262

Open
sepehr-rs wants to merge 5 commits into
python:mainfrom
sepehr-rs:fix-89830
Open

gh-89830: Show a better error message on failing to create a venv due to failing ensurepip#151262
sepehr-rs wants to merge 5 commits into
python:mainfrom
sepehr-rs:fix-89830

Conversation

@sepehr-rs

@sepehr-rs sepehr-rs commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@vsajip

vsajip commented Jun 10, 2026

Copy link
Copy Markdown
Member

I'm not sure if the original bug report is still valid:

/tmp  $ touch http.py ensurepip.py pip.py
/tmp  $ python3.10 -m venv .venv
/tmp  $ .venv/bin/pip --version
pip 23.0.1 from /tmp/.venv/lib/python3.10/site-packages/pip (python 3.10)

Can you reproduce the reported error in current Python main branch without your change?

@sepehr-rs

Copy link
Copy Markdown
Contributor Author

Can you reproduce the reported error in current Python main branch without your change?

Yes, you can reproduce it like this:

cd /tmp
mkdir -p shadow
echo 'raise ImportError("")' > shadow/http.py
PYTHONPATH=$(pwd)/shadow python -m venv .venv_fail

You should use a Python installation that has ensurepip enabled. I tested this with pyenv Python 3.10.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better error message on failing to create a venv due to failing ensurepip

2 participants