Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MohamedKari/429efbdec07edd84a0879f466544acc1 to your computer and use it in GitHub Desktop.
Save MohamedKari/429efbdec07edd84a0879f466544acc1 to your computer and use it in GitHub Desktop.

Conda Env Management

tested on MacOS

Alternative 1: Create conda-env command by command

Ensure anaconda is in your path env variable, e.g. /usr/local/anaconda3/bin after default-installing with brew.

Create the env and install dependencies.

conda create -p ./conda-env python=3.7
conda install -p ./conda-env/ anaconda

Use the following command to activate the env (in contrast to conda activated which requires conda init which seems to require some global shell sourcing.

source activate ./conda-env

When executing the above, the following happens: source executes a shell script within the caller shell. The script to be executed is activate. The activate script is provided by conda and is located somewhere in the PATH (e. g. which activate yields /usr/local/anaconda3/bin/activate). ./conda-env is passed as an argument to conda's activate script. Note that this is differently from how for example venv activates environments. There, we actually source the activate script from inside the environment (source my_venv/bin/activate) instead of reyling on a globally installed and PATH-populated activate script.

Execute within the env

pip install 'tensorflow>=2.1.0'

Alternative 2: Create conda-env by environment.yml

conda env create -p ./conda-env -f environment.yml

with environment.yml

name: waymo-od-perception-env
dependencies:
  - python=3.7
  - anaconda
  - pip
  - pip:
    - tensorflow>=2.1.0

After possibly modifying the dependencies in environment.yml, run

conda env update .p ./conda-env -f environment.yml --prune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment