'How to access predefined environment variables in conda environment.yml?
I wish to share an environment.yml file for others to reproduce the same setup as I have. The code we use depends on the environment variable $PWD. I wish to set a new env variable in the environment.yml where I can access $PWD.
for eg. I am able to do:
variables:
VAR1: something
but can't do
variables:
VAR1: $PWD/solution
where $PWD is set based on where the user has cloned the repo.
Also, how do I update predefined environment variables such as $PYTHONPATH?
variables:
PYTHONPATH: $PWD:$PYTHONPATH
doesn't work similarly.
Solution 1:[1]
I faced similar issue while accessing gitlab variables within environment.yml. I didnt find any solution on internet and finally i had to follow below in my gitlab-ci.yml's script section:
- create conda environment using yml file
- activate environment
- create variables using
conda env config vars set VAR=value
- deactivate environment
- activate environment
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ranu |