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
Related
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.
Trying to get a server ready for a django project and I'm running into some issues with setup for postgres.
I'm following this guide:
https://jee-appy.blogspot.com/2017/01/deply-django-with-nginx.html
And I'm at step 5:
Now, we need to configure postgreSQL so that it can communicate with our Django application. For this, install psycopg2 database
adapter. But this adapter have some package dependencies, so first
install them.
run:
(django_env) $ sudo apt-get install libpq-dev python3-dev
then...
(django_env) $ pip install psycopg2
I do that, and this point in the instructions, I get a "compilation failed" error.
I tried the solutions suggested in this stack exchange question:
Trouble with psycopg2 in virtualenv python3 for use with Django
and this one:
Cannot install psycopg2 on virtualenv
I am very much a linux and django noob, so if this is a duplicate issue, please have mercy on me and leave a comment explaining why you are marking it as a duplicate as you do so.
Thanks for your time!
Here's the output and install command that caused it:
(django_env1) user:/home/projects/sample_project$ sudo pip install psycopg2
Downloading/unpacking psycopg2
Downloading psycopg2-2.7.3.2.tar.gz (425kB): 425kB downloaded
Running setup.py (path:/tmp/pip_build_root/psycopg2/setup.py) egg_info for package psycopg2
Installing collected packages: psycopg2
Running setup.py install for psycopg2
building 'psycopg2._psycopg' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.7.3.2 (dt dec pq3 ext lo64)" -DPG_VERSION_NUM=90320 -DHAVE_LO64=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:27:0:
./psycopg/psycopg.h:34:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_0zc1L-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/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-2.7/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-2.7/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-2.7/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-2.7/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-2.7/psycopg2
copying lib/psycopg1.py -> build/lib.linux-x86_64-2.7/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-2.7/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-2.7/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-2.7/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-2.7/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-2.7/psycopg2
creating build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_bug_gc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_types_extras.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_async_keyword.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_sql.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_ipaddress.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_fast_executemany.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/__init__.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_copy.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_with.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_connection.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_module.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_replication.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_dates.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_bugX000.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/testconfig.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_errcodes.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_transaction.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_async.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/testutils.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_cursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_quote.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_notify.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_lobject.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_cancel.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_green.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
copying tests/test_types_basic.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/psycopg
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.7.3.2 (dt dec pq3 ext lo64)" -DPG_VERSION_NUM=90320 -DHAVE_LO64=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:27:0:
./psycopg/psycopg.h:34:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_0zc1L-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/psycopg2
You've installed the python-dev libraries for Python 3. Your psycopg2 install is using python 2.7
If you want to use Python 3:
Make sure you've installed python3-pip
sudo apt-get install python3-pip
Then:
pip3 install psycopg2
If that still fails, try installing the development headers for postgresql:
sudo apt install python3-dev libpq-dev
pip3 install psycopg2
If on Python 2
sudo apt update
sudo apt-get install postgresql postgresql-contrib
sudo apt-get install libpq-dev
sudo apt-get install python-dev
sudo apt-get install python-pip
pip2 install psycopg2-binary
If on Ubuntu 20.04 or above
sudo apt-get install build-essential
Then run the other steps for either Python 2 or 3.
Note that on many distros, the development headers needed for compiling against libraries are not installed by default. For psycopg2 on Ubuntu you'll need the python3 and postgresql headers:
sudo apt install python3-dev libpq-dev
pip3 install psycopg2
These can be installed in your activated virtual environment.
I was testing my application on a ubuntu docker image that only has python2.7.6 installed (as happens in most big orgs)
If you are using python2.x (though you should plan to move to 3.x asap), check the below dependencies:
sudo apt update
sudo apt-get install postgresql postgresql-contrib
sudo apt-get install libpq-dev # this is required as psycopg2 uses pg_config
sudo apt-get install python-dev
sudo apt-get install python-pip
Now install psycopg2 using:
pip2 install psycopg2-binary
I had the same error trying to install it in a virtualenv (with python3)
I solved it by installing a previous version of psycopg2.
pip install psycopg2==2.7.5
This solved mine. I am using Python 3.8.2, Ubuntu 20.04 LTS:
sudo apt-get install python3-dev
sudo apt-get install python3-pip
pip install psycopg2
To install psycopg2 in ubuntu or mate 20 you need first to install:
sudo apt install libpq-dev
and then:
pip3 install psycopg2
In my case, I was facing this problem when I ran pip install -r requirements.txt to install all packages for a Django project on an Ubuntu machine, I ran into this error and many other installation errors.
To solve this one, I ran the following commands:
sudo apt install postgresql postgresql-contrib
sudo apt install libpq-dev
sudo apt install python3-dev
sudo apt install python3-pip
sudo apt install python3-psycopg2
pip3 install psycopg2
pip3 install psycopg2-binary
Plus, also check if the Ubuntu and Python and Psycopg versions are compatible together.
Also, #Arghya Bhattacharya answers pip install aiopg, solve the issue when i ran into it the second time.
I had to install this one as well on my Ubuntu 20.04 LTS:
sudo apt-get install build-essential
I faced same issue on my ubuntu 18.04 LTS OS.
Also, face some issues in Pillow. In both cases (psycopg2 and Pillow) these command solved my issue.
sudo apt install -y build-essential libssl-dev libffi-dev python3-dev libjpeg-dev libjpeg8-dev
sudo apt install libpq-dev
sudo apt-get install python3-pip
Note: I have installed psycopg2 in python=3.8.5 environment.
make sure you are using the correct psycopg version for the python version.
Example for python 3.8.
python 3.8, the supported version is psycopg 2.8.4.
Reference ubuntu 20.04 + python 3.8 , pip install psycopg2==2.7.3.2 error #1106
I solved this issue using another package which itself internally installs psycopg2.
pip install aiopg
I want to migrate my database from SQLite to MariaDB. Running Ubuntu 14.04, Django 1.10 and Python 3.5. Digital Ocean has a guide, but it silently assumes one is using Python 2.x, not 3.x. They use the default mySQL connector, MySQLdb. This does not work for python 3.x. According to Django docs, the preferred alternative is mysqlsclient:
pip install mysqlclient
But this gives:
Collecting mysqlclient
Using cached mysqlclient-1.3.9.tar.gz
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient ... error
Complete output from command /django/env/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3_5btd8o/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp39x31avopip-wheel- --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.5/MySQLdb
creating build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.5
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 -Dversion_info=(1,3,9,'final',1) -D__version__=1.3.9 -I/usr/include/mysql -I/usr/include/python3.5m -I/django/env/include/python3.5m -c _mysql.c -o build/temp.linux-x86_64-3.5/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
_mysql.c:40:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /django/env/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3_5btd8o/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-qfim2s5n-record/install-record.txt --single-version-externally-managed --compile --install-headers /django/env/include/site/python3.5/mysqlclient:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.5/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.5/MySQLdb
creating build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.5
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 -Dversion_info=(1,3,9,'final',1) -D__version__=1.3.9 -I/usr/include/mysql -I/usr/include/python3.5m -I/django/env/include/python3.5m -c _mysql.c -o build/temp.linux-x86_64-3.5/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
_mysql.c:40:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/django/env/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3_5btd8o/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-qfim2s5n-record/install-record.txt --single-version-externally-managed --compile --install-headers /django/env/include/site/python3.5/mysqlclient" failed with error code 1 in /tmp/pip-build-3_5btd8o/mysqlclient/
Not sure why it's partially duplicated.
According to this question, the solution to such x86_64-linux-gnu-gcc errors is to install:
sudo apt install libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev
which I did, but this made no difference.
Then I tried a bunch of other stuff, including:
sudo apt-get install libmysqlclient-dev python-dev
Which gave:
libmysqlclient-dev : Depends: libmysqlclient18 (= 5.5.52-0ubuntu0.14.04.1) but 5.5.52+maria-1~trusty is to be installed
E: Unable to correct problems, you have held broken packages.
I found an answer where it was said that aptitude is more useful than apt-get and that one can see a list of held packages with:
dpkg --get-selections | grep hold
But nothing is returned when running this. Trying aptitude gives:
(env) user#computer:/$ sudo aptitude install libmysqlclient-dev
The following NEW packages will be installed:
libmysqlclient-dev{b}
0 packages upgraded, 1 newly installed, 0 to remove and 179 not upgraded.
Need to get 0 B/866 kB of archives. After unpacking 5,604 kB will be used.
The following packages have unmet dependencies:
libmariadbclient-dev : Conflicts: libmysqlclient-dev but 5.5.52-0ubuntu0.14.04.1 is to be installed.
Conflicts: libmysqlclient15-dev which is a virtual package.
libmysqlclient-dev : Depends: libmysqlclient18 (= 5.5.52-0ubuntu0.14.04.1) but 5.5.52+maria-1~trusty is installed.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) libmysqlclient-dev [Not Installed]
It looks like a conflict between mysql and mariaDB based packages. So I found:
pip install libmariadbclient-dev
Which installs fine, but the error is still there when trying to install mysqlclient.
How do I get MariaDB to work with Django 1.10 and Python 3.5?
I ran into the same issue while i was executing
pip install mysqlclient
Then i found out i had to install python3-dev packages, but they were resolving into python3.6 and i was using python3.4 in my virtualenv.
All i had to do was:
sudo apt-get install python3.4-dev
I have tried to get this to work, but I have had no success. I'm trying to install mysql-python by running :
pip install mysql-python
but I always get this error
clang: error: invalid version number in '-mmacosx-version-min=10.11'
error: command 'clang' failed with exit status 1
I have used homebrew to update all libraries and I have already installed mysql. I also made sure to have the latest pip, xcode and xcode command line tools.
I have searched for hours but I have not found a way get this package to build.
Please, if anyone has run into a similar situation, I would greatly appreciate a little bit of guidance.
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 ... error
Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/qh/38cj02sj1fb83lfnsd4x3jm40000gn/T/pip-build-lCuswO/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/qh/38cj02sj1fb83lfnsd4x3jm40000gn/T/tmpFVHSn1pip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.11-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.11-x86_64-2.7
creating build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.11-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.7.12/include/mysql -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.11-x86_64-2.7/_mysql.o -fno-omit-frame-pointer
clang: error: invalid version number in '-mmacosx-version-min=10.11'
error: command 'clang' failed with exit status 1
This might be because x-code is not installed
xcode-select --install
You should install MySQL through Homebrew first, to get python-mysql work properly on OS X.
pip uninstall MySQL-python
brew install mysql
brew install mysql-connector-c
pip install MySQL-python
Original answer : MySQL-python on mac
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.