Marco
Marco

Reputation: 363

Windows Subsystem for Linux - conda: command not found

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»\Anaconda3\Scripts
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.

Upvotes: 7

Views: 29133

Answers (5)

Pedram Porbaha
Pedram Porbaha

Reputation: 131

This code worked for me:

source ~/anaconda3/etc/profile.d/conda.sh

and then I don't have need to write coda.exe instead of conda

Upvotes: 2

ved agrawal
ved agrawal

Reputation: 41

First start new terminal, Run
cd

now, travel to
home/{your user name}/anaconda3/bin

next run
,

./conda

if you get this output, usage: conda [-h] [--no-plugins] [-V] COMMAND ...

Run this and your problem must be solved, ./conda init

Upvotes: 4

Cale McCollough
Cale McCollough

Reputation: 360

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.

Upvotes: 2

Gokulakrishnan
Gokulakrishnan

Reputation: 137

Run conda init

.anaconda3/bin/conda init 
.miniconda/bin/conda init

Upvotes: 8

Poshi
Poshi

Reputation: 5762

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.

Upvotes: 21

Related Questions