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: Ensurepip fails to install pip into a nested virtual environment (on Windows)
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.7
Status: closed Resolution: duplicate
Dependencies: Superseder: Creating venv from venv no longer works in 3.7.2
View: 35872
Assigned To: Nosy List: Sammy Gillespie, paul.moore, steve.dower, tim.golden, xtreak, zach.ware
Priority: normal Keywords:

Created on 2019-02-22 15:19 by Sammy Gillespie, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg336322 - (view) Author: Sammy Gillespie (Sammy Gillespie) Date: 2019-02-22 15:19
Running Windows 10 Enterprise. Create a virtual environment:

> python -m venv .venv

Activate that virtual environment and attempt to create another virtual environment using the same command.

This new environment will not contain pip (or anything other than just Python).

Investigating this further. Running:

> python -Im ensurepip --upgrade --default-pip

from within the second virtual environment results in:

> Requirement already up-to-date: pip in <path_to_FIRST_venv>


I want to create a python tool that will build a virtual env, but this restricts me from being able to install that tool into a virtual env (e.g. using pipx).
msg336323 - (view) Author: Sammy Gillespie (Sammy Gillespie) Date: 2019-02-22 15:35
To expand on this. Using:

> python -m pip

in the second virtual environment (which does not have pip) gives the following usage example:

> Usage:
>     C:\venv_test\<VENV_1>\Scripts\python.exe -m pip <comand> [options]

Yet the python running this command is not in venv_1, it is in venv_2.

So the issue appears to lie with how pip determines its python location. So this issue may be more suited there.
msg336324 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-02-22 15:38
Is this similar to issue35872? Can you please specify the full version of Python as in 3.7.0 or later?
msg336325 - (view) Author: Sammy Gillespie (Sammy Gillespie) Date: 2019-02-22 15:42
This is identical to

I am running 3.7.2
Date User Action Args
2022-04-11 14:59:11adminsetgithub: 80261
2019-02-24 10:39:07eryksunsetsuperseder: Creating venv from venv no longer works in 3.7.2
2019-02-22 16:37:49Sammy Gillespiesetstatus: open -> closed
resolution: duplicate
stage: resolved
2019-02-22 15:42:12Sammy Gillespiesetmessages: + msg336325
2019-02-22 15:38:34xtreaksetnosy: + paul.moore, tim.golden, xtreak, zach.ware, steve.dower
messages: + msg336324
components: + Windows
2019-02-22 15:35:41Sammy Gillespiesetmessages: + msg336323
2019-02-22 15:19:41Sammy Gillespiecreate