【问题标题】:Enthought Canopy install of igraph on OS XEnthought Canopy 在 OS X 上安装 igraph
【发布时间】:2014-06-04 14:39:46
【问题描述】:

OS X:10.9.3 机盖:1.4.0(64 位)

我尝试使用多种方法安装 python-igraph 均未成功。以下是最近的两次尝试。任何建议将不胜感激。

首先,使用 Canopy 中的 setup.py:

%cd "/Users/user/Downloads/python-igraph-0.7"
/Users/user/Downloads/python-igraph-0.7
run -i setup.py install
running install
running bdist_egg
running egg_info
writing python_igraph.egg-info/PKG-INFO
writing top-level names to python_igraph.egg-info/top_level.txt
writing dependency_links to python_igraph.egg-info/dependency_links.txt
reading manifest file 'python_igraph.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'python_igraph.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-x86_64/egg
running install_lib
running build_py
running build_ext
Cannot find the C core of igraph on this system using pkg-config.
We will now try to download and compile the C core from scratch.
Version number of the C core: 0.7
We will also try: 0.7.0

Version 0.7 of the C core of igraph is not found among the nightly builds.
Use the --c-core-version switch to try a different version.

Could not download and compile the C core of igraph.

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

Build type: dynamic extension                                    
Include path: /usr/include/igraph /usr/local/include/igraph
Library path: 
Linked dynamic libraries: igraph
Linked static libraries: 
Extra compiler options: 
Extra linker options: 
building 'igraph._igraph' extension
gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -DNDEBUG -g -O3 -arch x86_64 -I/usr/include/igraph -I/usr/local/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/Applications/Canopy.app/appdata/canopy-1.4.0.1938.macosx-x86_64/Canopy.app/Contents/include/python2.7 -c src/arpackobject.c -o build/temp.macosx-10.6-x86_64-2.7/src/arpackobject.o
An exception has occurred, use %tb to see the full traceback.

SystemExit: error: command 'gcc' failed with exit status 1

二、从命令行:python setup.py install

curiosity:python-igraph-0.7 user$ sudo python setup.py install
Password:
running install
running bdist_egg
running egg_info
writing python_igraph.egg-info/PKG-INFO
writing top-level names to python_igraph.egg-info/top_level.txt
writing dependency_links to python_igraph.egg-info/dependency_links.txt
reading manifest file 'python_igraph.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'python_igraph.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-x86_64/egg
running install_lib
running build_py
running build_ext
Build type: dynamic extension
Include path: /opt/local/include/igraph
Library path: /opt/local/lib
Linked dynamic libraries: igraph
Linked static libraries: 
Extra compiler options: 
Extra linker options: 
building 'igraph._igraph' extension
gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -DNDEBUG -g -O3 -arch x86_64 -I/opt/local/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/Applications/Canopy.app/appdata/canopy-1.4.0.1938.macosx-x86_64/Canopy.app/Contents/include/python2.7 -c src/arpackobject.c -o build/temp.macosx-10.6-x86_64-2.7/src/arpackobject.o
gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -DNDEBUG -g -O3 -arch x86_64 -I/opt/local/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/Applications/Canopy.app/appdata/canopy-1.4.0.1938.macosx-x86_64/Canopy.app/Contents/include/python2.7 -c src/attributes.c -o build/temp.macosx-10.6-x86_64-2.7/src/attributes.o
In file included from src/attributes.c:26:
src/convert.h:64:59: error: unknown type name 'igraph_pagerank_algo_t'
int igraphmodule_PyObject_to_pagerank_algo_t(PyObject *o, igraph_pagerank_algo_t *result);
                                                          ^
src/attributes.c:307:12: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
      case IGRAPH_ATTRIBUTE_BOOLEAN:
           ^
src/attributes.c:455:14: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
        case IGRAPH_ATTRIBUTE_BOOLEAN:
             ^
src/attributes.c:514:14: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
        case IGRAPH_ATTRIBUTE_BOOLEAN:
             ^
src/attributes.c:638:14: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
        case IGRAPH_ATTRIBUTE_BOOLEAN:
             ^
src/attributes.c:699:14: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
        case IGRAPH_ATTRIBUTE_BOOLEAN:
             ^
src/attributes.c:1367:27: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
          VECTOR(*t)[j] = IGRAPH_ATTRIBUTE_BOOLEAN;
                          ^
src/attributes.c:1457:13: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
    *type = IGRAPH_ATTRIBUTE_BOOLEAN;
            ^
src/attributes.c:1832:3: warning: incompatible pointer types initializing 'int (*)(const igraph_t *, const char *, igraph_vs_t, igraph_vector_t *)' with an
      expression of type 'int (const igraph_t *, const char *, igraph_vector_bool_t *)' [-Wincompatible-pointer-types]
  igraphmodule_i_get_boolean_graph_attr,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/attributes.c:1833:3: warning: incompatible pointer types initializing 'int (*)(const igraph_t *, const char *, igraph_vs_t, igraph_strvector_t *)' with an
      expression of type 'int (const igraph_t *, const char *, igraph_vs_t, igraph_vector_t *)' [-Wincompatible-pointer-types]
  igraphmodule_i_get_numeric_vertex_attr,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/attributes.c:1834:3: warning: incompatible pointer types initializing 'int (*)(const igraph_t *, const char *, igraph_es_t, igraph_vector_t *)' with an
      expression of type 'int (const igraph_t *, const char *, igraph_vs_t, igraph_strvector_t *)' [-Wincompatible-pointer-types]
  igraphmodule_i_get_string_vertex_attr,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/attributes.c:1835:3: warning: incompatible pointer types initializing 'int (*)(const igraph_t *, const char *, igraph_es_t, igraph_strvector_t *)' with an
      expression of type 'int (const igraph_t *, const char *, igraph_vs_t, igraph_vector_bool_t *)' [-Wincompatible-pointer-types]
  igraphmodule_i_get_boolean_vertex_attr,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/attributes.c:1836:3: warning: excess elements in struct initializer
  igraphmodule_i_get_numeric_edge_attr,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 warnings and 8 errors generated.
error: command 'gcc' failed with exit status 1

编辑:添加当前 ImportError txt:

>>> import igraph
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named igraph
>>> exit()

【问题讨论】:

  • 你在/opt/local/include/igraph/opt/local/lib安装了哪个版本的igraph的C核?在第二种情况下,您似乎正在尝试使用较旧的 igraph 版本编译与 igraph 0.7.0 对应的 Python 接口。
  • 我已经(很高兴地)使用 igraph 很长时间了,安装了更传统的 Python 2.7,所以这很有可能。在我尝试另一个安装之前,有什么建议可以删除吗? [python_igraph-0.7-py2.7-macosx10.9.dmg ]
  • 刚刚尝试重新安装 C 核心 ( igraph-0.7.1 ),并重新安装 python-igraph。没运气。结果与上述相同。
  • /opt/local/include/igraph/opt/local/include/igraph现在有哪个版本的igraph?
  • 查看 igraph_version.h:#define IGRAPH_VERSION "0.6.5"

标签: python osx-mavericks igraph enthought canopy


【解决方案1】:

我终于想通了。非常感谢 +Tamas 展示了极大的耐心。当前的磁盘映像文件不够健壮,无法处理 Enthought Canopy 发行版的唯一安装位置。我在尝试 igraph 安装的顺序上也犯了几个错误。正确的过程首先需要更新 igraph 的 C 核心,然后使用 相应的 源代码使用 [% python setup.py install] 进行 python-igraph 安装。

【讨论】:

  • 磁盘映像文件是使用 OS X 的系统 Python 生成的,因此它们会安装系统 Python 的库。您总是必须为 Canopy 手动编译和安装 igraph(除非有人实际发布了专门为 Canopy 编译的 python-igraph)。
  • 谢谢@Tamás;这对我来说应该是显而易见的。很抱歉浪费了带宽。
猜你喜欢
  • 2013-04-22
  • 1970-01-01
  • 2014-01-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多