caleb531 / automata

A Python library for simulating finite automata, pushdown automata, and Turing machines
https://caleb531.github.io/automata/
MIT License
348 stars 64 forks source link

Can't install visualization dependencies on mac #223

Closed irisdyoung closed 5 months ago

irisdyoung commented 5 months ago

I can't install the visual dependencies on mac (13.5.7). Installing coloraide worked fine for me, but python -m pip install pygraphviz or python -m pip install 'automata-lib[visual]' does not. I get:

Failed to build pygraphviz
ERROR: Could not build wheels for pygraphviz, which is required to install pyproject.toml-based projects
[full example error message] Collecting pygraphviz>=1.10 (from automata-lib[visual]) Using cached pygraphviz-1.13.tar.gz (104 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: pygraphviz Building wheel for pygraphviz (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for pygraphviz (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [63 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.9-universal2-cpython-312 creating build/lib.macosx-10.9-universal2-cpython-312/pygraphviz copying pygraphviz/scraper.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz copying pygraphviz/graphviz.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz copying pygraphviz/__init__.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz copying pygraphviz/agraph.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz copying pygraphviz/testing.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz creating build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_unicode.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_scraper.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_readwrite.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_string.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/__init__.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_html.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_node_attributes.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_drawing.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_repr_mimebundle.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_subgraph.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_close.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_edge_attributes.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_clear.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_layout.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz/tests copying pygraphviz/tests/test_graph.py -> build/lib.macosx-10.9-universal2-cpython-312/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 files found matching '*.swg' warning: no files found matching '*.png' under directory 'doc' warning: no files found matching '*.html' under directory 'doc' warning: no files found matching '*.txt' under directory 'doc' warning: no files found matching '*.css' under directory 'doc' 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' adding license file 'LICENSE' writing manifest file 'pygraphviz.egg-info/SOURCES.txt' copying pygraphviz/graphviz.i -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz copying pygraphviz/graphviz_wrap.c -> build/lib.macosx-10.9-universal2-cpython-312/pygraphviz running build_ext building 'pygraphviz._graphviz' extension creating build/temp.macosx-10.9-universal2-cpython-312 creating build/temp.macosx-10.9-universal2-cpython-312/pygraphviz clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -arch arm64 -arch x86_64 -g -DSWIG_PYTHON_STRICT_BYTE_CHAR -I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.9-universal2-cpython-312/pygraphviz/graphviz_wrap.o pygraphviz/graphviz_wrap.c:9:9: warning: 'SWIG_PYTHON_STRICT_BYTE_CHAR' macro redefined [-Wmacro-redefined] #define SWIG_PYTHON_STRICT_BYTE_CHAR ^ :2:9: note: previous definition is here #define SWIG_PYTHON_STRICT_BYTE_CHAR 1 ^ pygraphviz/graphviz_wrap.c:3023:10: fatal error: 'graphviz/cgraph.h' file not found #include "graphviz/cgraph.h" ^~~~~~~~~~~~~~~~~~~ 1 warning and 1 error generated. error: command '/usr/bin/clang' failed with exit code 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pygraphviz Failed to build pygraphviz ERROR: Could not build wheels for pygraphviz, which is required to install pyproject.toml-based projects

I overwrote my system python with a homebrew installation some time ago so I grabbed a fresh python directly from python.org in case it mattered. That version, a homebrew installation, and a miniconda installation all produce this error for multiple versions of python (3.8 through 3.12, haven't tried all combinations in between; pip 24.0 for python 3.9 and pip 19.2.3 for python 3.8).

eliotwrobson commented 5 months ago

I think this error comes up if you don't have graphviz installed. Pygraphviz is basically Python bindings for the graphviz package: https://graphviz.org/download/

Alternatively, if you use conda you can install graphviz (and pygraphviz) in a conda environment.

irisdyoung commented 5 months ago

Sure enough, with graphviz there first they all work.

eliotwrobson commented 5 months ago

I'll add a note to the readme about this, since a couple of people have reported seeing this error message.

caleb531 commented 5 months ago

@eliotwrobson Just checking in to ask when you'd be able to add a note to the README about this installation gotcha. I think as soon as it's added to the README (even on develop), we can close this ticket.

eliotwrobson commented 5 months ago

@caleb531 makes sense! I added the note in #217. I marked it as draft to wait for responses by the original issue creators, but I think it's been long enough we can just proceed.

The changes there are in a complete state, so I'll go ahead and mark it as ready for review. If you think it looks good, I say we merge and close the open issues 👍

Link to review: https://github.com/pyOpenSci/software-submission/issues/152