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+uvfor fast installspoethepoetfor CLI tasks
- Two installation attempts:
uv syncpip install .
Problems Encountered
1. .venv disappears in Codex tasks
- After
uv sync, a.venvis created and visible in the “Environments > Edit” preview. - However, in a new Codex task, that
.venvis not present anymore — resulting in failed imports or missing commands.
2. poe commands not found during execution
- When installing with
pip install ., mypoecommands (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 syncandpip install . - Ensuring
.venvis committed and available - Manually adding
.venv/binto$PATHviapostCreateCommand - Confirming
poeworks 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
uvin 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 (
).