UnicodeDecodeError при установке python-igraph

Я использую python 2.7 в 64-разрядной версии Linux Mint 16 и пытаюсь установить python-igraph. Но когда я запускаю sudo pip install python-igraph, я получаю следующий журнал:

Downloading/unpacking python-igraph
  Downloading python-igraph-0.7.1-1.tar.gz (375kB): 375kB downloaded
  Running setup.py egg_info for package python-igraph

Installing collected packages: python-igraph
  Running setup.py install for python-igraph
    Build type: dynamic extension
    Include path: /usr/include/igraph
    Library path:
    Linked dynamic libraries: igraph
    Linked static libraries:
    Extra compiler options:
    Extra linker options:
    building 'igraph._igraph' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/usr/include/python2.7 -c src/igraphmodule.c -o build/temp.linux-x86_64-2.7/src/igraphmodule.o
    In file included from src/igraphmodule.c:30:0:
    src/convert.h:65:59: error: unknown type name ‘igraph_pagerank_algo_t’
     int igraphmodule_PyObject_to_pagerank_algo_t(PyObject *o, igraph_pagerank_algo_t *result);
                                                               ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/python-igraph/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-akm3_O-record/install-record.txt --single-version-externally-managed:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/igraph

copying igraph/formula.py -> build/lib.linux-x86_64-2.7/igraph

copying igraph/__init__.py -> build/lib.linux-x86_64-2.7/igraph

copying igraph/configuration.py -> build/lib.linux-x86_64-2.7/igraph

copying igraph/summary.py -> build/lib.linux-x86_64-2.7/igraph

copying igraph/layout.py -> build/lib.linux-x86_64-2.7/igraph

copying igraph/cut.py -> build/lib.linux-x86_64-2.7/igraph

copying igraph/datatypes.py -> build/lib.linux-x86_64-2.7/igraph

copying igraph/utils.py -> build/lib.linux-x86_64-2.7/igraph

copying igraph/clustering.py -> build/lib.linux-x86_64-2.7/igraph

copying igraph/statistics.py -> build/lib.linux-x86_64-2.7/igraph

copying igraph/matching.py -> build/lib.linux-x86_64-2.7/igraph

copying igraph/compat.py -> build/lib.linux-x86_64-2.7/igraph

creating build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/operators.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/isomorphism.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/__init__.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/colortests.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/conversion.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/homepage.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/attributes.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/vertexseq.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/structural.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/separators.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/atlas.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/layouts.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/rng.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/games.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/utils.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/iterators.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/edgeseq.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/indexing.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/spectral.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/cliques.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/flow.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/basic.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/generators.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/matching.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/foreign.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/bipartite.py -> build/lib.linux-x86_64-2.7/igraph/test

copying igraph/test/decomposition.py -> build/lib.linux-x86_64-2.7/igraph/test

creating build/lib.linux-x86_64-2.7/igraph/app

copying igraph/app/__init__.py -> build/lib.linux-x86_64-2.7/igraph/app

copying igraph/app/shell.py -> build/lib.linux-x86_64-2.7/igraph/app

creating build/lib.linux-x86_64-2.7/igraph/drawing

copying igraph/drawing/__init__.py -> build/lib.linux-x86_64-2.7/igraph/drawing

copying igraph/drawing/edge.py -> build/lib.linux-x86_64-2.7/igraph/drawing

copying igraph/drawing/shapes.py -> build/lib.linux-x86_64-2.7/igraph/drawing

copying igraph/drawing/coord.py -> build/lib.linux-x86_64-2.7/igraph/drawing

copying igraph/drawing/metamagic.py -> build/lib.linux-x86_64-2.7/igraph/drawing

copying igraph/drawing/utils.py -> build/lib.linux-x86_64-2.7/igraph/drawing

copying igraph/drawing/text.py -> build/lib.linux-x86_64-2.7/igraph/drawing

copying igraph/drawing/graph.py -> build/lib.linux-x86_64-2.7/igraph/drawing

copying igraph/drawing/colors.py -> build/lib.linux-x86_64-2.7/igraph/drawing

copying igraph/drawing/vertex.py -> build/lib.linux-x86_64-2.7/igraph/drawing

copying igraph/drawing/baseclasses.py -> build/lib.linux-x86_64-2.7/igraph/drawing

creating build/lib.linux-x86_64-2.7/igraph/remote

copying igraph/remote/__init__.py -> build/lib.linux-x86_64-2.7/igraph/remote

copying igraph/remote/nexus.py -> build/lib.linux-x86_64-2.7/igraph/remote

copying igraph/remote/gephi.py -> build/lib.linux-x86_64-2.7/igraph/remote

creating build/lib.linux-x86_64-2.7/igraph/vendor

copying igraph/vendor/__init__.py -> build/lib.linux-x86_64-2.7/igraph/vendor

copying igraph/vendor/texttable.py -> build/lib.linux-x86_64-2.7/igraph/vendor

running build_ext

Build type: dynamic extension

Include path: /usr/include/igraph

Library path:

Linked dynamic libraries: igraph

Linked static libraries:

Extra compiler options:

Extra linker options:

building 'igraph._igraph' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/src

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/usr/include/python2.7 -c src/igraphmodule.c -o build/temp.linux-x86_64-2.7/src/igraphmodule.o

In file included from src/igraphmodule.c:30:0:

src/convert.h:65:59: error: unknown type name ‘igraph_pagerank_algo_t’

 int igraphmodule_PyObject_to_pagerank_algo_t(PyObject *o, igraph_pagerank_algo_t *result);

                                                           ^

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/python-igraph/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-akm3_O-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip_build_root/python-igraph
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 148, in main
    return command.main(args[1:], options)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 169, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 50: ordinal not in range(128)

Ранее я установил libigraph0-dev. Как я могу установить python-igraph в этом случае?


person Sergey Ivanov    schedule 10.02.2015    source источник


Ответы (2)


Соответствует ли версия libigraph0-dev номеру версии интерфейса Python? Если версия libigraph0-dev не равна 0.7.1, она не подойдет для версии python-igraph, которую вы пытаетесь скомпилировать. В этом случае лучше удалить libigraph0 и libigraph0-dev и снова запустить pip install python-igraph; сценарий установки сначала попытается загрузить и скомпилировать соответствующую версию ядра C igraph.

Я знаю, что сегодня вы разместили еще один вопрос, в котором заявили, что pip install python-igraph (без libigraph0-dev) у вас не работает; в любом случае попробуйте еще раз, потому что в предыдущей версии python-igraph была ошибка, которая не позволяла загрузить правильную версию ядра C, и я исправил эту ошибку всего час назад.

person Tamás    schedule 10.02.2015
comment
После удаления libigraph0 я снова запустил pip, и он вывел огромный журнал, который завершился с ошибкой. Конец этого журнала: 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. ... src/igraphmodule.c:25:20: fatal error: igraph.h: No such file or directory #include <igraph.h> compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ` - person Sergey Ivanov; 11.02.2015
comment
Это работает для меня, поэтому, пожалуйста, выложите где-нибудь полный журнал компиляции, чтобы я мог на него взглянуть. - person Tamás; 12.02.2015
comment
Вы можете узнать об этом здесь: dropbox.com/s/bv5soo02xvos9oz/ log.txt?dl=0 - person Sergey Ivanov; 12.02.2015
comment
Хорошо, проблема на самом деле в том, что вам нужно будет установить libxml2-dev, чтобы скомпилировать ядро ​​​​C igraph (потому что это нужно для чтения GraphML). Журнал установки правильно сообщает об этом, проблема в том, что компиляция тем не менее продолжается (хотя она должна была быть остановлена), а сообщение об ошибке скрыто в середине журнала. - person Tamás; 13.02.2015
comment
@Tamás Не могли бы вы указать это требование в официальной документации здесь, если у вас есть такая возможность: igraph.org/python igraph не будет установлен в Ubuntu или большинстве дистрибутивов Debian без этого, и это было труднее всего понять. - person Leng; 02.12.2015

загрузите исходный код igraph на языке C и установите его, используя приведенный ниже код.

./configure && make && sudo make install

затем установите python igraph с помощью pip или из исходного кода

person Saeed-rz    schedule 07.12.2015