pipx
pipx copied to clipboard
run a simple test.py into separate environments but in the same folder.
The request error even is included I try to run a simple test.py into separate environments but in the same folder. But the first one named pyos give me errors.
This is an example I used:
` C:\PythonProjects\kaitai_001>python -m pipx list --include-injected venvs are in C:\Users\catafest\AppData\Local\pipx\pipx\venvs apps are exposed on your $PATH at C:\Users\catafest.local\bin manual pages are exposed at C:\Users\catafest.local\share\man package pyos 0.8.0, installed using Python 3.12.1 - psh.exe - pyos.exe Injected Packages: - test-py 0.3
C:\PythonProjects\kaitai_001>python -m pipx run --spec pyos python test.py
⚠️ python is already on your PATH and installed at C:\Python312\python.EXE. Downloading and running anyway.
Traceback (most recent call last):
File "C:\PythonProjects\kaitai_001\test.py", line 9, in
C:\PythonProjects\kaitai_001>python -m pipx inject pyos requests injected package requests into venv pyos done! ✨ 🌟 ✨
C:\PythonProjects\kaitai_001>python -m pipx run --spec pyos python test.py
⚠️ python is already on your PATH and installed at C:\Python312\python.EXE. Downloading and running anyway.
Traceback (most recent call last):
File "C:\PythonProjects\kaitai_001\test.py", line 9, in
C:\PythonProjects\kaitai_001>python -m pipx list --include-injected venvs are in C:\Users\catafest\AppData\Local\pipx\pipx\venvs apps are exposed on your $PATH at C:\Users\catafest.local\bin manual pages are exposed at C:\Users\catafest.local\share\man package pyos 0.8.0, installed using Python 3.12.1 - psh.exe - pyos.exe Injected Packages: - requests 2.31.0 - test-py 0.3 `
How to reproduce
` python -m pipx --verbose environment Environment variables (set by user):
PIPX_HOME= PIPX_BIN_DIR= PIPX_MAN_DIR= PIPX_SHARED_LIBS= PIPX_DEFAULT_PYTHON= USE_EMOJI=
Derived values (computed by pipx):
PIPX_HOME=C:\Users\catafest\AppData\Local\pipx\pipx PIPX_BIN_DIR=C:\Users\catafest.local\bin PIPX_MAN_DIR=C:\Users\catafest.local\share\man PIPX_SHARED_LIBS=C:\Users\catafest\AppData\Local\pipx\pipx\shared PIPX_LOCAL_VENVS=C:\Users\catafest\AppData\Local\pipx\pipx\venvs PIPX_LOG_DIR=C:\Users\catafest\AppData\Local\pipx\pipx\Logs PIPX_TRASH_DIR=C:\Users\catafest\AppData\Local\pipx\pipx\trash PIPX_VENV_CACHEDIR=C:\Users\catafest\AppData\Local\pipx\pipx\Cache PIPX_DEFAULT_PYTHON=C:\Python312\python.exe USE_EMOJI=true `
Expected behavior
To run the test.py when I run this command :
python -m pipx run --spec pyos python test.py
From the docs for pipx run:
Download the latest version of a package to a temporary virtual environment, then run an app from it. The environment will be cached and re-used for up to 14 days.
It seems you have installed pyos once via pipx install, and injected requests into it. I don't think pipx run will use that installed pyos application, but instead load a separate one, as pipx run is supposed to be used ephemerally. This ephemeral one won't have requests injected.
Can you try invoking one of the executables exposed by pyos directly, instead of going through pipx run?