Tuesday, 18 February 2020

Conda Not Found!


Conda Not Found!


Conda is open-source and quite popular among the Python/R package manager.
Sometimes we got an issue with Conda when we want to activate the Conda environment.



Here is an example of error :


$ CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.



And the solution :


$ source ~/miniconda3/etc/profile.d/conda.sh


$ conda activate yourenv


Source script will reads and executes commands from filename in the current shell environment




From Bash man page (info source) :


. filename [arguments]
source filename [arguments]
       Read  and  execute  commands  from filename in the current shell
       environment and return the exit status of the last command  exe
       cuted from filename.  If filename does not contain a slash, file
       names in PATH are used to find the  directory  containing  file
       name.   The  file  searched  for in PATH need not be executable.
       When bash is  not  in  posix  mode,  the  current  directory  is
       searched  if no file is found in PATH.  If the sourcepath option
       to the shopt builtin command is turned  off,  the  PATH  is  not
       searched.   If any arguments are supplied, they become the posi
       tional parameters when  filename  is  executed.   Otherwise  the
       positional  parameters  are unchanged.  The return status is the
       status of the last command exited within the  script  (0  if  no
       commands  are  executed),  and false if filename is not found or
       cannot be read.



Reference:
https://github.com/conda/conda/issues/7980
https://superuser.com/questions/46139/what-does-source-do

No comments:

Post a Comment