[issue37369] Issue with pip in venv on Powershell in Windows

miikama report at bugs.python.org
Tue Jun 16 09:40:45 EDT 2020


miikama <makelanmiika at gmail.com> added the comment:

Hi,

First time reporting so feel free to direct me to a better place if this is not the correct place :)

I am still facing the issue that started this thread with Python 3.8 and 3.9. 

Steps to reproduces
1. Clean install of Python 3.9.0b3 (quick install via .exe https://www.python.org/downloads/windows/)

2. create a python virtual environment in powershell

                       python -m venv env
or with absolute path: python -m venv C:\Users\<user>\<path>\env


3. activate virtual environment 

      .\env\Scripts\Activate.ps1

4. use pip

(env) PS C:\Users\<user>\<path> python --version
Python 3.9.0b3
(env) PS C:\Users\<user>\<path> pip --version
Fatal error in launcher: Unable to create process using '"c:\users\<user>\<path-in-lowercase>\env\scripts\python.exe"  "C:\Users\<user>\<path-in-lowercase>\env\Scripts\pip.exe" --version'

However, python and pip are installed in the env\Scripts\*

(env) PS C:\Users\<user>\<path> Get-Command python
python.exe 3.9.113 C:\Users\<user>\<path>\env\Scripts\python.exe

(env) PS C:\Users\<user>\<path> Get-Command pip
pip.exe 0.0.0.0 C:\Users\<user>\<path>\env\Scripts\pip.exe

But the pip module is not actually found by the python interpreter inside the virtual environment.

(env) PS C:\Users\<user>\<path> python -m pip --version
C:\Users\<user>\<path>\env\Scripts\python.exe: No module named pip





Notes:

1. the global pip installation works well and can be used to install packages

PS C:\Users\<user>\<path> pip --version
pip 19.2.3 from c:\users\<user>\appdata\local\programs\python\python39\lib\site-packages\pip (python 3.9)

2. Windows version: Microsoft Windows [Version 10.0.18363.836]

3. Powershell Version: 5.1.18362.752

4. Paths in a python interpreter started in the active env

(env) PS C:\Users\<user>\<path> python
>>> import sys,os

>>> sys.exec_prefix
'C:\\Users\\<user>\\<path>\\env'

>>> sys.base_prefix
'C:\\Users\\<user>\\AppData\\Local\\Programs\\Python\\Python39'

>>> sys.path
['', 'C:\\Users\\<user>\\AppData\\Local\\Programs\\Python\\Python39\\python39.zip', 'C:\\Users\\<user>\\AppData\\Local\\Programs\\Python\\Python39\\DLLs', 'C:\\Users\\<user>\\AppData\\Local\\Programs\\Python\\Python39\\lib', 'C:\\Users\\<user>\\AppData\\Local\\Programs\\Python\\Python39', 'C:\\Users\\<user>\\<path>\\env']

>>> import pip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pip'

quit()



I did not find more recent bugs related to this and wanted to bring the issue back to your attention. At least to me, based on the discussion here it seemed that the issue should have been fixed. Please let me know if you need any further input.

----------
nosy: +miikama
versions:  -Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37369>
_______________________________________


More information about the Python-bugs-list mailing list