Search code examples
bashcondagit-bashmingw-w64msys2

Changes associated with Git Bash and activating conda env


When activating my conda environment in Git Bash (mingw64) by running source activate myenv, I've noticed some odd changes.

For example:

  • The ls -l command is the equivalent of just ls

    • I am unable to see permissions on each file or any other info that is expected from ls -l
  • Bash scripts that work in base environment no longer work after activating my conda environment

    • Simple things like running for loops using seq doesn't work
    • Commands to convert datetime to integer dates no longer work

Does activating a conda env change something regarding bash shell?

UPDATE: Tried using conda activate myenv per merv's suggestion. It didn't work initially since I had never used it. After running conda init, I was able to activate my environment using conda activate myenv. I was also able to deactivate my env -- which was something I was having trouble with before.

The issues I have, however, are not remedied with conda activate. The ls -l command still does not output correctly.

Here is the output of conda info. Name of the env is actually eda.:

$ conda info

         active environment : eda
        active env location : C:\Users\user\AppData\Local\Continuum\anaconda3\envs\eda
                shell level : 2
           user config file : C:\Users\user\.condarc
     populated config files : C:\Users\user\.condarc
              conda version : 4.6.8
        conda-build version : 3.17.6
             python version : 3.7.1.final.0
           base environment : C:\Users\user\AppData\Local\Continuum\anaconda3  (writable)
               channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                              https://repo.anaconda.com/pkgs/main/noarch
                              https://repo.anaconda.com/pkgs/free/win-64
                              https://repo.anaconda.com/pkgs/free/noarch
                              https://repo.anaconda.com/pkgs/r/win-64
                              https://repo.anaconda.com/pkgs/r/noarch
                              https://repo.anaconda.com/pkgs/msys2/win-64
                              https://repo.anaconda.com/pkgs/msys2/noarch
                              https://conda.anaconda.org/bokeh/win-64
                              https://conda.anaconda.org/bokeh/noarch
                              https://conda.anaconda.org/conda-forge/win-64
                              https://conda.anaconda.org/conda-forge/noarch
              package cache : C:\Users\user\AppData\Local\Continuum\anaconda3\pkgs
                              C:\Users\user\.conda\pkgs
                              C:\Users\user\AppData\Local\conda\conda\pkgs
           envs directories : C:\Users\user\AppData\Local\Continuum\anaconda3\envs
                              C:\Users\user\.conda\envs
                              C:\Users\user\AppData\Local\conda\conda\envs
                   platform : win-64
                 user-agent : conda/4.6.8 requests/2.21.0 CPython/3.7.1 Windows/10 Windows/10.0.14393
              administrator : True
                 netrc file : None
               offline mode : False

Solution

  • I had the same issue with conda activate and running

    echo '. ${HOME}/.bash_profile' >> ~/.bashrc
    

    in Git bash helped. After that, you need to insert

    auto_activate_base: false
    

    in your .condarc file, restart your Git bash terminal, and you should have it running, without any environment activated automatically. (At least I had to use various environments and didn't want base to be active on opening the terminal) I wonder if this helps?

    I used https://askubuntu.com/questions/1114257/why-does-base-appear-in-front-of-my-terminal-prompt-ii