question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] option --include-path not recognized (pygraphviz)

See original GitHub issue

setuptools version

57.4.0

Python version

3.8.5

OS

10.15.7 Catalina

Additional environment information

No response

Description

Posted the issue here:https://github.com/pygraphviz/pygraphviz/issues/361

Tried to install with --include-option and --global-option but it fails: pip install --global-option=“-I/usr/local/include/graphviz/” --global-option=“-L/usr/local/lib/graphviz” pygraphviz pip install pygraphviz --install-option=“–include-path=/usr/local/include/graphviz/” --install-option=“–library-path=/usr/local/lib/graphviz”

Expected behavior

I installed graphviz but it seems pip install pygraphviz doesn’t know where the graphviz is so I tried to include path to it with --include-path and global-options, but they are not recognizable.

How to Reproduce

brew install graphviz
pip install --global-option="-I/usr/local/include/graphviz/" --global-option="-L/usr/local/lib/graphviz" pygraphviz
pip install pygraphviz --install-option="--include-path=/usr/local/include/graphviz/" --install-option="--library-path=/usr/local/lib/graphviz"

Output

Collecting pygraphviz
Using cached pygraphviz-1.7.zip (118 kB)
Skipping wheel build for pygraphviz, due to binaries being disabled for it.
Installing collected packages: pygraphviz
Running setup.py install for pygraphviz ... error
ERROR: Command errored out with exit status 1:
command: /opt/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/z1/9v98kv1j6kj_wdm9f2v1x7s80012jb/T/pip-install-opnitgqo/pygraphviz_940432cb2c62475896c051ed944a799d/setup.py'"'"'; file='"'"'/private/var/folders/z1/9v98kv1j6kj_wdm9f2v1x7s80012jb/T/pip-install-opnitgqo/pygraphviz_940432cb2c62475896c051ed944a799d/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/z1/9v98kv1j6kj_wdm9f2v1x7s80012jb/T/pip-record-w717thbz/install-record.txt --single-version-externally-managed --compile --install-headers /opt/anaconda3/include/python3.8/pygraphviz --include-path=/usr/local/include/graphviz/ --library-path=/usr/local/lib/graphviz
cwd: /private/var/folders/z1/9v98kv1j6kj_wdm9f2v1x7s80012jb/T/pip-install-opnitgqo/pygraphviz_940432cb2c62475896c051ed944a799d/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: option --include-path not recognized
----------------------------------------

ERROR: Command errored out with exit status 1: /opt/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/z1/9v98kv1j6kj_wdm9f2v1x7s80012jb/T/pip-install-opnitgqo/pygraphviz_940432cb2c62475896c051ed944a799d/setup.py'"'"'; file='"'"'/private/var/folders/z1/9v98kv1j6kj_wdm9f2v1x7s80012jb/T/pip-install-opnitgqo/pygraphviz_940432cb2c62475896c051ed944a799d/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/z1/9v98kv1j6kj_wdm9f2v1x7s80012jb/T/pip-record-w717thbz/install-record.txt --single-version-externally-managed --compile --install-headers /opt/anaconda3/include/python3.8/pygraphviz --include-path=/usr/local/include/graphviz/ --library-path=/usr/local/lib/graphviz Check the logs for full command output.

Code of Conduct

  • I agree to follow the PSF Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
phetdamcommented, Aug 21, 2021

install command help does not show any --include-path flag. /usr/local/include should be part of the system include path and so you shouldn’t need to specify headers, but if you need to, I think what you are looking for is probably the --include-dirs/-I flag for build_ext, which must be run to build the pygraphviz._graphviz C extension in the pygraphviz setup.py.

You can pass extra commands and options to setup.py before the install command with --global-option, so following the example in the pygraphviz documentation, try something like

pip install --global-option=build_ext --global-option="-I/usr/local/include/graphviz/" \
    --global-option="-L/usr/local/lib/graphviz" pygraphviz

I think what you are missing was the initial passing of build_ext to pip before the -I, -L flags. Worse comes to worse, you can always clone the pygraphviz repo, checkout the desired tag, and in the repo home run

python setup.py build_ext -I/usr/local/include/graphviz/ -L/usr/local/lib/graphviz --inplace && pip install .

This will manually trigger the build_ext command with the right flags, build the pygraphviz._graphviz C extension inplace (shared object in same directory as the source file) and then do a proper pip install of the package.

2reactions
alxrcscommented, Apr 4, 2022

Just to add to the above, if you’ve installed graphviz via homebrew (as of 3.0.0) the paths are as follows.

pip install --global-option=build_ext --global-option="-I/opt/homebrew/Cellar/graphviz/3.0.0/include/" \
          --global-option="-L/opt/homebrew/Cellar/graphviz/3.0.0/lib" pygraphviz

EDIT: I ran into other issues after that, so if you’re using Conda as I was, it’s probably easier to just do

conda install --channel conda-forge pygraphviz

…as mentioned in https://github.com/pygraphviz/pygraphviz/issues/400

Read more comments on GitHub >

github_iconTop Results From Across the Web

howto install pygraphviz on windows 10 64bit - Stack Overflow
I tried anaconda with python 3.5 64bit & 32bit with no success. Here is the error I am getting with python 3.5 32bit...
Read more >
pygraphviz won't install : PY-25138 - JetBrains YouTrack
'''Error message when I try to install pygraphviz 1.4''' Collecting ... Failed to find dotneato-config Your Graphviz installation could not be found.
Read more >
graphviz2drawio - PyPI
Convert graphviz (dot) files into draw.io (mxGraph) format. ... pip3 install pygraphviz --install-option="--include-path=/usr/local/include/graphviz" ...
Read more >
Install — PyGraphviz 1.10 documentation
Providing path to Graphviz​​ If you've installed Graphviz and pip is unable to find Graphviz, then you need to provide pip with the...
Read more >
Trying to install pygraphviz on windows is a real pain - Medium
It will not find graphviz dependency files because you dont't have ... install pygraphviz --install-option="--include-path=C:\Program Files ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found