- Notifications
You must be signed in to change notification settings - Fork 277
Description
Current Behavior (bug)
Tools other than Python (e.g. GNU Make) do not run inside the Python virtual environment. This is because the wrapper scripts in .devbox/virtenv/.wrappers/bin detect a mismatch in the shell environment hash and then reset the environment with devbox shellenv.
To reproduce:
- Run
devbox create --template python-pip - Run
cd python-pip - Run
devbox add gnumake@4.3 - Run
printf "which_python:\n\twhich python\n" > Makefile - Run
devbox generate devcontainer - Run
code . - In the popup window, click Reopen in Container
- Once the dev container is ready, open a terminal window and run
make which_python
The path shown is not to the Python virtual environment:
/code/.devbox/virtenv/.wrappers/bin/python
Expected Behavior (fix)
The output should show this path:
/code/.devbox/virtenv/python310Packages.pip/.venv/bin/python
Currently the shell environment hash mismatch occurs because devbox shell --print-env and devbox shellenv give slightly different results. The former includes __DEVBOX_VERSION_CHECK="1" and the latter does not. So, a (fragile) workaround is to modify the Dockerfile by changing
RUN devbox shellenv --init-hook >> ~/.profileto
RUN __DEVBOX_VERSION_CHECK="1" devbox shellenv --init-hook >> ~/.profileA proper solution would be to ensure that the shell and shellenv commands return identical environments.
Additional context
Output of devbox version -v:
Version: 0.5.4 Platform: linux_amd64 Commit: 92bb293af46fe6869648c20e4a6476dc83df0092 Commit Time: 2023-06-01T21:35:06Z Go Version: go1.20.4 Launcher: 0.2.0