howto install pygraphviz on windows 10 64bit
Start reading from here
https://github.com/pygraphviz/pygraphviz/issues/58
At the bottom of that page there is a link to a x64 zip file in Github (like this)
Unpack that. Create a coresponding Program Files folder for your x64 file and put them there
Then install using this
pip install --global-option=build_ext --global-option="-IC:\Program Files\Graphviz2.38\include" --global-option="-LC:\Program Files\Graphviz2.38\lib\" pygraphviz
How to install a package for a specific Python version on Windows 10?
The golden rule when one wants to access one of the multiple software versions (applies to any software (other than Python), on any OS) existing on a machine: use absolute paths.
There are multiple ways of pip install
ing (especially when involving VEnvs):
Run PIP directly - most frequently used:
pip install --upgrade pyaudio
Run
python -m pip
:python -m pip install --upgrade pyaudio
Run other convenience wrappers (Py (Win specific): [Python.Docs]: Using Python on Windows - From the command-line):
py -3.6 -m pip install --upgrade pyaudio
"${PATH_TO_YOUR_PYTHON_3_6}" -m pip install --upgrade pyaudio
where ${PATH_TO_YOUR_PYTHON_3_6} is just a placeholder for the actual Python 3.6 executable path (e.g. %ProgramFiles%\Python 3.6\python.exe).Note that this works fine (end easy) when having multiple Python versions installed (custom built, VEnvs, ...).
Check [Python.Docs]: Using Python on Windows - Installing Without UI for more details regarding install paths.
Generalizing:
"${PATH_TO_PYTHON_EXECUTABLE}" -m pip install ${PACKAGE_NAME}
where ${PACKAGE_NAME} is (obviously) the package name.Note that sometimes, due to special conditions (like local PIP repositories configuration, ...), the installation would have to be done in 2 steps:
Download the .whl locally
Pass it to PIP (in order to install it)
${PATH_TO_PYTHON_EXECUTABLE} (using v3.9 as an example) can be (from my machines):
Win:
%ProgramFiles%\Python 3.9\python.exe
E:\Work\Dev\VEnvs\py_pc064_03.09_test0\Scripts\python.exe
F:\Install\pc064\Anaconda\Anaconda\Version\python.exe
Nix:
/usr/bin/python3.9
/opt/qti-aic/dev/python/qaic-env/bin/python
Win: [MS.Docs]: where (
where /?
)Nix: [Die.Linux]: which(1) (
man which
).
Worth mentioning aliases: [Man7]: ALIAS(1P) (man alias
)
[SO]: PyCharm doesn't recognize installed module (@CristiFati's answer)
[SO]: How to update pywin32 automatically? (@CristiFati's answer)
[SO]: PyAudio.write SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats (@CristiFati's answer)
Installing PygraphViz on Windows, Python 2.6
Here's what worked for me in Python 2.7. I assume it should work similarly in Python 2.6.
Precondition: Install mingw32 (included in pythonxy distrib if you're using it), Graphviz
1) Download pygraphviz sources
2) Edit setup.py to change paths to smth like
library_path=r"c:\Program Files (x86)\Graphviz 2.28\bin"
include_path=r"c:\Program Files (x86)\Graphviz 2.28\include\graphviz"
Note that it's \bin, not \lib. Linking with libs didn't work for me.3) run python setup.py build -c mingw32
Result of step 3:
c:\Python27\Lib\site-packages\pygraphviz-1.1>python setup.py build -c mingw32
library_path=c:\Program Files (x86)\Graphviz 2.28\bin
include_path=c:\Program Files (x86)\Graphviz 2.28\include\graphviz
running build
running build_py
running build_ext
building 'pygraphviz._graphviz' extension
C:\MinGW32-xy\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ic:\Program Files (x86)\G
raphviz 2.28\include\graphviz" -Ic:\Python27\include -Ic:\Python27\PC -c pygraph
viz/graphviz_wrap.c -o build\temp.win32-2.7\Release\pygraphviz\graphviz_wrap.o
pygraphviz/graphviz_wrap.c: In function 'agattr_label':
pygraphviz/graphviz_wrap.c:2855:5: warning: return makes integer from pointer wi
thout a cast
writing build\temp.win32-2.7\Release\pygraphviz\_graphviz.def
C:\MinGW32-xy\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.7\Release\py
graphviz\graphviz_wrap.o build\temp.win32-2.7\Release\pygraphviz\_graphviz.def "
-Lc:\Program Files (x86)\Graphviz 2.28\bin" -Lc:\Python27\libs -Lc:\Python27\PCb
uild "-Wl,-Rc:\Program Files (x86)\Graphviz 2.28\bin" -lcgraph -lcdt -lpython27
-lmsvcr90 -o build\lib.win32-2.7\pygraphviz\_graphviz.pyd
4) copy the result from the just built lib.win32-2.7 (single sub-folder called pygraphviz
) into your Python's site-packages folderEnjoy!
Related Topics
Apt Command Line Interface-Like Yes/No Input
Can't Use '\1' Backreference to Capture-Group in a Function Call in Re.Sub() Repr Expression
What Is the Purpose of Meshgrid in Python/Numpy
What Is the Purpose of Flask's Context Stacks
Best Way to Make Django's Login_Required the Default
How Do Threads Work in Python, and What Are Common Python-Threading Specific Pitfalls
What's the Best Way to Store a Phone Number in Django Models
Django: How to Manage Development and Production Settings
Wrapping Long Y Labels in Matplotlib Tight Layout Using Setp
How to Update SQLalchemy Row Entry
Use Scikit-Learn to Classify into Multiple Categories
Differencebetween Np.Array() and Np.Asarray()
Django Abstract Models Versus Regular Inheritance
Matplotlib: How to Show a Figure That Has Been Closed
Quickest Way to Make a Get_Dummies Type Dataframe from a Column with a Multiple of Strings
Vectorized Numpy Linspace for Multiple Start and Stop Values