Windows Subsystem for Linux – conda: command not found

Question:

I’m using Windows 10 and recently installed Windows Subsystem for Linux.
Anaconda was already installed on my PC at that point.

When I try to run conda commands on Bash on Ubuntu on Windows I get the following error:

$ conda conda: command not found

Other related answers, such as this or this suggest adding

C:Users«user»Anaconda3Scripts
C:Users«user»Anaconda3

to $PATH. But as you can see below, both are already included (I didn’t add them manually):

$ echo $PATH | tr ':' 'n'
...
/mnt/c/Users/«user»/Anaconda3
/mnt/c/Users/«user»/Anaconda3/Scripts
/mnt/c/Users/«user»/Anaconda3/Library/bin
...

The following conda files are available in Anaconda3/Scripts:

conda.exe
conda-env.exe
conda-env-script.py
conda-script.py
conda-server.exe
conda-server-script.py

The commands work just fine in both PowerShell and cmd.

What am I missing?

[EDIT]: Corrected second URL and changed user to < user > in Anaconda3 paths above.

Asked By: Marco

||

Answers:

Try to run conda.exe instead of conda.

Windows assume .exe marks a file as executable, and ignores that extension when looking for the binary. Linux uses a flag, so any file can be an executable, and you need to provide the full name because there is no assumption on the extension.

Answered By: Poshi

Run conda init

.anaconda3/bin/conda init 
.miniconda/bin/conda init
Answered By: Gokulakrishnan

To add conda to Windows Subsystem Linux, this is the correct way:

curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
export PATH=$PATH:/miniconda3/bin

You will need to restart WSL for the env path to work.

Answered By: Cale McCollough