安装 python-igraph 0.7.1-4 抛出错误“10038,'An operation was attempted on something that is not a socket'

Installing python-igraph 0.7.1-4 throws error as "10038, 'An operation was attempted on something that is not a socket'

Windows 7 64 位

Python 2.7.7 64 位蟒蛇

正在尝试从 https://pypi.python.org/pypi/python-igraph.

安装 python-igraph python-igraph-0.7.1-4.tar.gz

我已经通过 , Can I install Python windows packages into virtualenvs? 和相关链接来调试问题。

我明白问题的出现是因为没有C-core。当我尝试通过 easy_install -

安装时,错误消息也包含此消息
Cannot find the C core of igraph on this system using pkg-config.

WARNING: we were not able to detect where igraph is installed on
your machine (if it is installed at all). We will use the fallback
library and include pathss hardcoded in setup.py and hope that the
C core of igraph is installed there.
If the compilation fails and you are sure that igraph is installed
on your machine, adjust the following two variables in setup.py
accordingly and try again:
- LIBIGRAPH_FALLBACK_INCLUDE_DIRS
- LIBIGRAPH_FALLBACK_LIBRARY_DIRS 

您能否提供解决方案的任何指示。 谢谢。

我刚刚遇到了同样的问题,无论是通过 pycharm 安装程序还是 pip 安装我都无法安装 python-igraph。

Tamás 给出的解决方案对我有用。 从 Christoph Gohles 页面下载您需要的文件。

打开终端

> cd ./ContainingFolder
> pip install python_igraph-0.7.1.post4-cp34-none-win_amd64.whl
Processing c:\users\username\ContainingFolder\python_igraph-0.7.1.post4-cp34-none-win_amd64.whl
Installing collected packages: python-igraph

Successfully installed python-igraph-0.7.1.post4

Christoph Gohlke's page hosts several pre-compiled packages for Python on Windows, including igraph's Python interface. Download the Python wheel corresponding to your Python version from that page 并使用 pip 命令安装它。由于您使用的是 Python 2.7,因此您需要文件名中包含 cp27 的版本。

我知道这作为答案来得很晚,但是 Christoph Gohlke 的 page 仍然包含许多包的 whl 格式的更新库,甚至是 igraph。我花了很多时间来解决这个问题,但我终于成功了。

这些是我采取的步骤:

首先要做的是从 here 安装最新版本的 numpy+mkl。检查您下载的版本是否与您的 Python 版本相关。下载后,您需要在终端中使用以下命令进行安装:pip install numpy‑1.16.3+mkl‑cp37‑cp37m‑win32.whl(检查您下载的文件的文件名并在命令中替换它)。

其次,您需要安装最新版本的 wheel 才能读取您将在下一阶段下载的 whl 文件。这不是必需的,但就我而言,由于某种原因,没有它,pip 无法读取 whl 文件。您可以在终端中使用此命令安装它:pip install wheel.

第三,您需要下载并安装 Python 版本的 Cairo。这是一个允许许多 igraph 图可视化的库。没有它,igraph 库将无法正常工作。该库由 Christoph Gohlke 在 this link 中提供。检查您下载的版本是否与您的 Python 版本相关。下载后,您需要在终端中使用以下命令进行安装:pip install pycairo‑1.18.0‑cp37‑cp37m‑win32.whl(检查您下载的文件的文件名并在命令中替换它)。

终于可以安装igraph了。同样,您需要从 Christoph Gohlke 的 site 下载并安装它。下载时再次检查与您的 Python 版本匹配的软件包,并使用终端中的命令再次安装它:pip install python_igraph-0.7.1.post6-cp37-cp37m-win32.whl(检查您下载的文件的文件名并在命令中替换它)。

安装包后,您可以使用类似于以下内容的方式开始工作:

from graphframes import *
from igraph import *

gf = GraphFrame(vertex, edge)
ig = Graph.TupleList(gf.edges.collect(), directed=True)
plot(ig)

希望这有助于打破神话:)