0

I have a conda environnment in /opt/anaconda3/envs.

I would like to add/remove some paths automatically at conda activate/deactivate.

In envs/myenv/etc/conda/activate.d/env_vars.sh I have:

export OLD_BOOST_ROOT=$BOOST_ROOT
export BOOST_ROOT=/opt/anaconda3/envs/myenv
export OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/some/path:$LD_LIBRARY_PATH

and in deactivate.d/env_vars:

export BOOST_ROOT=$OLD_BOOST_ROOT
export LD_LIBRARY_PATH=$OLD_LD_LIBRARY_PATH
unset OLD_LD_LIBRARY_PATH
unset OLD_BOOST_ROOT

At conda activate, no problem but at conda deactivate, I get:

» : identifiant non valableRY_PATH
» : identifiant non valableOT

What is my error? Thanks.

dagnic
  • 137
  • 10
  • 1
    I don't understand how your Conda environment could have picked up those DOS line feeds but it's pretty clear that that's the problem. Probably check if your login shell's configuration file has been edited with a Windows editor. (Then delete Windows. You can thank me later.) – tripleee Mar 05 '21 at 07:13
  • 1
    Indeed, that was the problem. Thanks. I remove the file and type it again in vim. – dagnic Mar 05 '21 at 07:20
  • Also might want to check out https://stackoverflow.com/a/62508395/570918 (i.e., you don't need (de)activate scripts for managing environment variables) – merv Mar 06 '21 at 00:50

0 Answers0