pip install pygraphviz: Aucun paquet 'libcgraph' trouvé

Je réussir à installer graphviz et cgraph avec

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

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

Je rencontre le problème de No package 'libcgraph' found lors de l'exécution de sudo pip install pygraphviz. Voici le stacktrace complet.

$ 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('rn', '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('rn', '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/

J'ai essayé les solutions fournies par Python ne voit pas pygraphviz , mais cela ne fonctionne pas.

33
demandé sur Community 2016-11-10 15:49:01

5 réponses

sudo apt-get install python-dev graphviz libgraphviz-dev pkg-config

Puis

sudo pip install pygraphviz
44
répondu Dhiraj Dhule 2017-06-09 09:58:27

Pour MacOS, je devais faire:

$ brew install graphviz
$ sudo pip install pygraphviz 
28
répondu Rob 2018-04-17 08:50:53

Pour les utilisateurs de fedora:

  1. yum liste disponible graphviz*
  2. sélectionnez le package approprié pour votre distribution Fedora
  3. sudo yum install 'graphviz-devel.x86_64'
  4. pip install pygraphviz
7
répondu Edouard Amosse 2017-02-14 18:50:32

Sur macOS, Je l'ai fait avec,

$ brew install graphviz
$ sudo pip install pygraphviz
4
répondu SparkAndShine 2017-03-03 16:36:34

Pour CentOS. Comme graphviz-devel est nécessaire pour résoudre ce problème, vous devrez l'installer avec yum. Pour ce faire, vous devez ajouter des repo où le paquet est disponible. Dans mon cas, Atomique repos a bien fonctionné.

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

Cela ajoutera des repos atomiques, puis

sudo yum install graphviz-devel

Et vous devriez être capable d'effectuer

pip install pygraphviz
0
répondu wolendranh 2017-03-10 12:46:44