Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can pygraphviz provide everything needed to install it please? #347

Open
brando90 opened this issue May 12, 2021 · 10 comments
Open

Can pygraphviz provide everything needed to install it please? #347

brando90 opened this issue May 12, 2021 · 10 comments

Comments

@brando90
Copy link

I was trying to pip and conda install pygraphviz. I believe grahviz is installed since

(metalearningpy1.7.1c10.2) miranda9~/ML4Coq $ conda install -y graphviz
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

but when I try installing pygraphviz with pip I get the following:

(metalearningpy1.7.1c10.2) miranda9~/ML4Coq $ pip install pygraphviz
Collecting pygraphviz
  Using cached pygraphviz-1.7.zip (118 kB)
Building wheels for collected packages: pygraphviz
  Building wheel for pygraphviz (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/miranda9/miniconda3/envs/metalearningpy1.7.1c10.2/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rc_2rzek/pygraphviz_904720f7fa8b49f4a7006870a0d5e479/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rc_2rzek/pygraphviz_904720f7fa8b49f4a7006870a0d5e479/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-b61bb2uf
       cwd: /tmp/pip-install-rc_2rzek/pygraphviz_904720f7fa8b49f4a7006870a0d5e479/
  Complete output (55 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/pygraphviz
  copying pygraphviz/scraper.py -> build/lib.linux-x86_64-3.8/pygraphviz
  copying pygraphviz/testing.py -> build/lib.linux-x86_64-3.8/pygraphviz
  copying pygraphviz/graphviz.py -> build/lib.linux-x86_64-3.8/pygraphviz
  copying pygraphviz/agraph.py -> build/lib.linux-x86_64-3.8/pygraphviz
  copying pygraphviz/__init__.py -> build/lib.linux-x86_64-3.8/pygraphviz
  creating build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_subgraph.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_readwrite.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_unicode.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_drawing.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_string.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_close.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_scraper.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_edge_attributes.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_graph.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_html.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_clear.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/__init__.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_node_attributes.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
  copying pygraphviz/tests/test_layout.py -> build/lib.linux-x86_64-3.8/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 '*.png' 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'
  writing manifest file 'pygraphviz.egg-info/SOURCES.txt'
  copying pygraphviz/graphviz.i -> build/lib.linux-x86_64-3.8/pygraphviz
  copying pygraphviz/graphviz_wrap.c -> build/lib.linux-x86_64-3.8/pygraphviz
  running build_ext
  building 'pygraphviz._graphviz' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/pygraphviz
  gcc -pthread -B /home/miranda9/miniconda3/envs/metalearningpy1.7.1c10.2/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/miranda9/miniconda3/envs/metalearningpy1.7.1c10.2/include/python3.8 -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-3.8/pygraphviz/graphviz_wrap.o
  In file included from /usr/include/graphviz/gvc.h:17:0,
                   from pygraphviz/graphviz_wrap.c:2712:
  /usr/include/graphviz/types.h:49:20: fatal error: cgraph.h: No such file or directory
   #include <cgraph.h>
                      ^
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pygraphviz
  Running setup.py clean for pygraphviz
Failed to build pygraphviz
Installing collected packages: pygraphviz
    Running setup.py install for pygraphviz ... error
    ERROR: Command errored out with exit status 1:
     command: /home/miranda9/miniconda3/envs/metalearningpy1.7.1c10.2/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rc_2rzek/pygraphviz_904720f7fa8b49f4a7006870a0d5e479/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rc_2rzek/pygraphviz_904720f7fa8b49f4a7006870a0d5e479/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-mu112lx1/install-record.txt --single-version-externally-managed --compile --install-headers /home/miranda9/miniconda3/envs/metalearningpy1.7.1c10.2/include/python3.8/pygraphviz
         cwd: /tmp/pip-install-rc_2rzek/pygraphviz_904720f7fa8b49f4a7006870a0d5e479/
    Complete output (55 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/pygraphviz
    copying pygraphviz/scraper.py -> build/lib.linux-x86_64-3.8/pygraphviz
    copying pygraphviz/testing.py -> build/lib.linux-x86_64-3.8/pygraphviz
    copying pygraphviz/graphviz.py -> build/lib.linux-x86_64-3.8/pygraphviz
    copying pygraphviz/agraph.py -> build/lib.linux-x86_64-3.8/pygraphviz
    copying pygraphviz/__init__.py -> build/lib.linux-x86_64-3.8/pygraphviz
    creating build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_subgraph.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_readwrite.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_unicode.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_drawing.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_string.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_close.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_scraper.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_edge_attributes.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_graph.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_html.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_clear.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/__init__.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_node_attributes.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
    copying pygraphviz/tests/test_layout.py -> build/lib.linux-x86_64-3.8/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 '*.png' 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'
    writing manifest file 'pygraphviz.egg-info/SOURCES.txt'
    copying pygraphviz/graphviz.i -> build/lib.linux-x86_64-3.8/pygraphviz
    copying pygraphviz/graphviz_wrap.c -> build/lib.linux-x86_64-3.8/pygraphviz
    running build_ext
    building 'pygraphviz._graphviz' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/pygraphviz
    gcc -pthread -B /home/miranda9/miniconda3/envs/metalearningpy1.7.1c10.2/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/miranda9/miniconda3/envs/metalearningpy1.7.1c10.2/include/python3.8 -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-3.8/pygraphviz/graphviz_wrap.o
    In file included from /usr/include/graphviz/gvc.h:17:0,
                     from pygraphviz/graphviz_wrap.c:2712:
    /usr/include/graphviz/types.h:49:20: fatal error: cgraph.h: No such file or directory
     #include <cgraph.h>
                        ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/miranda9/miniconda3/envs/metalearningpy1.7.1c10.2/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rc_2rzek/pygraphviz_904720f7fa8b49f4a7006870a0d5e479/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rc_2rzek/pygraphviz_904720f7fa8b49f4a7006870a0d5e479/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-mu112lx1/install-record.txt --single-version-externally-managed --compile --install-headers /home/miranda9/miniconda3/envs/metalearningpy1.7.1c10.2/include/python3.8/pygraphviz Check the logs for full command output.

with conda:

(metalearningpy1.7.1c10.2) miranda9~/ML4Coq $ conda install -y -c anaconda pygraphviz

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: / 
Found conflicts! Looking for incompatible packages.                                                                                                                                                                                                                                                                                                                                                                           failed                                                                                                                                                                                                                                                                                                                                                                                                                            

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - pygraphviz -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']

Your python: python=3.8

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

what are the sources of my errors? [note I am on a linux machine, not mac os, my mac phygraphviz works fine]


I saw the following related questions:

but they didn't help because I cannot run apt-get

(metalearningpy1.7.1c10.2) miranda9~/ML4Coq $ apt-get install python-dev graphviz libgraphviz-dev pkg-config
-bash: apt-get: command not found

Edit:

note I also did try to install grapviz with pip but that didn't solve my problems:

(metalearningpy1.7.1c10.2) miranda9~/ML4Coq $ pip install graphviz
Collecting graphviz
  Downloading graphviz-0.16-py2.py3-none-any.whl (19 kB)
Installing collected packages: graphviz
Successfully installed graphviz-0.16

cross posted: https://stackoverflow.com/questions/67509980/how-does-one-install-pygraphviz-on-a-hpc-cluster-without-errors-even-when-graphv

@brando90 brando90 changed the title How does one install pygraphviz on a HPC cluster without errors even when graphviz seems to be installed? Can pygraphviz provide everything needed to install it please? May 12, 2021
@rossbar
Copy link
Contributor

rossbar commented May 12, 2021

The naming here is confusing: note that the graphviz package on PyPI is not GraphViz project providing the C-libraries that pygraphviz wraps, but rather a different project providing it's own GraphViz wrappers.

The dependency for pygraphviz is GraphViz which needs to be installed on the system.

Have you tried the relevant procedure for your preferred platform detailed in the installation instructions?

@brando90
Copy link
Author

The naming here is confusing: note that the graphviz package on PyPI is not GraphViz project providing the C-libraries that pygraphviz wraps, but rather a different project providing it's own GraphViz wrappers.

The dependency for pygraphviz is GraphViz which needs to be installed on the system.

Have you tried the relevant procedure for your preferred platform detailed in the installation instructions?

Ah ok. Yes the naming is very confusing. So it seems its not possible to have pygraphviz install the right version (the non python graphviz) for the user?

e.g. in the HPC cluster I need the sys admins to install it for me...perhaps this is just a disadvantage that can't be avoid for some unknown reason to me?

Thanks!

@dschult
Copy link
Contributor

dschult commented May 13, 2021

Did you try the conda-forge pygraphviz option?
Conda installs the GraphViz and pygraphviz in the conda environment. You show trying -c anaconda as an option. In my experience, -c conda-forge works much better.

conda install -c conda-forge pygraphviz

Should install both GraphViz and pygraphviz...

@brando90
Copy link
Author

Did you try the conda-forge pygraphviz option?
Conda installs the GraphViz and pygraphviz in the conda environment. You show trying -c anaconda as an option. In my experience, -c conda-forge works much better.

conda install -c conda-forge pygraphviz

Should install both GraphViz and pygraphviz...

well that seemed to have worked for me...lets see if running my code actually works now!

(metalearningpy1.7.1c10.2) miranda9~ $ conda install -y -c conda-forge pygraphviz

Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/miranda9/miniconda3/envs/metalearningpy1.7.1c10.2

  added / updated specs:
    - pygraphviz


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    libgcc-ng-9.3.0            |      h2828fa1_19         7.8 MB  conda-forge
    libgomp-9.3.0              |      h2828fa1_19         376 KB  conda-forge
    pygraphviz-1.7             |   py38h0d738da_0         125 KB  conda-forge
    ------------------------------------------------------------
                                           Total:         8.3 MB

The following NEW packages will be INSTALLED:

  _openmp_mutex      conda-forge/linux-64::_openmp_mutex-4.5-1_gnu
  libgomp            conda-forge/linux-64::libgomp-9.3.0-h2828fa1_19
  pygraphviz         conda-forge/linux-64::pygraphviz-1.7-py38h0d738da_0

The following packages will be UPDATED:

  certifi            pkgs/main::certifi-2020.12.5-py38h06a~ --> conda-forge::certifi-2020.12.5-py38h578d9bd_1
  libgcc-ng           pkgs/main::libgcc-ng-9.1.0-hdf63c60_0 --> conda-forge::libgcc-ng-9.3.0-h2828fa1_19

The following packages will be SUPERSEDED by a higher-priority channel:

  _libgcc_mutex           pkgs/main::_libgcc_mutex-0.1-main --> conda-forge::_libgcc_mutex-0.1-conda_forge
  ca-certificates    pkgs/main::ca-certificates-2021.4.13-~ --> conda-forge::ca-certificates-2020.12.5-ha878542_0
  openssl              pkgs/main::openssl-1.1.1k-h27cfd23_0 --> conda-forge::openssl-1.1.1k-h7f98852_0



Downloading and Extracting Packages
libgcc-ng-9.3.0      | 7.8 MB    | ##################################################################################################################################################################################################################################################################################################################################################################################### | 100% 
pygraphviz-1.7       | 125 KB    | ##################################################################################################################################################################################################################################################################################################################################################################################### | 100% 
libgomp-9.3.0        | 376 KB    | ##################################################################################################################################################################################################################################################################################################################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

@rossbar
Copy link
Contributor

rossbar commented May 14, 2021

Glad that worked for you @brando90

It seems that the Installation documentation could be made more clear. Two points stand out from the discussion above:

  1. Adding a note to clarify the distinction between the graphviz package on pypi and GraphViz
  2. Adding a note that installing pygraphviz via conda (specifically via the conda-forge channel) is recommended for users who don't have permission to install GraphViz via pkg manager.

Re: the question in the title:

Can pygraphviz provide everything needed to install it please?

Ideally we'd like to provide binary wheels for pygraphviz with everything neatly packaged. This has been attempted in the past but there are some complicating factors re: GraphViz itself that haven't been figured out yet. See #167 for details. Figuring out how to provide wheels for pygraphviz would IMO be a huge improvement; contributions from packaging experts would be very much appreciated!

@dschult
Copy link
Contributor

dschult commented May 14, 2021

I think the ominous sounding warning in our instructions that users not use conda is not necessary.
It is the easiest way for many users who don't have experience with command line interfaces. They can download the anaconda suite easily and have scientific python tools ready to use. Then they can install pygraphviz (often from within their IDE's ipython shell if they add a ! prefix) with conda install -c conda-forge pygraphviz and it installs everything needed including GraphViz. So, I'd feel more comfortable if we remove that warning about conda.

:)

@rossbar
Copy link
Contributor

rossbar commented May 14, 2021

Good point, especially the part about conda-forge because if you are going to use conda, you definitely should use the conda-forge channel (at least as of today) rather than the "official" anaconda channel, which are lagging behind.

@rossbar
Copy link
Contributor

rossbar commented May 15, 2021

FWIW #333 updates the docs with more up-to-date conda instructions, along with CI jobs to regularly test the conda-forge channel. I just force-pushed to retrigger the doc build so it can be previewed. Maybe the CI stuff is overkill - if it'd be better to limit it to just the docs update LMK and I'm happy to remove all the extra build testing :)

@brando90
Copy link
Author

is this issue solved by doing conda install -y pygraphviz -c conda-forge?

@rossbar
Copy link
Contributor

rossbar commented Jun 26, 2021

is this issue solved by doing conda install -y pygraphviz -c conda-forge?

conda-forge provides a working solution for conda users, but the most general solution would be to provide wheels which is currently not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants