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

Unable to install pygraphviz in amazonlinux:2 Docker image #447

Open
nwalters512 opened this issue Jan 12, 2023 · 1 comment
Open

Unable to install pygraphviz in amazonlinux:2 Docker image #447

nwalters512 opened this issue Jan 12, 2023 · 1 comment

Comments

@nwalters512
Copy link

Place the following text in a file named Dockerfile:

FROM amazonlinux:2

RUN yum install -y python3 python3-devel gcc graphviz-devel

RUN pip3 install pygraphviz || ls /usr/include/graphviz && exit 1

Run docker build . and observe the following output:

[+] Building 1.0s (6/6) FINISHED                                                                                                                                                                                                                                                         
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                0.0s
 => => transferring dockerfile: 191B                                                                                                                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/amazonlinux:2                                                                                                                                                                                                                    0.0s
 => [1/3] FROM docker.io/library/amazonlinux:2                                                                                                                                                                                                                                      0.0s
 => CACHED [2/3] RUN yum install -y python3 python3-devel gcc graphviz-devel                                                                                                                                                                                                        0.0s
 => ERROR [3/3] RUN pip3 install pygraphviz || ls /usr/include/graphviz && exit 1                                                                                                                                                                                                   0.9s
------                                                                                                                                                                                                                                                                                   
 > [3/3] RUN pip3 install pygraphviz || ls /usr/include/graphviz && exit 1:                                                                                                                                                                                                              
#6 0.243 WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.                                                                                                                                                              
#6 0.354 Collecting pygraphviz                                                                                                                                                                                                                                                           
#6 0.427   Downloading pygraphviz-1.7.zip (118 kB)                                                                                                                                                                                                                                       
#6 0.569 Using legacy 'setup.py install' for pygraphviz, since package 'wheel' is not installed.                                                                                                                                                                                         
#6 0.577 Installing collected packages: pygraphviz
#6 0.578     Running setup.py install for pygraphviz: started
#6 0.732     Running setup.py install for pygraphviz: finished with status 'error'
#6 0.732     ERROR: Command errored out with exit status 1:
#6 0.732      command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vg065y7g/pygraphviz/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vg065y7g/pygraphviz/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-jiwlt3fy/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/pygraphviz
#6 0.732          cwd: /tmp/pip-install-vg065y7g/pygraphviz/
#6 0.732     Complete output (55 lines):
#6 0.732     running install
#6 0.732     running build
#6 0.732     running build_py
#6 0.732     creating build
#6 0.732     creating build/lib.linux-aarch64-3.7
#6 0.732     creating build/lib.linux-aarch64-3.7/pygraphviz
#6 0.732     copying pygraphviz/testing.py -> build/lib.linux-aarch64-3.7/pygraphviz
#6 0.732     copying pygraphviz/graphviz.py -> build/lib.linux-aarch64-3.7/pygraphviz
#6 0.732     copying pygraphviz/agraph.py -> build/lib.linux-aarch64-3.7/pygraphviz
#6 0.732     copying pygraphviz/scraper.py -> build/lib.linux-aarch64-3.7/pygraphviz
#6 0.732     copying pygraphviz/__init__.py -> build/lib.linux-aarch64-3.7/pygraphviz
#6 0.732     creating build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_close.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_drawing.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_node_attributes.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_subgraph.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_readwrite.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_string.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_graph.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_edge_attributes.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_scraper.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_unicode.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_layout.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_html.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/__init__.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     copying pygraphviz/tests/test_clear.py -> build/lib.linux-aarch64-3.7/pygraphviz/tests
#6 0.732     running egg_info
#6 0.732     writing pygraphviz.egg-info/PKG-INFO
#6 0.732     writing dependency_links to pygraphviz.egg-info/dependency_links.txt
#6 0.732     writing top-level names to pygraphviz.egg-info/top_level.txt
#6 0.732     reading manifest file 'pygraphviz.egg-info/SOURCES.txt'
#6 0.732     reading manifest template 'MANIFEST.in'
#6 0.732     warning: no files found matching '*.png' under directory 'doc'
#6 0.732     warning: no files found matching '*.txt' under directory 'doc'
#6 0.732     warning: no files found matching '*.css' under directory 'doc'
#6 0.732     warning: no previously-included files matching '*~' found anywhere in distribution
#6 0.732     warning: no previously-included files matching '*.pyc' found anywhere in distribution
#6 0.732     warning: no previously-included files matching '.svn' found anywhere in distribution
#6 0.732     no previously-included directories found matching 'doc/build'
#6 0.732     writing manifest file 'pygraphviz.egg-info/SOURCES.txt'
#6 0.732     copying pygraphviz/graphviz.i -> build/lib.linux-aarch64-3.7/pygraphviz
#6 0.732     copying pygraphviz/graphviz_wrap.c -> build/lib.linux-aarch64-3.7/pygraphviz
#6 0.732     running build_ext
#6 0.732     building 'pygraphviz._graphviz' extension
#6 0.732     creating build/temp.linux-aarch64-3.7
#6 0.732     creating build/temp.linux-aarch64-3.7/pygraphviz
#6 0.732     gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -moutline-atomics -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.7m -c pygraphviz/graphviz_wrap.c -o build/temp.linux-aarch64-3.7/pygraphviz/graphviz_wrap.o
#6 0.732     In file included from /usr/include/graphviz/gvc.h:17:0,
#6 0.732                      from pygraphviz/graphviz_wrap.c:2712:
#6 0.732     /usr/include/graphviz/types.h:49:10: fatal error: cgraph.h: No such file or directory
#6 0.732      #include <cgraph.h>
#6 0.732               ^~~~~~~~~~
#6 0.732     compilation terminated.
#6 0.732     error: command 'gcc' failed with exit status 1
#6 0.732     ----------------------------------------
#6 0.732 ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vg065y7g/pygraphviz/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vg065y7g/pygraphviz/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-jiwlt3fy/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/pygraphviz Check the logs for full command output.
#6 0.878 arith.h
#6 0.878 cdt.h
#6 0.878 cgraph.h
#6 0.878 color.h
#6 0.878 geom.h
#6 0.878 graphviz_version.h
#6 0.878 gv.cpp
#6 0.878 gv.i
#6 0.878 gvc.h
#6 0.878 gvcext.h
#6 0.878 gvcjob.h
#6 0.878 gvcommon.h
#6 0.878 gvconfig.h
#6 0.878 gvplugin.h
#6 0.878 gvplugin_device.h
#6 0.878 gvplugin_layout.h
#6 0.878 gvplugin_loadimage.h
#6 0.878 gvplugin_render.h
#6 0.878 gvplugin_textlayout.h
#6 0.878 gvpr.h
#6 0.878 pack.h
#6 0.878 pathgeom.h
#6 0.878 pathplan.h
#6 0.878 textpara.h
#6 0.878 types.h
#6 0.878 usershape.h
#6 0.878 xdot.h
------
executor failed running [/bin/sh -c pip3 install pygraphviz || ls /usr/include/graphviz && exit 1]: exit code: 1

Note that gcc complains that <cgraph.c> cannot be found, although the ls output shows that /usr/include/graphviz definitely contains a cgraph.h file.

@mixtah
Copy link

mixtah commented Sep 11, 2023

I have the same issue but with public.ecr.aws/lambda/python:3.11.
I had public.ecr.aws/lambda/python:3.9 prior to this error, but but hadn't changed to code in a while working on other parts, so I can't remember if the latest commits with pygraphviz with 3.9 were working builds or not.
In either case, getting the same error as above.

I am installing

RUN yum update -y && \
    yum install -y gcc python3-devel.x86_64 && \
    yum install -y graphviz graphviz-devel ttf-freefont && \ ...

and later have

pip install --no-cache-dir pygraphviz==1.11 --target "${LAMBDA_TASK_ROOT}" --global-option=build_ext --global-option="-I/usr/include/graphviz" --global-option="-L/usr/lib/graphviz/"

I also had version 1.10 but bumped this to 1.11.

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

2 participants