AcademySoftwareFoundation / AcademySoftwareFoundation/rez
Unable to Find `pip` From Available Packages on Windows
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 374
- Avg merge
- 9d 12h
- Merged PRs (30d)
- 5
Description
When trying to `rez pip` install a package on Windows, rez is unable to locate `pip` in either of the `python` or `pip` packages that are available. Rez falls back to using the version of `pip` supplied in it's own virtual env.
```
15:40:37 DEBUG Failed to get pip from package python
15:40:37 DEBUG
15:40:37 DEBUG Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'c:\users\administrator\packages\python\3.9.1\platform-windows\arch-amd64\os-windows-10.0.17763.sp0\bin\python.exe'
isolated = 0
environment = 0
user site = 0
import site = 1
sys._base_executable = 'c:\\users\\administrator\\packages\\python\\3.9.1\\platform-windows\\arch-amd64\\os-windows-10.0.17763.sp0\\bin\\python.exe'
sys.base_prefix = 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python39'
sys.base_exec_prefix = 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python39'
sys.platlibdir = 'lib'
sys.executable = 'c:\\users\\administrator\\packages\\python\\3.9.1\\platform-windows\\arch-amd64\\os-windows-10.0.17763.sp0\\bin\\python.exe'
sys.prefix = 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python39'
sys.exec_prefix = 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python39'
sys.path = [
'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python39\\python39.zip',
'.\\DLLs',
'.\\lib',
'c:\\users\\administrator\\packages\\python\\3.9.1\\platform-windows\\arch-amd64\\os-windows-10.0.17763.sp0\\bin',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x000009f4 (most recent call first):
...
15:48:39 WARNING Found no pip in any python and/or pip rez packages!
15:48:39 WARNING Falling back to pip installed in rez own virtualenv:
15:48:39 WARNING pip: 20.2.3 (c:\rez\2.72.0\lib\site-packages\pip\__init__.py)
15:48:39 WARNING python: 3.9.1 (c:\rez\2.72.0\scripts\python.exe)
```
The error comes when rez tries to determine the version of `pip` by running `c:\\users\\administrator\\packages\\python\\3.9.1\\platform-windows\\arch-amd64\\os-windows-10.0.17763.sp0\\bin\\python.exe -E -s -c "import pip, sys; sys.stdout.write(pip.__version__)"`.
Both of the python and pip packages where created using `rez bind` and so I assume that there is something deficient in the way these packages were created, although I haven't been able to determine what. Omitting the `-E` flag to `python.exe` results in the correct behavior.
Contributor guide
Research direction
Start by reproducing the `rez pip` lookup on Windows with packages created by `rez bind`, then inspect the pip-version command that runs `python.exe -E -s -c "import pip, sys; sys.stdout.write(pip.__version__)"`. Done means pip is found from the available `python` or `pip` package on Windows without relying on Rez's own virtualenv, while preserving the reported behavior of the bound packages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100