For convenience and given that activate
-ing an environment is crazy slow, I want to activate an environment and then start a tmux
session.
I want all new tmux
windows to also have the environment activated.
I want different tmux
sessions to be able to support different anaconda environments.
How do I go about this?
Are there any gotchas such that this isn't supported by anaconda
/ miniconda
?
If you receive this warning, you need to activate your environment. To do so on Windows, run: c:\Anaconda3\Scripts\activate base in Anaconda Prompt. Windows is extremely sensitive to proper activation.
Reload Window from Command Palette, select base:conda as python interpreter then press Ctrl+Shift+` to open a new integrated Terminal, conda environment should be activated automatically in it.
To activate your Conda environment, type source activate <yourenvironmentname> . Note that conda activate will not work on Discovery with this version. To install a specific package, type conda install -n <yourenvironmentname> [package] . To deactivate the current, active Conda environment, type conda deactivate .
What I've done to address this problem is:
.tmux.conf
, copy CONDA_DEFAULT_ENV
environment variable to session environment
set-option -ga update-environment 'CONDA_DEFAULT_ENV'
.bashrc
, reactivate the conda environment if one was activated:
if [ -n "$CONDA_DEFAULT_ENV" ]; then
__conda_reactivate
fi
Note 1: this assumes that __conda_reactivate
is available because of conda init
or similar.
Note 2: in older versions of conda, it's _conda_reactivate
(just one leading underscore).This is faster than conda activate <env>
and also different environments can be used before creating different tmux sessions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With