DanielBell99
DanielBell99

Reputation: 1927

conda in Git Bash but WSL 2 conda: command not found

Goal: get conda working in WSL 2.

conda works in Git Bash, but not in WSL 2.

Anaconda3:

C:\Users\dabell\Anaconda3

WSL 2:

danielbellhv@PF2DCSXD:/$ cat ~/.bashrc
. /c/Users/dabell/Anaconda3/etc/profile.d/conda.sh
. "C:/Users/dabell/Anaconda3/etc/profile.d/conda.sh"
export PATH="C:/Users/dabell/Anaconda3/condabin:$PATH"
danielbellhv@PF2DCSXD:/$ conda info
conda: command not found
danielbellhv@PF2DCSXD:/$ conda init
conda: command not found
danielbellhv@PF2DCSXD:/$ ./anaconda3/Scripts/conda.exe init
bash: ./anaconda3/Scripts/conda.exe: No such file or directory
danielbellhv@PF2DCSXD:/$ export PATH=~/anaconda/bin:$PATH
danielbellhv@PF2DCSXD:/$ conda info
conda: command not found

Git Bash:

HDS+dabell@PF2DCSXD MINGW64 ~
$ conda info

     active environment : base
    active env location : C:\Users\dabell\Anaconda3
            shell level : 1
       user config file : C:\Users\dabell\.condarc
 populated config files :
          conda version : 4.12.0
    conda-build version : 3.21.8
         python version : 3.9.12.final.0
       virtual packages : __win=0=0
                          __archspec=1=x86_64
       base environment : C:\Users\dabell\Anaconda3  (writable)
      conda av data dir : C:\Users\dabell\Anaconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/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
          package cache : C:\Users\dabell\Anaconda3\pkgs
                          C:\Users\dabell\.conda\pkgs
                          C:\Users\dabell\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\dabell\Anaconda3\envs
                          C:\Users\dabell\.conda\envs
                          C:\Users\dabell\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.9.12 Windows/10 Windows/10.0.19041
          administrator : True
             netrc file : None
           offline mode : False

(base)
HDS+dabell@PF2DCSXD MINGW64 ~
$ cat ~/.bashrc
. /c/Users/dabell/Anaconda3/etc/profile.d/conda.sh
(base)

Upvotes: 0

Views: 1394

Answers (1)

margusl
margusl

Reputation: 17334

To use conda in WSL you first have to install it in WSL, Windows & Linux, even in WSL, still require two separate conda installations. You'll probably encounter less issues if you pick miniconda for WSL, export your existing conda evironment(s) in Windows:

(geopy) PS C:\> conda env export --from-history > environment.yml

And use the resulting environment.yml file(s) to re-create it/those in WSL:

$ conda env create -f environment.yml

Upvotes: 1

Related Questions