web-dev-qa-db-ja.com

pip install pygraphviz:パッケージ 'libcgraph'が見つかりません

graphvizcgraphのインストールに成功しました

$ Sudo pip install graphviz
....
Successfully installed graphviz-0.5.1

$ Sudo pip install cgraph
...
Successfully installed cgraph-0.1

問題が発生しましたNo package 'libcgraph' found実行中Sudo pip install pygraphviz。以下は完全なスタックトレースです。

$ Sudo pip install pygraphviz
The directory '/Users/sparkandshine/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with Sudo, you may want Sudo's -H flag.
The directory '/Users/sparkandshine/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with Sudo, you may want Sudo's -H flag.
Collecting pygraphviz
  Downloading pygraphviz-1.3.1.Zip (123kB)
    100% |████████████████████████████████| 133kB 1.5MB/s 
Installing collected packages: pygraphviz
  Running setup.py install for pygraphviz ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-qfFpFG/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-JmwjA6-record/install-record.txt --single-version-externally-managed --compile:
    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 "/private/tmp/pip-build-qfFpFG/pygraphviz/setup.py", line 87, in <module>
        tests_require=['nose>=0.10.1', 'doctest-ignore-unicode>=0.1.0',],
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "setup_commands.py", line 44, in modified_run
        self.include_path, self.library_path = get_graphviz_dirs()
      File "setup_extra.py", line 121, in get_graphviz_dirs
        include_dirs, library_dirs = _pkg_config()
      File "setup_extra.py", line 44, in _pkg_config
        output = S.check_output(['pkg-config', '--libs-only-L', 'libcgraph'])
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output
        raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command '['pkg-config', '--libs-only-L', 'libcgraph']' returned non-zero exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-qfFpFG/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-JmwjA6-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-qfFpFG/pygraphviz/

Pythonはpygraphvizを認識しません で提供されるソリューションを試しましたが、機能しません。

50
SparkAndShine
Sudo apt-get install python-dev graphviz libgraphviz-dev pkg-config

それから

Sudo pip install pygraphviz
75
Dhiraj Dhule

MacOSの場合、以下を行う必要がありました。

$ brew install graphviz
$ Sudo pip install pygraphviz 
33
Rob

Fedoraユーザーの場合:

  1. yumリストが利用可能graphviz*
  2. fedoraディストリビューションに適切なパッケージを選択します
  3. Sudo yum install 'graphviz-devel.x86_64'
  4. pip install pygraphviz
11
Edouard Amosse

MacOSでは、

$ brew install graphviz
$ Sudo pip install pygraphviz
4
SparkAndShine

CentOSの場合。 graphviz-develはこの問題を修正するために必要なので、yumでインストールする必要があります。これを行うには、パッケージが利用可能な場所にリポジトリを追加する必要があります。私の場合、 Atomic リポジトリは正常に機能しました。

wget -q -O - http://www.atomicorp.com/installers/atomic | sh

これによりアトミックリポジトリが追加され、

Sudo yum install graphviz-devel

そして、あなたは実行できるはずです

pip install pygraphviz
1
wolendranh