I am using ubuntu 18 with anaconda for python 3.6 and trying to update packages, when I try to do so using
conda update --all
I am getting this error
conda: error: argument command: invalid choice: '/home/user/anaconda3/bin/conda'
I tried so solve it like explained in this github issue
using
$ conda update anaconda-navigator
$ conda update navigator-updater
But getting the same error. I tried adding -c conda-forge to all the commands And tried using conda update anaconda conda upgrade anaconda
and getting the same error all the time.
Here is my github issue on this
Thanks!
update: even when trying to use this to install anaconda-clean and removing anaconda, I am getting the same error when trying to install conda-clean that should help me remove anaconda from my machine
The issue of Conda yielding unexpected errors across different environments is well-known. Often, the default settings clash with one's own, or if self-configured, an incorrect path may have been set in one's shell configuration file (in my case, for instance, the ~/.zshrc
file).
One could meticulously analyze the causes, set the correct path, and then restart the shell (for zsh
, this would be executed via zsh -l
).
Quick solution
However, if you're in a hurry and wish to make all the necessary configurations later, a more expedient solution exists on Linux-based systems; you can simply try the following:
source activate <env-name>
Understanding the issues
Upon initializing Conda, it would also be prudent to specify the name of one's own shell, such as
conda init zsh
Subsequently, a list of system modifications will be displayed:
no change /opt/homebrew/anaconda3/condabin/conda
no change /opt/homebrew/anaconda3/bin/conda
no change /opt/homebrew/anaconda3/bin/conda-env
no change /opt/homebrew/anaconda3/bin/activate
no change /opt/homebrew/anaconda3/bin/deactivate
no change /opt/homebrew/anaconda3/etc/profile.d/conda.sh
no change /opt/homebrew/anaconda3/etc/fish/conf.d/conda.fish
no change /opt/homebrew/anaconda3/shell/condabin/Conda.psm1
no change /opt/homebrew/anaconda3/shell/condabin/conda-hook.ps1
no change /opt/homebrew/anaconda3/lib/python3.11/site-packages/xontrib/conda.xsh
no change /opt/homebrew/anaconda3/etc/profile.d/conda.csh
modified /Users/<username>/.zshrc # <--- ADDITONAL CHANGES
Upon inspection here, one would discover this entry.
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/homebrew/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/homebrew/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/opt/homebrew/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
After restarting one's own shell (as previously mentioned, with zsh -l
where -l
stands for load), the command
conda activate <env-name>
should then operate as desired.
In conclusion, a brief summary:
conda init <shell-name> # e.g., zsh or bash
If it is zsh, then
zsh -l
conda create --name <env-name> python=3
conda env list
An example would be:
base /opt/homebrew/anaconda3
codellama * /opt/homebrew/anaconda3/envs/codellama
llama2 /opt/homebrew/anaconda3/envs/llama2
The *
indicates that codellama
is currently active
conda activate <env-name>
This should function without any issues.
I had the same issue, just run
conda init
Saved me after one whole hour of troubleshooting. Turns out my C:\Users\**\miniconda3\Scripts\activate
and C:\Users\**\miniconda3\Scripts\deactivate
weren't updated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With