I am using ubuntu 18 with anaconda for python 3.6 and trying to update packages, when I try to do so using
我正在使用ubuntu 18和Anaconda for python3.6,并试图更新包,当我尝试这样做时使用
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
我试着解决它,就像这个GitHub问题中解释的那样
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
但得到了同样的错误。我尝试将-c conda-forge添加到所有命令中,并尝试使用conda更新anaconda conda升级anaconda
and getting the same error all the time.
并且总是得到相同的错误。
Here is my github issue on this
这是我在GitHub上的问题
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
更新:即使在尝试使用它来安装Anaconda-Clean和删除Anaconda时,我也得到了相同的错误,当我尝试安装Conda-Clean时,应该可以帮助我从我的机器上删除Anaconda
更多回答
fixed it when removing the entire conda dir, and reinstalling from scratch, still don't know what's causing this. this is not the first time :-(
修复了它时删除整个康达目录,并从头开始重新安装,仍然不知道是什么原因导致这一点。这不是第一次了:(
I have an Ubuntu x64 16.04 and I'm getting the same error...
我有一台Ubuntu x64 16.04,我收到了同样的错误...
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).
Conda在不同环境中产生意外错误的问题是众所周知的。通常,默认设置与用户自己的设置冲突,或者如果是自行配置的,则可能是在用户的外壳配置文件中设置了不正确的路径(在我的例子中,是~/.zshc文件)。
One could meticulously analyze the causes, set the correct path, and then restart the shell (for zsh
, this would be executed via zsh -l
).
用户可以仔细分析原因,设置正确的路径,然后重新启动外壳(对于zsh,这将通过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:
但是,如果您很匆忙,并且希望稍后进行所有必要的配置,那么在基于Linux的系统上有一个更方便的解决方案;您可以简单地尝试以下方法:
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时,指定自己的外壳的名称也是明智的,例如
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
在重新启动自己的外壳之后(如前所述,使用zsh-L,其中-L代表加载),命令
conda activate <env-name>
should then operate as desired.
然后应该按照预期的方式运行。
In conclusion, a brief summary:
最后,简要总结如下:
- Initialisation
conda init <shell-name> # e.g., zsh or bash
- Apply the changes by restarting the terminal.
If it is zsh, then
如果是zsh,那么
zsh -l
- Create a new environment for a certain python version
conda create --name <env-name> python=3
- Check if the environment is already created
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
*表示Codellama当前处于活动状态
- Active the environment
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.
在进行了整整一个小时的故障排除后救了我一命。原来,我的C:\USERS\**\miniconda3\Script\Activate和C:\USERS\**\minicda3\Script\Deactive没有更新。
UPDATED ANSWER:
更新答案:
For Linux
users I actually found that deleting all the lines added by conda in the .bashrc
other than export PATH="/home/<user>/anaconda3/bin:$PATH"
to be the best solution for this.
对于Linux用户,我发现删除除导出路径=“/home/
/anaconda3/bin:$PATH”之外的.bashrc中由Conda添加的所有行是解决此问题的最佳解决方案。
PREVIOUS ANSWER:
上一个答案:
Not sure it's a fix for everyone, but I got around this by running /home/<user>/anaconda3/bin/conda install anaconda-clean
(or wherever your conda file is stored), and from the packages this installed, the problem magically disappeared.
不确定它是否适用于所有人,但我通过运行/home/
/anaconda3/bin/conda Install anaconda-lean(或存储conda文件的任何位置)解决了这个问题,并且从这个安装的包中,问题神奇地消失了。
If that doesn't work, try doing a 'full' uninstall of anaconda (https://docs.anaconda.com/anaconda/install/uninstall/), reinstall it, then try doing what I suggested above.
如果这不起作用,试着对蟒蛇(https://docs.anaconda.com/anaconda/install/uninstall/),重新安装一次“完全”卸载,然后试着按照我上面的建议做。
Add this on top of your bash script:
在您的bash脚本上添加以下代码:
source ~/miniconda3/etc/profile.d/conda.sh
Functions are not exported by default to be made available in subshells. See: https://github.com/conda/conda/issues/7980
默认情况下,函数不会被导出以在子外壳中可用。请参阅:https://github.com/conda/conda/issues/7980
更多回答
Thanks. conda init zsh
solved the problem for me.
谢谢。Conda init zsh为我解决了这个问题。
我是一名优秀的程序员,十分优秀!