How to install SHAP (Shapley) for Python - python

Tried to install Shapley package (available in R) using
install shap
but got an error:
Building wheels for collected packages: shap, iml
Running setup.py bdist_wheel for shap ... error
Complete output from command C:\Users\Toly_Novik\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\TOLY_N~1\\AppData\\Local\\Temp \\pip-install-o0p96nl3\\shap\\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 C:\Users\TOLY_N~1\AppData\Local\Temp\pip-wheel-538qnmm2 --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\shap
copying shap\datasets.py -> build\lib.win-amd64-3.6\shap
copying shap\plots.py -> build\lib.win-amd64-3.6\shap
copying shap\__init__.py -> build\lib.win-amd64-3.6\shap
creating build\lib.win-amd64-3.6\shap\explainers
copying shap\explainers\ime.py -> build\lib.win-amd64-3.6\shap\explainers
copying shap\explainers\kernel.py -> build\lib.win-amd64-3.6\shap\explainers
copying shap\explainers\mimic.py -> build\lib.win-amd64-3.6\shap\explainers
copying shap\explainers\pytree.py -> build\lib.win-amd64-3.6\shap\explainers
copying shap\explainers\tree.py -> build\lib.win-amd64-3.6\shap\explainers
copying shap\explainers\__init__.py -> build\lib.win-amd64-3.6 \shap\explainers
running build_ext
numpy.get_include() C:\Users\Toly_Novik\Anaconda3\lib\site-packages\numpy\core\include
building 'shap._cext' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
Same story for
install xgboost

Are you trying to install shap - a library for explaining Machine Learning models? If so use
pip install shap
See the shap documentation for more info: https://pypi.org/project/shap/

Did you meant to install shapely (https://pypi.org/project/Shapely/)?
In python you can install shapely by doing pip install shapely
For windows shapley can be installed by downloading .whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely and do
pip install <name of whl file>
or if you are using anaconda you can use conda-forge to get shapely
conda config --add channels conda-forge
conda install shapely
To install xgboost see http://xgboost.readthedocs.io/en/latest/python/python_intro.html
For this you might need gcc (c/c++ compiler) or equivalent Microsoft alternative.
For xgboost with conda you can see this stackoverflow.com/questions/35139108/… or simply do conda install py-xgboost

pip install git+https://github.com/slundberg/shap.git
Using the pip install only, did not work for me (errors running tests), neither did the conda approach.

Related

I am trying to install "pip install mysqlclient" and it fails everytime. Tried all other things but also didnt work. What should I do?

I am trying to install pip install mysqlclient and it fails everytime. I also tried pip install --only-binary :all: mysqlclient and also not worked. Then I also downloaded whl file and also did't work. I need help.
Using python 3.7.2 and pip 19.0.2 version.
Here's the whole error thats pop up:
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 c:\users\vertig~1.0\envs\mypro\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\VERTIG~1.0\\AppData\\Local\\Temp\\pip-install-b81i8gmq\\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 C:\Users\VERTIG~1.0\AppData\Local\Temp\pip-record-6s1gmot9\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\vertig~1.0\envs\mypro\include\site\python3.7\mysqlclient:
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
Command "c:\users\vertig~1.0\envs\mypro\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\VERTIG~1.0\\AppData\\Local\\Temp\\pip-install-b81i8gmq\\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 C:\Users\VERTIG~1.0\AppData\Local\Temp\pip-record-6s1gmot9\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\vertig~1.0\envs\mypro\include\site\python3.7\mysqlclient" failed with error code 1 in C:\Users\VERTIG~1.0\AppData\Local\Temp\pip-install-b81i8gmq\mysqlclient\```
So any ideas where the error is getting?
Check that you have MySQL installed on your system.
On Mac:
brew install mysql
Installing with APT (eg, Ubuntu):
sudo apt install mysql-server
Or install with the installer: https://dev.mysql.com/downloads/installer/.
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft
Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
From the error message its pretty clear that the issue is with with C++ installation on your machine.
FYI: Many Python libs uses C++ under the hood so its mandatory to install the Microsoft visual c++(on windows) as mentioned in the error.
You can go ahead and install Microsoft Visual C++ from here or here
Or else if there is no particular use behind mysqlclient you can use this pure pyython MySQL client library named PyMySQL (you need not install visual c++ for using this lib).

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.

Issue Installing misaka in a Django project

I need to install misaka, but when I use pip install misaka I get an error that reads:
Command "python setup.py egg_info" failed with error code 1 in C:\Users\JHONAT~1\AppData\Local\Temp\pip-build-utm0mant\misaka\
I don't really know what to do to solve it. I've tried using pip3 instead, no change and using pip2 also. I'm currently using python 3.6.4 and Django 1.11.
Collecting misaka
Using cached https://files.pythonhosted.org/packages/47/c2/ba9c82ae0ec62bcec62d690e715be6ead4457f83000f4ef6e919f77a8e5f/misaka-2.1.0.tar.gz
Collecting cffi>=1.0.0 (from misaka)
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/2f/85/a9184548ad4261916d08a50d9e272bf6f93c54f3735878fbfc9335efd94b/cffi-1.11.5-cp36-cp36m-win_amd64.whl (166kB)
100% |████████████████████████████████| 174kB 17kB/s
Collecting pycparser (from cffi>=1.0.0->misaka)
Building wheels for collected packages: misaka
Running setup.py bdist_wheel for misaka ... error
Complete output from command g:\programming\anaconda3\envs\virtual\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\JHONAT~1\\AppData\\Local\\Temp\\pip-b
uild-9fgtbhdd\\misaka\\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 C:\U
sers\JHONAT~1\AppData\Local\Temp\tmptz2d209jpip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\misaka
copying misaka\api.py -> build\lib.win-amd64-3.6\misaka
copying misaka\callbacks.py -> build\lib.win-amd64-3.6\misaka
copying misaka\constants.py -> build\lib.win-amd64-3.6\misaka
copying misaka\utils.py -> build\lib.win-amd64-3.6\misaka
copying misaka\__init__.py -> build\lib.win-amd64-3.6\misaka
running build_ext
generating cffi module 'build\\temp.win-amd64-3.6\\Release\\misaka._hoedown.c'
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
building 'misaka._hoedown' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
----------------------------------------
Failed building wheel for misaka
Running setup.py clean for misaka
Failed to build misaka
Installing collected packages: pycparser, cffi, misaka
Running setup.py install for misaka ... error
Complete output from command g:\programming\anaconda3\envs\virtual\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\JHONAT~1\\AppData\\Local\\Temp\\pip
-build-9fgtbhdd\\misaka\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record
C:\Users\JHONAT~1\AppData\Local\Temp\pip-crdk5uw4-record\install-record.txt --single-version-externally-managed --compile --install-headers g:\programming\anaconda3\envs\virtual\inc
lude\site\python3.6\misaka:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\misaka
copying misaka\api.py -> build\lib.win-amd64-3.6\misaka
copying misaka\callbacks.py -> build\lib.win-amd64-3.6\misaka
copying misaka\constants.py -> build\lib.win-amd64-3.6\misaka
copying misaka\utils.py -> build\lib.win-amd64-3.6\misaka
copying misaka\__init__.py -> build\lib.win-amd64-3.6\misaka
running build_ext
generating cffi module 'build\\temp.win-amd64-3.6\\Release\\misaka._hoedown.c'
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
building 'misaka._hoedown' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
----------------------------------------
Command "g:\programming\anaconda3\envs\virtual\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\JHONAT~1\\AppData\\Local\\Temp\\pip-build-9fgtbhdd\\misaka\
\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\JHONAT~1\AppDat
a\Local\Temp\pip-crdk5uw4-record\install-record.txt --single-version-externally-managed --compile --install-headers g:\programming\anaconda3\envs\virtual\include\site\python3.6\misa
ka" failed with error code 1 in C:\Users\JHONAT~1\AppData\Local\Temp\pip-build-9fgtbhdd\misaka\
My internet connection is not the fastest, right now im downloading VS2015 to see if it solves my problem, because the link provided by the log doesnt work anymore. thanks for the replies, i'll update when the download finishes
am take this way
1- install conda
with prombt of conda
install :
conda install libpython m2w64-toolchain -c msys2
2-upgrade your pip by : python -m pip install --upgrade pip
3-instal misaka : pip install misaka
From package documentation
If you’re installing from source and are using Debian or a Debian
derivative (e.g. Ubuntu) make sure build-essential, python-dev and
libffi-dev are installed.
sudo apt-get install python-setuptools python-dev build-essential
EDIT
Windows:
Your error clearly states you need to install Microsoft Visual C++ 14.0
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft
Visual C++ Build Tools":
https://go.microsoft.com/fwlink/?LinkId=691126
Working solution!
Go to https://visualstudio.microsoft.com/downloads/
scroll down one page and download Visual Studio 2017 community.
Go through following link to download the required components for Microsoft Visual C++ 14.0, the link provides what components to be selected while downloading.
https://developercommunity.visualstudio.com/content/problem/409173/error-microsoft-visual-c-140-is-required.html
Hope it works as it worked for me!
Do this:
git clone https://github.com/FSX/misaka.git
2.cd misaka
3.python setup.py install
Only working solution I found for windows,
Go to Visual Studio download page as mentioned in the error, download the installer for the latest version, run the installer,
if you already installed visual studio then click modify,
make sure to select the required packages, especially 'windows 10 sdk' as in the image [Around 1.2gb download and 4.2gb disk space needed in first install].
Then run pip install misaka, to successfully build the package.
If Anaconda distribution is installed in your system, you can try running
conda install libpython m2w64-toolchain -c msys2
like as suggested in other answers, but it won't work for all windows-python version combinations.Any time, building the package requires visual c++.

Error while installing PyGraphviz (Mac OS X, Anaconda)

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.

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.

Categories

Resources