简体   繁体   English

Anaconda Python:如何安装缺少的依赖项?

[英]Anaconda Python: How to install missing dependency?

I am trying to install graph-tool from here: http://anaconda.org/vgauthier/graph-tool , using the command mentioned on that page.我正在尝试从这里安装graph-toolhttp : //anaconda.org/vgauthier/graph-tool ,使用该页面上提到的命令。

I used the given command line:我使用了给定的命令行:

conda install -c http://conda.anaconda.org/vgauthier graph-tool

and I get the following error:我收到以下错误:

Error: Could not find some dependencies for graph-tool: pixman错误:找不到图形工具的某些依赖项:pixman

So I tried to install pixman in a similar way: http://anaconda.org/rwest/pixman .所以我尝试以类似的方式安装pixmanhttp : pixman

conda install -c http://conda.anaconda.org/rwest pixman

This succeeded.这成功了。

Yet the "could not find dependency" error is still there when trying to install graph-tool .然而,在尝试安装graph-tool时,“找不到依赖项”错误仍然存​​在。 Why does this happen and how can I fix it?为什么会发生这种情况,我该如何解决? There is no additional error message that I could go on.没有我可以继续的其他错误消息。

Conda needs to be able to find all the dependencies at once. Conda 需要能够一次找到所有依赖项。 The -c flag only adds that channel for that one command. -c标志仅为该命令添加该通道。 You would need to run conda install -c vgauthier rwest graph-tool .您需要运行conda install -c vgauthier rwest graph-tool But an easier way is to add those channels to your configuration但更简单的方法是将这些通道添加到您的配置中

conda config --add channels vgauthier --add channels rwest

Once you do this, you can just run一旦你这样做,你就可以运行

conda install graph-tool 

and it will grab things from those channels.它会从这些渠道中抓取东西。

Conflicting dependencies for Anacona 2020.11 Anacona 2020.11冲突依赖

When setting up a fedora-33 virtual machine with Anaconda (Version 2020.11) in April 2021, I got conflicting dependencies, as graph-tool was not compatible with python version 3.8.5 .在 2021 年 4 月使用 Anaconda(版本 2020.11)设置fedora-33虚拟机时,我遇到了相互冲突的依赖关系,因为graph-toolpython version 3.8.5不兼容。 An pointed out here , the way to go is using a virtual environment with a supported version of python (3.7.9. in my case, as I still new from Anaconda version 2020.03).这里指出,要走的路是使用具有受支持的 python 版本的虚拟环境(在我的情况下为 3.7.9,因为我仍然是 Anaconda 版本 2020.03 的新手)。

In my case it was important to install Anaconda NOT as sudo .在我的情况下,重要的是安装 Anaconda 而不是sudo Otherwise some conda - alias was not set properly ( which conda should give an about 30 lines command with some if/else condition).否则,某些conda -别名设置不正确( which conda应该给出一个带有一些 if/else 条件的大约 30 行命令)。

Here are the bash commands:下面是 bash 命令:

$ cd ~/Downloads/
$ wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
$ sudo chown -R user:user /opt/  # needed in my case to avoid sudo for installing Anaconda and calling conda later
$ bash Anaconda3-2020.11-Linux-x86_64.sh  # location: /opt/anaconda3, run conda init: yes
$ source ~/.bashrc  # make command conda available. Like restarting terminal in this case.
$ conda create -n envGraphTool anaconda python=3.7.9
$ conda activate envGraphTool
$ conda install -c conda-forge graph-tool

And a test if everything worked:并测试一切是否正常:

(envGraphTool) [user@f33 Downloads]$ which python
/opt/anaconda3/envs/envGraphTool/bin/python
(envGraphTool) [user@f33 Downloads]$ python -V
Python 3.7.9
(envGraphTool) [user@f33 Downloads]$ python
Python 3.7.9 (default, Aug 31 2020, 12:42:55) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import graph_tool as gt
>>> exit()
(envGraphTool) [user@f33 Downloads]$

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM