pip_install_pygraphviz_cgraph.h_problem

pip 安装pygraphviz报出cgraph.h找不到的问题,ubuntu有pygraphviz-dev包,opensuse要使用pygraphviz-devel包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
(v_python3.6) htf@linux-rzt3:/tmp> pip install pygraphviz
Collecting pygraphviz
Using cached pygraphviz-1.3.1.zip
Building wheels for collected packages: pygraphviz
Running setup.py bdist_wheel for pygraphviz ... error
Complete output from command /home/htf/.virtualenvs/v_python3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-29gpsytb/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpqyu0lzlwpip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/pygraphviz
copying pygraphviz/release.py -> build/lib.linux-x86_64-3.6/pygraphviz
copying pygraphviz/__init__.py -> build/lib.linux-x86_64-3.6/pygraphviz
copying pygraphviz/graphviz.py -> build/lib.linux-x86_64-3.6/pygraphviz
copying pygraphviz/agraph.py -> build/lib.linux-x86_64-3.6/pygraphviz
copying pygraphviz/version.py -> build/lib.linux-x86_64-3.6/pygraphviz
creating build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_edge_attributes.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_string.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_subgraph.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_readwrite.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_clear.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_attributes.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_node_attributes.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_layout.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_graph.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/__init__.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_unicode.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_html.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_drawing.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
running egg_info
writing pygraphviz.egg-info/PKG-INFO
writing dependency_links to pygraphviz.egg-info/dependency_links.txt
writing top-level names to pygraphviz.egg-info/top_level.txt
reading manifest file 'pygraphviz.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn' found anywhere in distribution
no previously-included directories found matching 'doc/build'
writing manifest file 'pygraphviz.egg-info/SOURCES.txt'
copying pygraphviz/graphviz.i -> build/lib.linux-x86_64-3.6/pygraphviz
copying pygraphviz/graphviz_wrap.c -> build/lib.linux-x86_64-3.6/pygraphviz
running build_ext
building 'pygraphviz._graphviz' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/pygraphviz
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -g -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -g -fPIC -I/usr/include/python3.6m -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-3.6/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c:2954:10: fatal error: graphviz/cgraph.h: No such file or directory
#include "graphviz/cgraph.h"
^~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1

----------------------------------------
Failed building wheel for pygraphviz
Running setup.py clean for pygraphviz
Failed to build pygraphviz
Installing collected packages: pygraphviz
Running setup.py install for pygraphviz ... error
Complete output from command /home/htf/.virtualenvs/v_python3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-29gpsytb/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-aiuj4thp-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/htf/.virtualenvs/v_python3.6/include/site/python3.6/pygraphviz:
running install
Trying pkg-config
Package libcgraph was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcgraph.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcgraph' found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-29gpsytb/pygraphviz/setup.py", line 87, in <module>
tests_require=['nose>=0.10.1', 'doctest-ignore-unicode>=0.1.0',],
File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-build-29gpsytb/pygraphviz/setup_commands.py", line 44, in modified_run
self.include_path, self.library_path = get_graphviz_dirs()
File "/tmp/pip-build-29gpsytb/pygraphviz/setup_extra.py", line 121, in get_graphviz_dirs
include_dirs, library_dirs = _pkg_config()
File "/tmp/pip-build-29gpsytb/pygraphviz/setup_extra.py", line 44, in _pkg_config
output = S.check_output(['pkg-config', '--libs-only-L', 'libcgraph'])
File "/usr/lib64/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/usr/lib64/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['pkg-config', '--libs-only-L', 'libcgraph']' returned non-zero exit status 1.

----------------------------------------
Command "/home/htf/.virtualenvs/v_python3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-29gpsytb/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-aiuj4thp-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/htf/.virtualenvs/v_python3.6/include/site/python3.6/pygraphviz" failed with error code 1 in /tmp/pip-build-29gpsytb/pygraphviz/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(v_python3.6) htf@linux-rzt3:/tmp> sudo zypper install graphviz-devel
Retrieving repository 'tsinghua-packman' metadata ....................................................................................................................[done]
Building repository 'tsinghua-packman' cache .........................................................................................................................[done]
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 56 NEW packages are going to be installed:
autoconf automake cairo-devel damageproto-devel fixesproto-devel fontconfig-devel freetype2-devel glib2-devel graphite2-devel graphviz-devel harfbuzz-devel kbproto-devel
libbz2-devel libcairo-script-interpreter2 libdrm-devel libexpat-devel libglvnd-devel libicu-devel libjpeg62-devel libLASi1 libLASi-devel libpcrecpp0 libpcreposix0
libpixman-1-0-devel libpng16-compat-devel libpng16-devel libstdc++6-devel-gcc7 libstdc++-devel libtool libX11-devel libXau-devel libxcb-devel libxcb-res0
libxcb-screensaver0 libxcb-xf86dri0 libxcb-xtest0 libxcb-xv0 libxcb-xvmc0 libXdamage-devel libXext-devel libXfixes-devel libXft-devel libXrender-devel libXxf86vm-devel
Mesa-libEGL-devel Mesa-libGL-devel pango-devel pcre-devel pthread-stubs-devel renderproto-devel tcl-devel tk-devel xextproto-devel xf86vidmodeproto-devel xproto-devel
zlib-devel

The following 2 recommended packages were automatically selected:
libpng16-compat-devel Mesa-libGL-devel

56 new packages to install.
Overall download size: 19.3 MiB. Already cached: 0 B. After the operation, additional 104.2 MiB will be used.
Continue? [y/n/...? shows all options] (y): y

再次安装成功

1
2
3
4
5
6
7
(sce) htf@linux-rzt3:~/pyproject/sce/ser_con_evo/pip_download> pip install pygraphviz-1.3.1.zip
Processing ./pygraphviz-1.3.1.zip
Requirement already satisfied (use --upgrade to upgrade): pygraphviz==1.3.1 from file:///home/htf/pyproject/sce/ser_con_evo/pip_download/pygraphviz-1.3.1.zip in /home/htf/pyproject/sce/lib/python3.6/site-packages
Building wheels for collected packages: pygraphviz
Running setup.py bdist_wheel for pygraphviz ... done
Stored in directory: /home/htf/.cache/pip/wheels/24/e7/76/6e3ea1649ae65c36eb23a62a319c15fcf568647c0cbe14966b
Successfully built pygraphviz
坚持原创技术分享,您的支持将鼓励我继续创作!