Description
I’m working in OpenAI Codex and having trouble getting my Python environment to behave consistently across the “Environments > Edit” preview and actual task execution. Below are the key details and symptoms:
Environment Setup
- Using Python 3.12
- Environment defined in a Devcontainer
- Project dependencies managed using:
pyproject.toml
+uv
for fast installspoethepoet
for CLI tasks
- Two installation attempts:
uv sync
pip install .
Problems Encountered
1. .venv
disappears in Codex tasks
- After
uv sync
, a.venv
is created and visible in the “Environments > Edit” preview. - However, in a new Codex task, that
.venv
is not present anymore — resulting in failed imports or missing commands.
2. poe
commands not found during execution
- When installing with
pip install .
, mypoe
commands (e.g.,poe lint
) are available and listed in the preview. - But when running a Codex task like
poe lint
, it errors with:
bash: poe: command not found
→ Indicates that the actual task shell isn’t picking up the environment.
3. Wrong Python version when running tasks
- Despite setting Python 3.12 explicitly and it showing correctly in “Environments > Edit”, a task asking for the Python version with:
python --version
Returns:
Python 3.11.12
→ Suggests either the environment isn’t being activated or an internal fallback is being used.
What I Tried
- Switching between
uv sync
andpip install .
- Ensuring
.venv
is committed and available - Manually adding
.venv/bin
to$PATH
viapostCreateCommand
- Confirming
poe
works inside the container manually, but not inside Codex tasks - Using
"Use This"
on the configured environment
My Questions
- Any steps to activate the environment for tasks that I forgot to execute?
- What’s the underlying cause to have the Python version mismatch and how to fix this?
- How to properly build an environment based on
uv
in Codex? - Is there a way to enforce environment activation like
source .venv/bin/activate
? Adding this explicitly in the environment setup didn’t work either.
I assume issues like this would be resolved by allowing custom image uploads, but since that’s not yet possible, Codex is currently unusable for my work ().