Error while installing PyGraphviz (Mac OS X, Anaconda) - 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.

Related

How does one install pygraphviz on a HPC cluster without errors even when graphviz seems to be installed?

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.

Why cant I install mysqlclient==1.3.10

I'm using a new MacOS High Sierra 10.13.5.
I first installed python3 using Homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install python
then I cloned my python project repository from github which has a requirements.txt file which has the line:
mysqlclient==1.3.10
I then created a virtual env and ran pip install:
python3 -m venv venv
pip install -r api/requirements.txt
and then I get the following error:
...
...
Installing collected packages: six, python-dateutil, aniso8601,
appdirs, jmespath, docutils, botocore, s3transfer, boto3, click, Werkzeug, itsdangerous, MarkupSafe, Jinja2, Flask, Flask-Cors, blinker, Flask-Mail, jsonschema, pytz, flask-restplus, Flask-Script, SQLAlchemy, Flask-SQLAlchemy, Flask-SQLAlchemy-Session, Mako, python-editor, alembic, Flask-Migrate, PyJWT, Flask-JWT-Simple, idna, pycparser, cffi, asn1crypto, cryptography, chardet, certifi, urllib3, requests, nexmo, pyparsing, packaging, Pillow, phonenumbers, numpy, timezonefinder, decorator, ratelim, geocoder, SQLAlchemy-Utils, mysqlclient, pycrypto, simple-crypt, suds-jurko, Salesforce-FuelSDK, schedule, python-utils, progressbar2, timeago
Running setup.py install for aniso8601 ... done
Running setup.py install for itsdangerous ... done
Running setup.py install for MarkupSafe ... done
Running setup.py install for blinker ... done
Running setup.py install for Flask-Mail ... done
Running setup.py install for Flask-Script ... done
Running setup.py install for SQLAlchemy ... done
Running setup.py install for Flask-SQLAlchemy-Session ... done
Running setup.py install for Mako ... done
Running setup.py install for python-editor ... done
Running setup.py install for Flask-JWT-Simple ... done
Running setup.py install for pycparser ... done
Running setup.py install for geocoder ... done
Running setup.py install for SQLAlchemy-Utils ... done
Running setup.py install for mysqlclient ... error
Complete output from command /Users/mvi/mvi/server/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/zh/p8bfpbd166758zz6vj60jd100000gn/T/pip-install-vls9kk27/mysqlclient/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/var/folders/zh/p8bfpbd166758zz6vj60jd100000gn/T/pip-record-6eq5p42p/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mvi/mvi/server/venv/include/site/python3.7/mysqlclient:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.13-x86_64-3.7
copying _mysql_exceptions.py -> build/lib.macosx-10.13-x86_64-3.7
creating build/lib.macosx-10.13-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb
creating build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.13-x86_64-3.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.13-x86_64-3.7
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Dversion_info=(1,3,10,'final',0) -D__version__=1.3.10 -I/usr/local/mysql/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/Users/mvi/mvi/server/venv/include -I/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c _mysql.c -o build/temp.macosx-10.13-x86_64-3.7/_mysql.o
_mysql.c:29:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/Users/mvi/mvi/server/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/zh/p8bfpbd166758zz6vj60jd100000gn/T/pip-install-vls9kk27/mysqlclient/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/var/folders/zh/p8bfpbd166758zz6vj60jd100000gn/T/pip-record-6eq5p42p/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mvi/mvi/server/venv/include/site/python3.7/mysqlclient" failed with error code 1 in /private/var/folders/zh/p8bfpbd166758zz6vj60jd100000gn/T/pip-install-vls9kk27/mysqlclient/
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
On my old mac book pro where I did not have this problem.
On that macbook I have python 3.6.5 using GCC 4.2.1.
On this new macbook I have python 3.7 using clang 9.1.0
(venv) $ python
Python 3.7.0 (default, Aug 22 2018, 15:22:33)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
This article is the only thing I can that seems related but doesnt seem to help much...
https://medium.com/#MrWeeble/homebrew-on-mac-and-pythons-mysqlclient-ea44fa300e70
any ideas for debugging would be appreciated. Thanks.
You need the MySQL client library and its related headers.
These are supplied in e.g. the MariaDB (MySQL fork) package in Brew, so brew install mariadb should do the trick.

Can't Install mysql- for Python / Django (Windows)

I'm trying to download through pip the MySql-python connector as following, however im getting an error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).
C:\Users\yschellekens.INTRANET\Desktop\Django project\general>pip install MySQL-
python
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.
Collecting MySQL-python
Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: MySQL-python
Running setup.py bdist_wheel for MySQL-python
Complete output from command C:\Python33\python.exe -c "import setuptools;__fi
le__='c:\\users\\yschel~1.int\\appdata\\local\\temp\\pip-build-wc92bo\\MySQL-pyt
hon\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file_
_, 'exec'))" bdist_wheel -d c:\users\yschel~1.int\appdata\local\temp\tmpc71e54pi
p-wheel-:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.3
copying _mysql_exceptions.py -> build\lib.win32-3.3
creating build\lib.win32-3.3\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.3\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.3\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.3\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.3\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.3\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.3\MySQLdb
creating build\lib.win32-3.3\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.3\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.3\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.3\MySQLdb\constan
ts
copying MySQLdb\constants\ER.py -> build\lib.win32-3.3\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.3\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.3\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.3\MySQLdb\constants
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).
----------------------------------------
Failed building wheel for MySQL-python
Failed to build MySQL-python
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python
Complete output from command C:\Python33\python.exe -c "import setuptools, t
okenize;__file__='c:\\users\\yschel~1.int\\appdata\\local\\temp\\pip-build-wc92b
o\\MySQL-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__
).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\ys
chel~1.int\appdata\local\temp\pip-ckxp_c-record\install-record.txt --single-vers
ion-externally-managed --compile:
running install
running build
running build_py
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).
----------------------------------------
Command "C:\Python33\python.exe -c "import setuptools, tokenize;__file__='c:\\us
ers\\yschel~1.int\\appdata\\local\\temp\\pip-build-wc92bo\\MySQL-python\\setup.p
y';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n',
'\n'), __file__, 'exec'))" install --record c:\users\yschel~1.int\appdata\local
\temp\pip-ckxp_c-record\install-record.txt --single-version-externally-managed -
-compile" failed with error code 1 in c:\users\yschel~1.int\appdata\local\temp\p
ip-build-wc92bo\MySQL-python
I found this wonderful question, which was very helpful:
Install mysql-python (Windows)
But im still running into issues, i know that i can download Visual Studio 2010 but i saw people who mention that its not necessary, and i prefer not to download it.
Here are my PYTHONPATH + PATH
PATH:
C:\Tools\OpenVPN\bin;C:\Python33\;C:\Program Files\Java\jdk1.7.0_15\bin;C:\Program Files\Java\jdk1.7.0_15\jre\bin\server;C:\Python33\Lib\site-packages;C:\Python33\Lib;C:\Python33\DLLs;C:\Python33\Lib\lib-tk;C:\Python33\Scripts;C:\Windows\System32;C:\Program Files\MySQL\MySQL Server 5.6\bin
PYTHONPATH
C:\Python33;C:\Python33\Lib\site-packages;C:\Python33\Lib;C:\Python33\DLLs;C:\Python33\Lib\lib-tk;C:\Python33\Scripts
Did i miss anything?
Any help in that would be great!
What you need is to have Microsoft Visual C++ 10.0 compiler (and as far as I remember version 10.0 doesn't necessarily mean Visual Studio 2010) installed on your system and vcvarsall.bat accessible from PATH environment variable.
However, it is usual for Windows to have enormous amount of blocking issues connected with compiling python extensions via pip (or it's just me?), so my usual workaround of the error you get is to google some Windows binary installers (mysql-python for 2.7 for instance) or .whl files. Both have python extensions compiled for a particular Python and architecture thus eliminating the need in having C or C++ compiler installed.

How to pip install cairocffi?

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.

I can't install Gevent

I need to install Gevent for python2.7 but after try almost all I still doesn't install it.
I have python 2.6.6 and here all work ok... but I need python2.7+ then I install python 2.7.9 and now have only problems...
Before some part of my project work in python 2.6 ok, but now my project doesn't run witn 2.6 and 2.7, dunno why it's stop working with 2.6 but nvm I need it with 2.7 but.... I cant instal gevent, I have installed libevent-devel an greenlet but I can't instal gevent
# pip2.7 install gevent
Collecting gevent
Using cached gevent-1.0.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): greenlet in /usr/local/lib/python2.7/site-packages (from gevent)
Installing collected packages: gevent
Running setup.py install for gevent
configure: error: in `/tmp/pip-build-fpnLvN/gevent/build/temp.linux-x86_64-2.7/libev':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Running '/bin/sh /tmp/pip-build-fpnLvN/gevent/libev/configure > configure-output.txt' in /tmp/pip-build-fpnLvN/gevent/build/temp.linux-x86_64-2.7/libev
building 'gevent.core' extension
ccache gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_PERIODIC_ENABLE=0 -Ibuild/temp.linux-x86_64-2.7/libev -Ilibev -I/usr/local/include/python2.7 -c gevent/gevent.core.c -o build/temp.linux-x86_64-2.7/gevent/gevent.core.o
In file included from gevent/libev.h:2,
from gevent/gevent.core.c:313:
libev/ev.c:45:22: error: config.h: No such file or directory
libev/ev.c:477:48: warning: "/*" within comment
In file included from gevent/libev.h:2,
from gevent/gevent.core.c:313:
libev/ev.c:1531: warning: ‘ev_default_loop_ptr’ initialized and declared ‘extern’
In file included from gevent/libev.h:2,
from gevent/gevent.core.c:313:
libev/ev.c: In function ‘ev_io_start’:
libev/ev.c:3554: warning: suggest parentheses around arithmetic in operand of ‘|’
libev/ev.c:4795:27: warning: "/*" within comment
libev/ev.c:4796:27: warning: "/*" within comment
error: command 'ccache' failed with exit status 1
Complete output from command /usr/local/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-fpnLvN/gevent/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ruy7Xb-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/gevent
copying gevent/resolver_thread.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/socket.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/threadpool.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/util.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/__init__.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/monkey.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/queue.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/coros.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/server.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/_threading.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/thread.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/select.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/hub.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/fileobject.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/wsgi.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/pywsgi.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/event.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/greenlet.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/ssl.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/local.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/subprocess.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/threading.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/os.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/win32util.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/baseserver.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/lock.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/backdoor.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/pool.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/resolver_ares.py -> build/lib.linux-x86_64-2.7/gevent
copying gevent/timeout.py -> build/lib.linux-x86_64-2.7/gevent
running build_ext
configure: error: in `/tmp/pip-build-fpnLvN/gevent/build/temp.linux-x86_64-2.7/libev':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Running '/bin/sh /tmp/pip-build-fpnLvN/gevent/libev/configure > configure-output.txt' in /tmp/pip-build-fpnLvN/gevent/build/temp.linux-x86_64-2.7/libev
building 'gevent.core' extension
creating build/temp.linux-x86_64-2.7/gevent
ccache gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_PERIODIC_ENABLE=0 -Ibuild/temp.linux-x86_64-2.7/libev -Ilibev -I/usr/local/include/python2.7 -c gevent/gevent.core.c -o build/temp.linux-x86_64-2.7/gevent/gevent.core.o
In file included from gevent/libev.h:2,
from gevent/gevent.core.c:313:
libev/ev.c:45:22: error: config.h: No such file or directory
libev/ev.c:477:48: warning: "/*" within comment
In file included from gevent/libev.h:2,
from gevent/gevent.core.c:313:
libev/ev.c:1531: warning: ‘ev_default_loop_ptr’ initialized and declared ‘extern’
In file included from gevent/libev.h:2,
from gevent/gevent.core.c:313:
libev/ev.c: In function ‘ev_io_start’:
libev/ev.c:3554: warning: suggest parentheses around arithmetic in operand of ‘|’
libev/ev.c:4795:27: warning: "/*" within comment
libev/ev.c:4796:27: warning: "/*" within comment
error: command 'ccache' failed with exit status 1
----------------------------------------
Command "/usr/local/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-fpnLvN/gevent/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ruy7Xb-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-fpnLvN/gevent
Installing this worked for me,
sudo apt-get install libevent-dev
sudo apt-get install python-all-dev
and then,
pip install greenlet
pip install gevent
There is solution for my problem enter link description here
Probably this is most important (in place of python2.X type your python ver. eg. python2.7)
export PYTHONPATH=$HOME/.local/lib/python/site-packages:$PYTHONPATH
export PYTHONPATH=$HOME/.local/lib/python2.X/site-packages:$PYTHONPATH
export PATH=$HOME/.local/bin:$PATH
It worked for me. First remove gevent from Pipfile.lock
"gevent": {
"hashes": [
"sha256:004cdbc6c18b4076acfa256c1794abf87bf9b97e0cfd4136f5098535c4b4132e",
"sha256:3ae1ca0f533ddcb17aab16ce66b424b3f3b855ff3b9508526915d3c6b73fba31",
"sha256:704a048005e6389fcb8276113bb9e7d0a3160bc382b9bcc629e398a43645de5c",
"sha256:80ee22c28dae6dc70c7e4385f0d0292da9eebccf14b90620a32f10d71797838e",
"sha256:aa224957cbbc028bbdfbec89625c7efa66bb8ddb845ed2fe323bd6b24e919dcf",
"sha256:f3e8656f0b7bce355f14896d0b644c0a91e01fa12d9d65e6b09faad1d2c06e65"
],
"index": "pypi",
"version": "==1.0.2"
}
Then install gevent manually pipenv install gevent
Hope it will work for you.
Had a similar issue, upgrading pip with
pip install --upgrade pip
worked for me. Make sure you have the latest version. In my case, I assumed making a new virtual environment automatically provides the latest version but I was wrong.
I managed to solve this same issue on my raspberry pi zero by using a compiled binary instead of pip.
sudo apt-get install python-gevent
Besides:
sudo apt-get install libevent-dev
sudo apt-get install python-all-dev
I also need to install (I used python3) to solve similar issue
sudo apt-get install python3-dev
I tried installing a bunch of other packages as described by some of the other answers, so not sure if any of those helped, but the thing that got it working in the end was using easy_install rather than pip:
easy_install gevent
I was getting errors trying to install gevent-websocket 0.10.1 however the problem was solved when I installed greenlet:
pip3 install greenlet
first and then:
pip3 install gevent-websocket

Categories

Resources