How do I install cairocffi through pip?
cairocffi is a CFFI-based drop-in replacement for Pycairo https://github.com/SimonSapin/cairocffi.
I'm trying to install it on Ubuntu 14.04:
alvas#ubi:~$ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.2 LTS"
NAME="Ubuntu"
VERSION="14.04.2 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.2 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
I've tried installing with the standard pip command but I get this:
$ sudo pip install cairocffi
The directory '/home/alvas/.cache/pip/log' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/alvas/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/alvas/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting cairocffi
Downloading cairocffi-0.6.tar.gz (75kB)
100% |████████████████████████████████| 77kB 34kB/s
Collecting cffi>=0.6 (from cairocffi)
Downloading cffi-0.9.2.tar.gz (209kB)
100% |████████████████████████████████| 212kB 97kB/s
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python3.4/dist-packages (from cffi>=0.6->cairocffi)
Installing collected packages: cffi, cairocffi
Running setup.py install for cffi
Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-d3kjzf__/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ll323a3c-record/install-record.txt --single-version-externally-managed --compile:
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/gc_weakref.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.4/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/c
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.4m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.4/c/_cffi_backend.o
c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-d3kjzf__/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ll323a3c-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-d3kjzf__/cffi
I've manually checked the permission and I realized that there's no write access permission. Why is that so? And why isn't sudo working to overwrite the permission?
$ ls -la .cache/pip/log/
total 60
drwxrwxr-x 2 alvas alvas 4096 Feb 3 10:51 .
drwx------ 4 alvas alvas 4096 Apr 12 23:16 ..
-rw-rw-r-- 1 alvas alvas 49961 Apr 12 23:18 debug.log
When I tried sudo -H pip install cairoffi, I got:
sudo -H pip install cairocffi
Collecting cairocffi
Using cached cairocffi-0.6.tar.gz
Collecting cffi>=0.6 (from cairocffi)
Downloading cffi-0.9.2.tar.gz (209kB)
100% |████████████████████████████████| 212kB 29kB/s
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python3.4/dist-packages (from cffi>=0.6->cairocffi)
Installing collected packages: cffi, cairocffi
Running setup.py install for cffi
Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-2sv6pbsp/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xk4kkjrj-record/install-record.txt --single-version-externally-managed --compile:
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/gc_weakref.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.4/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/c
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.4m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.4/c/_cffi_backend.o
c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-2sv6pbsp/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xk4kkjrj-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-2sv6pbsp/cffi
As #MattDMo suggested, i've tried apt-get install libffi but it still didn't work out:
alvas#ubi:~$ sudo apt-get install libffi libffi-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libffi
But there isn't any libffi on the package manager, so i've tried libffi-dev:
alvas#ubi:~$ sudo apt-get install libffi-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libffi-dev
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 99.8 kB of archives.
After this operation, 323 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main libffi-dev amd64 3.1~rc1+r3.0.13-12 [99.8 kB]
Fetched 99.8 kB in 1s (76.3 kB/s)
Selecting previously unselected package libffi-dev:amd64.
(Reading database ... 492855 files and directories currently installed.)
Preparing to unpack .../libffi-dev_3.1~rc1+r3.0.13-12_amd64.deb ...
Unpacking libffi-dev:amd64 (3.1~rc1+r3.0.13-12) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for doc-base (0.10.5) ...
Processing 1 added doc-base file...
Processing triggers for install-info (5.2.0.dfsg.1-2) ...
Setting up libffi-dev:amd64 (3.1~rc1+r3.0.13-12) ...
It installs libffi-dev successfully but cairoffi is still not installing:
alvas#ubi:~$ sudo -H pip install cairoffi
Collecting cairoffi
Could not find a version that satisfies the requirement cairoffi (from versions: )
No matching distribution found for cairoffi
alvas#ubi:~$ sudo -H pip3 install cairoffi
Collecting cairoffi
Could not find a version that satisfies the requirement cairoffi (from versions: )
No matching distribution found for cairoffi
It's right in the error message:
No package 'libffi' found
You'll need to install libffi and libffi-dev through your distro's package manager (yum, apt-get, whatever) before the pip installation will work. Their names may very slightly from platform to platform.
Couldn't get it to work, even with libffi6 libffi-dev installed. Finally got it working with:
pip3 install -U pip
pip3 install -U setuptools
pip3 install --no-cache-dir cairocffi
--no-cache-dir was the trick, thanks to: https://github.com/Kozea/cairocffi/issues/125#issuecomment-476295293
For me, on Windows 10 using python 3.5.3rc1, pip install cairocffi was failing. Doing pip install cffi was sufficient to let it succeed.
Related
in terminal I run command docker build ., but dockerfile fail to install.
Building wheel for backports.zoneinfo (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Building wheel for backports.zoneinfo (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [35 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
creating build/lib.linux-x86_64-cpython-38/backports
copying src/backports/__init__.py -> build/lib.linux-x86_64-cpython-38/backports
creating build/lib.linux-x86_64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/__init__.py -> build/lib.linux-x86_64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/_zoneinfo.py -> build/lib.linux-x86_64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/_common.py -> build/lib.linux-x86_64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/_version.py -> build/lib.linux-x86_64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/_tzpath.py -> build/lib.linux-x86_64-cpython-38/backports/zoneinfo
running egg_info
writing src/backports.zoneinfo.egg-info/PKG-INFO
writing dependency_links to src/backports.zoneinfo.egg-info/dependency_links.txt
writing requirements to src/backports.zoneinfo.egg-info/requires.txt
writing top-level names to src/backports.zoneinfo.egg-info/top_level.txt
reading manifest file 'src/backports.zoneinfo.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.png' under directory 'docs'
warning: no files found matching '*.svg' under directory 'docs'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_output'
adding license file 'LICENSE'
adding license file 'licenses/LICENSE_APACHE'
writing manifest file 'src/backports.zoneinfo.egg-info/SOURCES.txt'
copying src/backports/zoneinfo/__init__.pyi -> build/lib.linux-x86_64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/py.typed -> build/lib.linux-x86_64-cpython-38/backports/zoneinfo
running build_ext
building 'backports.zoneinfo._czoneinfo' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/lib
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.8 -c lib/zoneinfo_module.c -o build/temp.linux-x86_64-cpython-38/lib/zoneinfo_module.o -std=c99
error: command 'gcc' failed: No such file or directory
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for backports.zoneinfo
Failed to build backports.zoneinfo
ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects
WARNING: You are using pip version 22.0.4; however, version 22.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
The command '/bin/sh -c pip install -r /requirements.txt' returned a non-zero code: 1
I have tried many things like:
pip install --upgrade pip wheel
pip install backports.zoneinfo
pip install tzdata
sudo apt-get install ruby-full
None of them helped.
As I have seen in code I don't have gcc. I tried to install. But failed.
My OS is Ubuntu 20.04.
Python 3.8.10
Thank you in advance.
In addition to:
sudo apt-get install build-essential
as #JanWilamowski alluded to, you also need. This command installs gcc i.e. the GNU C-compiler (with many other items).
sudo apt-get install python3-dev.
Then if you try pip install backports.zoninfo if should work as expected. It should also be noted that having these installed on your computer is NOT EQUIVALENT to having it installed in the Docker container. Those need to be done separately using Docker compose files.
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:
Pip install pygraphviz fails: Failed building wheel for pygraphviz
Couldn't install pygraphviz
https://github.com/pygraphviz/pygraphviz/issues/347
https://github.com/pygraphviz/pygraphviz/issues/358
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
Edit 2:
I found out that graphviz is there but why can't it find it?
(metalearningpy1.7.1c10.2) miranda9~ $ rpm -qa |grep graphviz
graphviz-gd-2.30.1-21.el7.x86_64
graphviz-2.30.1-21.el7.x86_64
graphviz-devel-2.30.1-21.el7.x86_64
Edit 3:
I'd also like this to work with pip install -e . e.g. see installation of ultimate utils (https://github.com/brando90/ultimate-utils):
Due to a depedency on pygraphviz you will likely need to install graphviz first. Next, install graphviz. On mac, brew install graphviz. On Ubuntu, sudo apt install graphviz. After graphviz is install, install uutils in edibable mode and all it's depedencies with pip:
pip install -e ~/ultimate-utils/ultimate-utils-proj-src
as a gitissue: https://github.com/brando90/ultimate-utils/issues/6
Well, it seems that using conda-forge worked!
(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
Note:
However, notice that pygraphviz doesn't recommend using conda to install their pkg for some reason
We recommend avoiding Anaconda and conda-forge to install Graphviz and PyGraphviz.
however since pip keeps failing for me - despite graphviz being installed in the cluster - see the output of rpm:
[rundblom#vision-12 ~]$ rpm -qa |grep graphviz
graphviz-devel-2.30.1-21.el7.x86_64
graphviz-2.30.1-21.el7.x86_64
graphviz-gd-2.30.1-21.el7.x86_64
so idk what is wrong with using pip. I would have preferred to load a module in the usual HPC way but that isn't an option for me right now...
I was able to compile it on CentOS with graphviz-devel installed. Originally I got the same error as above, the missing cgraph.h, but by providing a header lookup path to the compiler I could make it build:
CPPFLAGS="-I/usr/include/graphviz" pip install pygraphviz
When I tried to use the package though I had symbol lookup errors. So in the end I gave up and went with conda.
I am trying to Dockerizing Django with Postgres, Gunicorn, and Nginx via the tutorial on
https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/
I am was getting an error while docker is in step 7 i.e,
Step 7/23 : RUN pip wheel --no-cache-dir --no-deps --wheel-dir
/usr/src/app/wheels -r requirements.txt
I was able to update the Dockerfile.prod to conquer this error, but i am getting another error in step 21
Step 21/26 : RUN pip install --no-cache /wheels/*
This is my updated Dockerfile.prod
###########
# BUILDER #
###########
# pull official base image
FROM python:3.8.3-alpine as builder
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install psycopg2 dependencies
RUN apk update \
&& apk add postgresql-dev gcc python3-dev musl-dev libffi-dev openssl-dev
# lint
RUN pip install --upgrade pip
# RUN pip install flake8
COPY . .
# RUN flake8 --ignore=E501,F401 .
# install dependencies
COPY ./requirements.txt .
RUN apk --update add \
build-base \
jpeg-dev \
zlib-dev
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt
#########
# FINAL #
#########
# pull official base image
FROM python:3.8.3-alpine
# create directory for the app user
RUN mkdir -p /home/app
# create the app user
RUN addgroup -S app && adduser -S app -G app
# create the appropriate directories
ENV HOME=/home/app
ENV APP_HOME=/home/app/web
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
# install dependencies
RUN apk update && apk add libpq
COPY --from=builder /usr/src/app/wheels /wheels
COPY --from=builder /usr/src/app/requirements.txt .
RUN pip install --no-cache /wheels/*
# copy entrypoint-prod.sh
COPY ./entrypoint.prod.sh $APP_HOME
# copy project
COPY . $APP_HOME
# chown all the files to the app user
RUN chown -R app:app $APP_HOME
# change to the app user
USER app
# run entrypoint.prod.sh
ENTRYPOINT ["/home/app/web/entrypoint.prod.sh"]
The following is the error I get
Step 21/26 : RUN pip install --no-cache /wheels/*
---> Running in 2edb399fffff
Processing /wheels/DateTimeRange-1.0.0-py3-none-any.whl
Processing /wheels/Django-3.1-py3-none-any.whl
Processing /wheels/Jinja2-2.11.2-py2.py3-none-any.whl
Processing /wheels/Markdown-3.2.2-py3-none-any.whl
Processing /wheels/MarkupSafe-1.1.1-cp38-cp38-linux_x86_64.whl
Processing /wheels/Pillow-7.2.0-cp38-cp38-linux_x86_64.whl
Processing /wheels/asgiref-3.2.10-py3-none-any.whl
Processing /wheels/certifi-2020.6.20-py2.py3-none-any.whl
Processing /wheels/chardet-3.0.4-py2.py3-none-any.whl
Processing /wheels/coreapi-2.3.3-py2.py3-none-any.whl
Processing /wheels/coreschema-0.0.4-py3-none-any.whl
Processing /wheels/dj_database_url-0.5.0-py2.py3-none-any.whl
Processing /wheels/django_cors_headers-3.6.0-py3-none-any.whl
Processing /wheels/django_filter-2.3.0-py3-none-any.whl
Processing /wheels/django_import_export-2.3.0-py3-none-any.whl
Processing /wheels/django_microsoft_auth-2.4.0-py2.py3-none-any.whl
Processing /wheels/django_rest_swagger-2.1.0-py2.py3-none-any.whl
Processing /wheels/djangorestframework-3.11.1-py3-none-any.whl
Processing /wheels/djangorestframework_gis-0.14-py2.py3-none-any.whl
Processing /wheels/djangorestframework_jwt-1.11.0-py2.py3-none-any.whl
Processing /wheels/djangorestframework_simplejwt-4.3.0-py3-none-any.whl
Processing /wheels/drf_msal_jwt-0.4.0-py2.py3-none-any.whl
Processing /wheels/gunicorn-20.0.4-py2.py3-none-any.whl
Processing /wheels/idna-2.10-py2.py3-none-any.whl
Processing /wheels/importlib_metadata-1.7.0-py2.py3-none-any.whl
Processing /wheels/itypes-1.2.0-py2.py3-none-any.whl
Processing /wheels/openapi_codec-1.3.2-py3-none-any.whl
Processing /wheels/pandas-1.1.2-cp38-cp38-linux_x86_64.whl
Processing /wheels/psycopg2_binary-2.8.5-cp38-cp38-linux_x86_64.whl
Processing /wheels/pytz-2020.1-py2.py3-none-any.whl
Processing /wheels/requests-2.24.0-py2.py3-none-any.whl
Processing /wheels/simplejson-3.17.2-cp38-cp38-linux_x86_64.whl
Processing /wheels/smartsheet_python_sdk-2.105.1-py2.py3-none-any.whl
Processing /wheels/sqlparse-0.3.1-py2.py3-none-any.whl
Processing /wheels/uritemplate-3.0.1-py2.py3-none-any.whl
Processing /wheels/urllib3-1.25.10-py2.py3-none-any.whl
Processing /wheels/zipp-3.1.0-py3-none-any.whl
Collecting typepy[datetime]<2,>=1.0.0
Downloading typepy-1.1.2-py3-none-any.whl (30 kB)
Collecting python-dateutil<3,>=2.4.2
Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Requirement already satisfied: setuptools>=38.3.0 in /usr/local/lib/python3.8/site-packages (from DateTimeRange==1.0.0) (47.1.1)
Collecting diff-match-patch
Downloading diff_match_patch-20200713-py3-none-any.whl (61 kB)
Collecting tablib[html,ods,xls,xlsx,yaml]>=0.14.0
Downloading tablib-3.0.0-py3-none-any.whl (47 kB)
Collecting cryptography
Downloading cryptography-3.3.1.tar.gz (539 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python /usr/local/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-mytrl8h6/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.12; platform_python_implementation != '"'"'PyPy'"'"''
cwd: None
Complete output (127 lines):
WARNING: The directory '/home/app/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting setuptools>=40.6.0
Downloading setuptools-52.0.0-py3-none-any.whl (784 kB)
Collecting wheel
Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Collecting cffi>=1.12
Downloading cffi-1.14.4.tar.gz (471 kB)
Collecting pycparser
Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
Building wheels for collected packages: cffi
Building wheel for cffi (setup.py): started
Building wheel for cffi (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6fztua11/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6fztua11/cffi/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-qyffv65y
cwd: /tmp/pip-install-6fztua11/cffi/
Complete output (48 lines):
unable to execute 'gcc': No such file or directory
unable to execute 'gcc': No such file or directory
No working compiler found, or bogus compiler options passed to
the compiler from Python's standard "distutils" module. See
the error messages above. Likely, the problem is not related
to CFFI but generic to the setup.py of any Python package that
tries to compile C code. (Hints: on OS/X 10.8, for errors about
-mno-fused-madd see http://stackoverflow.com/questions/22313407/
Otherwise, see https://wiki.python.org/moin/CompLangPython or
the IRC channel #python on irc.freenode.net.)
Trying to continue anyway. If you are trying to install CFFI from
a build done in a different context, you can ignore this warning.
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/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/error.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.8/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/c
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.8/c/_cffi_backend.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for cffi
Running setup.py clean for cffi
Failed to build cffi
Installing collected packages: setuptools, wheel, pycparser, cffi
Running setup.py install for cffi: started
Running setup.py install for cffi: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6fztua11/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6fztua11/cffi/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-zfw6b2gn/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-mytrl8h6/overlay --compile --install-headers /tmp/pip-build-env-mytrl8h6/overlay/include/python3.8/cffi
cwd: /tmp/pip-install-6fztua11/cffi/
Complete output (48 lines):
unable to execute 'gcc': No such file or directory
unable to execute 'gcc': No such file or directory
No working compiler found, or bogus compiler options passed to
the compiler from Python's standard "distutils" module. See
the error messages above. Likely, the problem is not related
to CFFI but generic to the setup.py of any Python package that
tries to compile C code. (Hints: on OS/X 10.8, for errors about
-mno-fused-madd see http://stackoverflow.com/questions/22313407/
Otherwise, see https://wiki.python.org/moin/CompLangPython or
the IRC channel #python on irc.freenode.net.)
Trying to continue anyway. If you are trying to install CFFI from
a build done in a different context, you can ignore this warning.
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/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/error.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.8/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/c
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.8/c/_cffi_backend.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6fztua11/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6fztua11/cffi/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-zfw6b2gn/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-mytrl8h6/overlay --compile --install-headers /tmp/pip-build-env-mytrl8h6/overlay/include/python3.8/cffi Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 21.0 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-mytrl8h6/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.12; platform_python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 21.0 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
What should I do next?
Thanks to #DawidGacek advice, I have added the dependencies for both the containers, and now it works fine. This is the final working Dockerfile.prod [Note: I have just commented out the flake8 lint checker, If you need the same just uncomment it]
###########
# BUILDER #
###########
# pull official base image
FROM python:3.8.3-alpine as builder
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install psycopg2 dependencies
RUN apk update \
&& apk add postgresql-dev gcc python3-dev musl-dev libffi-dev openssl-dev
# install other dependencies
RUN apk --update add \
build-base \
jpeg-dev \
zlib-dev
# lint
# RUN pip install --upgrade pip
# RUN pip install flake8
# COPY . .
# RUN flake8 --ignore=E501,F401 .
# install dependencies
COPY ./requirements.txt .
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt
#########
# FINAL #
#########
# pull official base image
FROM python:3.8.3-alpine
# create directory for the app user
RUN mkdir -p /home/app
# create the app user
RUN addgroup -S app && adduser -S app -G app
# create the appropriate directories
ENV HOME=/home/app
ENV APP_HOME=/home/app/web
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
# install psycopg2 dependencies
RUN apk update \
&& apk add postgresql-dev gcc python3-dev musl-dev libffi-dev openssl-dev
# install other dependencies
RUN apk update && apk add libpq
RUN apk --update add \
build-base \
jpeg-dev \
zlib-dev
COPY --from=builder /usr/src/app/wheels /wheels
COPY --from=builder /usr/src/app/requirements.txt .
RUN pip install --no-cache /wheels/*
# copy entrypoint-prod.sh
COPY ./entrypoint.prod.sh $APP_HOME
# copy project
COPY . $APP_HOME
# chown all the files to the app user
RUN chown -R app:app $APP_HOME
# change to the app user
USER app
# run entrypoint.prod.sh
ENTRYPOINT ["/home/app/web/entrypoint.prod.sh"]
I'm trying to run on Mac Os high Sierra
pip install MySQL-python
But I'm getting
error: command 'cc' failed with exit status 1
I already tried the solution on this topic, but it didn't work.
This is the full error message
The directory '/Users/filipeferminiano/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/filipeferminiano/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting MySQL-python
Downloading https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 112kB 289kB/s
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python ... error
Complete output from command /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-8I1X5u/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-z5HohX/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.13-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.13-intel-2.7
creating build/lib.macosx-10.13-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
creating build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.13-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/8.0.11/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.13-intel-2.7/_mysql.o
_mysql.c:44:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-8I1X5u/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-z5HohX/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-8I1X5u/MySQL-python/
This is the python
which python
/usr/bin/python
and this is the pip I'm using
which pip
/usr/local/bin/pip
First, are you sure you want to use MySQL-python? This is a mostly-dead project that's been semi-maintained for legacy support for the past half decade, and doesn't even work with current versions of MySQL. It wants 5.0 or maybe 5.1; the current version is 8.0, and even the current legacy version is 5.7.
Other options include:
mysql-connector, aka MySQLConnector/Python: This is the officially supported library, from MySQL/Oracle. It can be a bit slow, which doesn't matter for most projects, but it can sometimes. It also has a different API (although if you stick to DB-API 2 methods, the only difference is the connect call; beyond that it should just be low-level stuff that's different).
mysqlclient: This is the package that Django and some other frameworks use. It's an updated fork of MySQL-Python (with a few things from its abandoned successor, moist). It can even be configured to install itself as MySQLdb, the same name used by MySQL-python.
PyMySQL: A third-party package built to be as compatible as possible with the old MySQL-python but simpler and easier to maintain, and install.
cmysql, a fork of PyMySQL that's only slightly harder to install, but should be faster than it, or than mysql-connector.
Some linux distros—including, IIRC, recent versions of Ubuntu—provide a package named python-MySQLdb or similar that is not actually MySQL-python, but instead mysqlclient built with the install-as-MySQLdb option. So, if the only reason that you're trying to use MySQL-python is that it's what you were using on some Ubuntu box, it's probably not what you were using, and therefore not what you want.
Some of these alternative also require MySQL (specifically, MySQLConnector/C, aka libmysqlclient, and its development libraries), some don't—but they're all compatible with current versions. (Although there are some notes on 8.0 crypto changes in the docs for PyMySQL and cmysql, which you might want to read if you use 8.0.)
Anyway, if you really want MySQL-python, then you will need to install MySQL in a 5.x version. The INSTALL points you to MySQL downloads.
If you want 5.0 or 5.1, you will have to dig through the Downloads folder at one of the mirrors to find a source package and follow the instructions to build and install it, since there are no binary installers that work on current Macs.
If you want later 5.x versions—which, remember, are not supported by MySQL-python, but they might work—Oracle is still providing Mac binary installers for those. If you can't find them in the main downloads section, the mirrors' Downloads folder will have them. As of right now, 5.6 and 5.7 have binary installer packages that end with -macos10.13-x86_64.dmg.
However, you might be happier installing it with Homebrew. Follow the instructions on that page to install brew, then to use it to:
brew install mysql#5.5
MySQL-python also requires OpenSSL libraries, and Apple deliberately hides the ones used by the OS to prevent people from accidentally building code against an old version and not getting security updates. The newer libraries should all know how to handle this, but MySQL-python does not. The easiest way to install a usable OpenSSL is with Homebrew again:
brew install openssl
But don't just run that command and close the window. Read the output, because you have to do all the stuff it says if you want MySQL-python to build.
My issue was that I was using MySql Version 8.0.12. As soon as I downgraded to MySQL 5.7, it was installed perfectly. I used the following to delete the version 8 by following: https://gist.github.com/vitorbritto/0555879fe4414d18569d
The gist of the above was:
Check for MySQL processes with: ps -ax | grep mysql
Stop and kill any MySQL processes
brew remove mysql
brew cleanup
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/mysql
Restart your computer just to ensure any MySQL processes are killed
install mysql using brew: brew install mysql#5.7
Finally, pip install mysql-python
abamert's answer did not work for me. Though this did, you might try skipping the first step,
brew install mysql-connector-c
brew install mysql
brew link --overwrite mysql
pip install MySQL-python
I'm having trouble while installing PyGraphviz.
I'm using Anaconda in Mac OS X.
Error messages indicates some reasons, but I already checked out it is installed in anaconda directory.
Sundongui-MacBook-Pro:site-packages sundong$ pwd
/Users/sundong/anaconda/lib/python2.7/site-packages
Sundongui-MacBook-Pro:site-packages sundong$ pip install graphviz --upgrade
Requirement already up-to-date: graphviz in /Users/sundong/anaconda/lib/python2.7/site-packages
According to the error messages, How can I change the the include_dirs and library_dirs variables in setup.py??
Here is the error message that I meet
Sundongui-MacBook-Pro:anaconda sundong$ pip install pygraphviz
Collecting pygraphviz
Using cached pygraphviz-1.3.1.tar.gz
Building wheels for collected packages: pygraphviz
Running setup.py bdist_wheel for pygraphviz
Complete output from command /Users/sundong/anaconda/bin/python -c "import setuptools;__file__='/private/var/folders/p6/rjy4tf353bzfy7gsl5jn_yvc0000gn/T/pip-build-bLb4AR/pygraphviz/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/p6/rjy4tf353bzfy7gsl5jn_yvc0000gn/T/tmpwR_08Dpip-wheel-:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.5-x86_64-2.7
creating build/lib.macosx-10.5-x86_64-2.7/pygraphviz
copying pygraphviz/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz
copying pygraphviz/agraph.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz
copying pygraphviz/graphviz.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz
copying pygraphviz/release.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz
copying pygraphviz/version.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz
creating build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_attributes.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_clear.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_drawing.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_edge_attributes.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_graph.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_html.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_layout.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_node_attributes.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_readwrite.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_string.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_subgraph.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
copying pygraphviz/tests/test_unicode.py -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz/tests
running egg_info
writing pygraphviz.egg-info/PKG-INFO
writing top-level names to pygraphviz.egg-info/top_level.txt
writing dependency_links to pygraphviz.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'pygraphviz.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
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.macosx-10.5-x86_64-2.7/pygraphviz
copying pygraphviz/graphviz_wrap.c -> build/lib.macosx-10.5-x86_64-2.7/pygraphviz
running build_ext
building 'pygraphviz._graphviz' extension
creating build/temp.macosx-10.5-x86_64-2.7
creating build/temp.macosx-10.5-x86_64-2.7/pygraphviz
gcc -fno-strict-aliasing -I/Users/sundong/anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/sundong/anaconda/include/python2.7 -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.5-x86_64-2.7/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c:2954:10: fatal error: 'graphviz/cgraph.h' file not found
#include "graphviz/cgraph.h"
^
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pygraphviz
Failed to build pygraphviz
Installing collected packages: pygraphviz
Running setup.py install for pygraphviz
Complete output from command /Users/sundong/anaconda/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/p6/rjy4tf353bzfy7gsl5jn_yvc0000gn/T/pip-build-bLb4AR/pygraphviz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/p6/rjy4tf353bzfy7gsl5jn_yvc0000gn/T/pip-qgosXm-record/install-record.txt --single-version-externally-managed --compile:
running install
Trying pkg-config
Failed to find pkg-config
Trying dotneato-config
Failed to find dotneato-config
Failed to find dotneato-config
Your Graphviz installation could not be found.
1) You don't have Graphviz installed:
Install Graphviz (http://graphviz.org)
2) Your Graphviz package might incomplete.
Install the binary development subpackage (e.g. libgraphviz-dev or similar.)
3) You are using Windows
There are no PyGraphviz binary packages for Windows but you might be
able to build it from this source. See
http://networkx.lanl.gov/pygraphviz/reference/faq.html
If you think your installation is correct you will need to manually
change the include_dirs and library_dirs variables in setup.py to
point to the correct locations of your graphviz installation.
The current setting of library_dirs and include_dirs is:
library_dirs=None
include_dirs=None
error: Error locating graphviz.
----------------------------------------
Command "/Users/sundong/anaconda/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/p6/rjy4tf353bzfy7gsl5jn_yvc0000gn/T/pip-build-bLb4AR/pygraphviz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/p6/rjy4tf353bzfy7gsl5jn_yvc0000gn/T/pip-qgosXm-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/p6/rjy4tf353bzfy7gsl5jn_yvc0000gn/T/pip-build-bLb4AR/pygraphviz
brew install graphviz
then:
pip install --install-option="--include-path=/usr/local/include/" --install-option="--library-path=/usr/local/lib/" pygraphviz
Both path in bold should NOT contain "graphviz".
https://github.com/pygraphviz/pygraphviz/issues/100#issuecomment-237560404
Worked for me on OSX 10.14.1
Assuming that you've already installed graphviz software:
As described in this blog post use the following parameters whilst trying to run pip install pygraphviz
--install-option="--include-path=/usr/local/include/graphviz/" \
--install-option="--library-path=/usr/local/lib/graphviz"
So the final command would look like pip install pygraphviz --install-option="--include-path=/usr/local/include/graphviz/" --install-option="--library-path=/usr/local/lib/graphviz".
What this does is this explicitly specified where the libraries of the original program (graphviz) exist for the python extension to use. Unfortunately, this doesn't seem to get automatically recognized.
Worked on MacOS Sierra with Python 3.6
try the following (make sure to have anaconda-client installed and updated):
conda install --channel https://conda.anaconda.org/garylschultz pygraphviz
Graphviz can be installed via homebrew: brew install graphviz.
Then do:
cd /usr/local/Cellar/graphviz/VERSION/include/graphviz
mkdir graphviz
cp cgraph.h graphviz/
And finally:
pip install graphviz
Tested on Sierra and woks fine.