Python: Support for conda environments
Hello,
I am trying to run configurations for my Python projects in TeamCity. Our projects are using conda to create virtual environments.
We created our own Dockerfile for the TeamCity Buildagent (so that it has conda installed). We also created a Commandline-step to load the environment, update dependencies etc.
After that we are running a Python step (for pytest) with "custom python" pointing to our conda installation (which contains python and pip, which TeamCity calls to download the testreporting-tool etc.).
When connecting to the container via SSH, conda works fine and we are able to activate environments and do other stuff, but when running steps through TeamCity, we get a message like the following:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- cmd.exe
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
I'm sure we will figure out what to do and how to get it running, but I wanted to ask if there are any plans to support conda environments?
When creating a Python Step, it's possible to select between various other environment-tools.
With a selection for "conda environment" in that list, TeamCity could scan for a environment.yml and there would be no need to run Commandline-steps before using a Python step.
Does that make sense?
Please sign in to leave a comment.
We have a feature request on the topic: https://youtrack.jetbrains.com/issue/TW-68153/Python-runner.-Consider-supporting-other-python-dependency-environment-managers-conda-poetry. Please consider voting or commenting on it as you see fit.
Thank you, I will do that!