Conda commands not working in Windows Subsystem for Linux (WSL) - windows

I installed Anaconda3 in my windows environment and added
C:\Users\user\Anaconda3\Scripts
C:\Users\user\Anaconda3
to my windows environmental variables. Theoretically, this should also update my path in WSL like it does with visual studio code. However it didn't and now I can't run conda commands from the ubuntu terminal. I can't figure out how to fix this...thanks!
*It should be noted that I am also using zsh and oh my zsh by running the code
# Launch Zsh
if [ -t 1 ]; then
exec zsh
fi
Inside my bashrc file

I had a similar problem. The issue was, that I had installed conda for windows and it seems it doesn't run fine with wsl. Try downloading and installing conda for ubuntu from the wsl command line interface and add the folders to the path. It worked for me.
This link helped me download conda from wsl command life interface.

If path not added, export PATH="/Users/username/anaconda/bin:$PATH" to your .zsh_config file.
This link may help you
Zsh: Conda/Pip installs command not found

Related

Macbook pro M1 command not found after oh my zsh

I have anaconda installed in my computer and after installing Oh my zsh. Conda and python etc. command is not found.
zsh: command not found: conda
How can I fix this? It seems that the solutions I can find on the internet is a bit outdated.
It depends on how you installed it. You'll need to check your PATH variable, and compare against what you had in the original .zshrc file. You can then add it back like so
PATH="<PATH_TO_DIR_CONTAINING_CONDA:$PATH"

"conda: command not found", Bash on Windows

I have installed Bash for windows by activating the Windows Subsystem for Linux and installing Ubuntu and when I installed Anaconda I selected the "Add Anaconda to my PATH environment variable" setting, so I do not believe there are any issues with PATH.
What I see in my Edit environment variables window is:
C:\Users\user\anaconda3
C:\Users\user\anaconda3\Library\mingw-w64\bin
C:\Users\user\anaconda3\Library\usr\bin
C:\Users\user\anaconda3\Library\bin
C:\Users\user\anaconda3\Scripts\
In Bash, when I enter something such as conda info --base I get conda: command not found
However, when I run the same command in Git Bash, it runs just fine.
From within git bash, you can type, command -v conda, as it will output the location to the executable. Add the directory to your PATH environment variable.
Eg from within git bash:
$ command -v my_command
/c/path/to/bin/my_command
Then prefix the value with /mnt and add it all: /mnt/c/path/to/bin to your PATH environment variable. And reopen your bash shell.
you can:
use git-bash / PowerShell / CMD for Anaconda
use Windows Terminal for easily using multiple shells
modify ~/.profile to include the Anaconda folders to PATH. /mnt/c/Users/user/Anaconda3...
NB you may experience issues with file paths or output
in advance, you could check the output of echo "${PATH//:/$'\n'}" | grep -i conda in a new session of bash
because typically, Windows and WSL should have already configured this for you
install Anaconda on WSL following official Linux instructions for your distro
if unsure which distro, it's likely Ubuntu. so instructions for Debian, the parent of Ubuntu
WSL is a complete Linux virtual machine and not your best bet for running (cli) software that you installed on Windows. you can but i would personally prefer installing the Linux version in WSL.

Command 'python' not found inside conda environment

I am using Ubuntu 20.04 WSL on MS Windows 10. I installed anaconda from the homepage (https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh) and tried to create a new environment as the following image.
As you can see, I just create a new environment and switch to that, and I found no Python command.
I did echo $PATH and got
/home/my_username/anaconda3/envs/test/bin:/home/my_username/anaconda3/condabin:
at the beginning of the PATH already.
How could I fix the problem? Thanks
I found the issue
When creating a new environment, we need to specify the version of Python
conda create -n test python=3.8

What is the Windows equivalent of this Linux command to create a virtual environment with Anaconda?

I am new to using the Terminal and in my homework assigment i have to create a virtual environment for the class with Python = 3.6.1 running this:
conda create -n cs7643 python=3.6.1 anaconda
conda activate cs7643
I have windows and this doesn't work.
Does anyone know the equivalent? Thanks
To be able to use the conda command you need to have anaconda installed on the machine. Check to make sure you have anaconda installed. Do you see this on Windows?
See the getting started if you have issues.
https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html
To create the environment there are 2 ways, one is to use the GUI and second is to use the terminal/command line.
See the following for creating the workspace.
https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands

Anaconda Environment in prompt/PS1 in MacOS?

When I was in Ubuntu installing Anaconda and activating a virtual environment modified my prompt to look like that:
(current-env)user#machine:dir
or as you define in .bashrc.
Now that I installed Anaconda in MacOS my prompt remain the same. I tried to configure that from Anaconda doing:
conda config --set changeps1 no
but nothing changed.
How can I modify my .bash_profile to have the current environment in PS1?
I managed to have that changing my shell from bash to zsh.
You can install zsh from here.
In recent versions, Conda has provided automated configuration for a number of shells via the conda init command. This command will edit relevant .*rc files to enable such features of PS1 change. Please see conda init --help for details.

Resources