Conda envs
Resolved 💬 5 comments Opened May 21, 2025 by michaelzehetleitner Closed Sep 3, 2025
💡 Likely answer: A maintainer (tibo-openai, collaborator)
responded on this thread — see the highlighted reply below.
Please excuse possible violations of etiquette...
Is it possible to activate a conda env in the codex terminal? I try to instruct it to use conda run -n but it mostly forgets.
I'd appreciate any suggestions.
Cheers,
MZ
5 Comments
Hi @michaelzehetleitner,
Hope you are doing fine,
What I usually do is activate my desired Conda environment before launching
Codex. Once the environment is activated, I run Codex from within that shell session, and it inherits the environment without issues.Then:
Let me know if that helps or if you're running into something different!
Cheers,
Ansh
Thanks for your response and ideas. This is what I tried:
There is my base environment with python version 3.12. Then I activate the environment I want to use with codex. Then python version is 3.10, as it should be. Then I activate codex and ask it for its python version. It executes
and gives version 3.7.6.
My next try was to instruct codex to activate my intended env. It executes:
Then python version within codex still is 3.7.6.
I have the same problem. Codex doesn't run the desired python in the conda env
Closing this as out of date, please re-file an issue if still relevant, thanks!
I belive codex runs every bash command in a new shell intstance, so if you want to haave codex execute e.g. unit tests in your conda env you can include instrucctions in the agents.md to execute something like
pwsh -NoLogo -Command 'conda.exe run -n "environment name" python "python_filename.py"
Replace the values in "" with your actual environment name and an example .py file from your project.