Closed SydneyED closed 12 months ago
I'm using the most recent x64 version of GraphViz.
I have tried the python-dev install suggestion from here
I have tried copying the instructions from here
I've tried installing using Christi Fati's pre-built binaries
Tried the no-cache-dir option here
Added GraphViz to PATH and tried to pip install the wheel file it built
Hi @SydneyED, thanks for looking into this project!
It's great to know that pygraphviz
has worked on a standalone python environment.
For Maya
(via mayapy
), what I've found to work is to add include
and library
paths from Maya itself (its Python
and lib
folders) apart from graphviz in the form of -I{graphviz\include};{maya\include}
and -L{graphviz\lib};{maya\lib}
, for example (shortened paths for brevity):
--global-option="-IC:\graphviz\...\include;C:\...\Maya2023\include\Python39\Python" --global-option="-LC:\graphviz\...\lib;C:\...\Maya2023\lib"
There's a small section on The Grill install docs with a snippet like this, which is what I've used for Maya-2023:
mayapy -m pip install --global-option=build_ext --global-option="-IC:\graphviz\Library\include;C:\Program Files\Autodesk\Maya2023\include\Python39\Python" --global-option="-LC:\graphviz\Library\lib;C:\Program Files\Autodesk\Maya2023\lib" pygraphviz
If this continues to fail, the way right now to install grill
without pygraphviz
in Maya would be to exclude all dependencies with the --no-deps
flag to pip
:
mayapy -m pip install grill --no-deps
and then install the dependencies separately, excluding pygraphviz
:
mayapy -m pip install grill-names networkx numpy
Is there a way to get this to run in Maya without having to build pygraphviz for it as the instructions say optional but I can't install without it?
You're right, the initial intention when I included graphviz
was for it to be optional, the fact that there's no easy way to install without pygraphviz
is an oversight, I'll look into addressing it in the future. In the meantime, I hope this helps! Please let me know how it goes if you get a chance at testing the above.
Cheers
Hi! Thank you so much for the quick response.
I am happy to report your snippet works when adjusted for 310 and Maya2024!! I apologise for I must've missed that particular snippet or I was pointing to the wrong folder in my own -I flags (I believe I was originally pointing to a Python header files directory further down the tree so thank you!).
For my install the file paths looked like the following (adjusted slightly for ease of reading/different install locations)
mayapy -m pip install --global-option=build_ext --global-option="-IC:\...\Graphviz\include;.C:\..\Maya2024\include\Python310\Python" --global-option="-LC:\...\Graphviz\lib;C:\...\Maya2024\lib" pygraphviz
And I've just loaded up Maya2024 and the full menu is there, I look forward to trying out the functionality 👍 😄
Full output below:
PS C:\{USER}> mayapy -m pip install --global-option=build_ext --global-option="-IC:\...\Graphviz\include;C:\...\Maya2024\include\Python310\Python" --global-option="-LC:\...\Graphviz\lib;C:\...\Maya2024\lib" pygraphviz
>>
DEPRECATION: --build-option and --global-option are deprecated. pip 23.3 will enforce this behaviour change. A possible replacement is to use --config-settings. Discussion can be found at https://github.com/pypa/pip/issues/11859
WARNING: Implying --no-binary=:all: due to the presence of --build-option / --global-option.
Collecting pygraphviz
Using cached pygraphviz-1.11.zip (120 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pygraphviz
Building wheel for pygraphviz (setup.py) ... done
Created wheel for pygraphviz: filename=pygraphviz-1.11-cp310-cp310-win_amd64.whl size=107859 sha256=b33bdf625544983e5e9bb8b8015008041f2f1a5b9584a2f89fb031d0d72ea2cc
Stored in directory: c:\{USER}\appdata\local\pip\cache\wheels\5b\ee\36\f47a0d35664fbe1a2b5a433ae33c6ad636b00bb231f68a9aaa
Successfully built pygraphviz
Installing collected packages: pygraphviz
Successfully installed pygraphviz-1.11
PS C:\{USER}> mayapy -m pip install grill
Collecting grill
Using cached grill-0.15.0-py3-none-any.whl (59 kB)
Collecting grill-names>=2.6.0 (from grill)
Using cached grill_names-2.6.0-py3-none-any.whl (8.6 kB)
Collecting networkx (from grill)
Using cached networkx-3.1-py3-none-any.whl (2.1 MB)
Requirement already satisfied: pygraphviz in c:\...\maya2024\python\lib\site-packages (from grill) (1.11)
Collecting numpy (from grill)
Obtaining dependency information for numpy from https://files.pythonhosted.org/packages/cc/05/ef9fc04adda45d537619ea956bc33489f50a46badc949c4280d8309185ec/numpy-1.26.0-cp310-cp310-win_amd64.whl.metadata
Using cached numpy-1.26.0-cp310-cp310-win_amd64.whl.metadata (61 kB)
Requirement already satisfied: naming>=0.6 in c:\...\maya2024\python\lib\site-packages (from grill-names>=2.6.0->grill) (0.7.0)
Using cached numpy-1.26.0-cp310-cp310-win_amd64.whl (15.8 MB)
Installing collected packages: numpy, networkx, grill-names, grill
WARNING: The script f2py.exe is installed in 'C:\...\Maya2024\Python\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed grill-0.15.0 grill-names-2.6.0 networkx-3.1 numpy-1.26.0
That's great to read and awesome that it's working for Maya2024; thanks for confirming the update, @SydneyED! 😃
Hi there, I'm struggling to build this for maya and was wondering if you'd be able to point me in the right direction.
I have successfully built your code on Windows from the powershell for importing to a stand-alone terminal by installing pygraphviz with:
python -m pip install --use-pep517 --global-option=build_ext --global-option="-I.\Graphviz\include" --global-option="-L.\Graphviz\lib" pygraphviz
And your grill with:
python -m pip install grill
However, when I then try to install with mayapy I get the following errors:
I have installed the MSVC 14+ 2022 Build Tools, I have tried with pep-517 and without pep-517, I've tried adding -I{Python library folders}, I've updated pip/setuptools/wheel.
When I install python-dev-tools with pip it deprecates the pip and causes legacy issues. But with the python-dev-tools it gives the cannot build wheel/cannot run setup.py cl.exe failed error.
I have installed Graphviz and can build_ext pygraphviz for external python, but not for Maya.
Have the build instructions changed since this was published? Is there a way to get this to run in Maya without having to build pygraphviz for it as the instructions say optional but I can't install without it?
OS: Windows 10, Python 310, Maya 2024