how to install python library in heroku - python-3.x

I am running web apps on heroku.
I wanna use TA-Lib. this is library of python.
I got error when install it on heroku.
heroku run pip install ta-lib
main, error: command 'gcc' failed with exit status 1.
Collecting TA-Lib
Using cached TA-Lib-0.4.10.tar.gz
Building wheels for collected packages: TA-Lib
Running setup.py bdist_wheel for TA-Lib ... error
Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ggrhshl_/TA-Lib/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/tmpy3tq74cipip-wheel- --python-tag cp36:
/tmp/pip-build-ggrhshl_/TA-Lib/setup.py:77: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/talib
copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib
copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib
copying talib/__init__.py -> build/lib.linux-x86_64-3.6/talib
running build_ext
building 'talib.common' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/talib
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app/.heroku/python/lib/python3.6/site-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/app/.heroku/python/include/python3.6m -c talib/common.c -o build/temp.linux-x86_64-3.6/talib/common.o
talib/common.c:242:28: fatal error: ta-lib/ta_defs.h: No such file or directory
#include "ta-lib/ta_defs.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for TA-Lib
Running setup.py clean for TA-Lib
Failed to build TA-Lib
Installing collected packages: TA-Lib
Running setup.py install for TA-Lib ... error
Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ggrhshl_/TA-Lib/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-7lciel7r-record/install-record.txt --single-version-externally-managed --compile:
/tmp/pip-build-ggrhshl_/TA-Lib/setup.py:77: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/talib
copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib
copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib
copying talib/__init__.py -> build/lib.linux-x86_64-3.6/talib
running build_ext
building 'talib.common' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/talib
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app/.heroku/python/lib/python3.6/site-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/app/.heroku/python/include/python3.6m -c talib/common.c -o build/temp.linux-x86_64-3.6/talib/common.o
talib/common.c:242:28: fatal error: ta-lib/ta_defs.h: No such file or directory
#include "ta-lib/ta_defs.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ggrhshl_/TA-Lib/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-7lciel7r-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ggrhshl_/TA-Lib/
I have avoid when I installed ta-lib in my ubuntu.
sudo apt-get install python3-dev
Problem is what sudo command can't use on heroku.
so I don't know what I have to do.
how to install ta-lib in heroku ??

Add this one to your app's buildpack list: https://github.com/numrut/heroku-buildpack-python-talib
It should be placed after heroku/python.
And remove TA-Lib from your requirements.txt if it is already there.

Related

Installing TA-Lib on Macbook

I'm trying to get install TA-lib, but running into errors I don't understand.
I installed brew, and ran the following:
brew install ta-lib
That seemed to work because if I re-run that, I get a note that
ta-lib 0.4.0 is already installed and up-to-date
However, running pip3 install ta-lib results in the following errors. From googling around, this seems to happen when ta-lib wasn't installed first, but not sure how to address when the initial install seems to go fine.
pip3 install TA-lib
Collecting TA-lib
Using cached TA-Lib-0.4.19.tar.gz (267 kB)
Requirement already satisfied: numpy in /Users/mf/venv/lib/python3.8/site-packages (from TA-lib) (1.19.5)
Using legacy 'setup.py install' for TA-lib, since package 'wheel' is not installed.
Installing collected packages: TA-lib
Running setup.py install for TA-lib ... error
ERROR: Command errored out with exit status 1:
command: /Users/mf/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-install-armqiybl/ta-lib_03c018e0f8f24266a3c6fc47436cf143/setup.py'"'"'; __file__='"'"'/private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-install-armqiybl/ta-lib_03c018e0f8f24266a3c6fc47436cf143/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/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-record-q2zdmts7/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mf/venv/include/site/python3.8/TA-lib
cwd: /private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-install-armqiybl/ta-lib_03c018e0f8f24266a3c6fc47436cf143/
Complete output (27 lines):
/private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-install-armqiybl/ta-lib_03c018e0f8f24266a3c6fc47436cf143/setup.py:71: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14.6-x86_64-3.8
creating build/lib.macosx-10.14.6-x86_64-3.8/talib
copying talib/abstract.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
copying talib/test_abstract.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
copying talib/deprecated.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
copying talib/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
copying talib/stream.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
copying talib/test_pandas.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
copying talib/test_data.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
copying talib/test_func.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
copying talib/test_stream.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.macosx-10.14.6-x86_64-3.8
creating build/temp.macosx-10.14.6-x86_64-3.8/talib
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/Users/mf/venv/lib/python3.8/site-packages/numpy/core/include -I/Users/mf/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c talib/_ta_lib.c -o build/temp.macosx-10.14.6-x86_64-3.8/talib/_ta_lib.o
talib/_ta_lib.c:611:10: fatal error: 'ta-lib/ta_defs.h' file not found
#include "ta-lib/ta_defs.h"
^~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/mf/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-install-armqiybl/ta-lib_03c018e0f8f24266a3c6fc47436cf143/setup.py'"'"'; __file__='"'"'/private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-install-armqiybl/ta-lib_03c018e0f8f24266a3c6fc47436cf143/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/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-record-q2zdmts7/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mf/venv/include/site/python3.8/TA-lib Check the logs for full command output.
I updated TA_LIBRARY_PATH & TA_INCLUDE_PATH after finding where brew was installing ta-lib, ran the following and pip3 install seemed to work properly, but I wasn't able to actually import it. After trying to re-install ta-lib, I get the same error as above.
export TA_LIBRARY_PATH=/opt/homebrew/opt/ta-lib/lib
export TA_INCLUDE_PATH=/opt/homebrew/opt/ta-lib/include

`pip3 install batman-package` not working

Using macOS 10.15.6, I have installed python3 (3.8.5) through homebrew (2.4.9). Then I have installed the packages I needed using pip3 (20.2).
But I am having an issue when I want to install a python module called "batman".
I first installed it using pip3 install batman, but then I saw that the correct way was to do pip3 install batman-package, except that doing so gives me a long error message that I tried to understand, however I have not managed to understand what I needed to fix, so I am asking if anyone has a way to fix this?
Thanks
Collecting batman-package
Using cached batman-package-2.4.6.tar.gz (29 kB)
Requirement already satisfied: numpy in /usr/local/lib/python3.8/site-packages (from batman-package) (1.19.0)
Building wheels for collected packages: batman-package
Building wheel for batman-package (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python#3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/setup.py'"'"'; __file__='"'"'/private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/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 /private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-wheel-9fvrwe2s
cwd: /private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/
Complete output (25 lines):
Checking for OpenMP support...
Did not detect OpenMP support.
/usr/local/Cellar/python#3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'extras_requires'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-3.8
creating build/lib.macosx-10.15-x86_64-3.8/batman
copying batman/openmp.py -> build/lib.macosx-10.15-x86_64-3.8/batman
copying batman/transitmodel.py -> build/lib.macosx-10.15-x86_64-3.8/batman
copying batman/__init__.py -> build/lib.macosx-10.15-x86_64-3.8/batman
copying batman/plots.py -> build/lib.macosx-10.15-x86_64-3.8/batman
copying batman/tests.py -> build/lib.macosx-10.15-x86_64-3.8/batman
running build_ext
building 'batman._nonlinear_ld' extension
creating build/temp.macosx-10.15-x86_64-3.8
creating build/temp.macosx-10.15-x86_64-3.8/c_src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl#1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python#3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c c_src/_nonlinear_ld.c -o build/temp.macosx-10.15-x86_64-3.8/c_src/_nonlinear_ld.o -std=c99
c_src/_nonlinear_ld.c:21:10: fatal error: 'numpy/arrayobject.h' file not found
#include "numpy/arrayobject.h"
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for batman-package
Running setup.py clean for batman-package
Failed to build batman-package
DEPRECATION: Could not build wheels for batman-package which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: batman-package
Running setup.py install for batman-package ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python#3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/setup.py'"'"'; __file__='"'"'/private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/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/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-record-a9qct8l8/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/batman-package
cwd: /private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/
Complete output (25 lines):
Checking for OpenMP support...
Did not detect OpenMP support.
/usr/local/Cellar/python#3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'extras_requires'
warnings.warn(msg)
running install
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-3.8
creating build/lib.macosx-10.15-x86_64-3.8/batman
copying batman/openmp.py -> build/lib.macosx-10.15-x86_64-3.8/batman
copying batman/transitmodel.py -> build/lib.macosx-10.15-x86_64-3.8/batman
copying batman/__init__.py -> build/lib.macosx-10.15-x86_64-3.8/batman
copying batman/plots.py -> build/lib.macosx-10.15-x86_64-3.8/batman
copying batman/tests.py -> build/lib.macosx-10.15-x86_64-3.8/batman
running build_ext
building 'batman._nonlinear_ld' extension
creating build/temp.macosx-10.15-x86_64-3.8
creating build/temp.macosx-10.15-x86_64-3.8/c_src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl#1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python#3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c c_src/_nonlinear_ld.c -o build/temp.macosx-10.15-x86_64-3.8/c_src/_nonlinear_ld.o -std=c99
c_src/_nonlinear_ld.c:21:10: fatal error: 'numpy/arrayobject.h' file not found
#include "numpy/arrayobject.h"
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python#3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/setup.py'"'"'; __file__='"'"'/private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/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/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-record-a9qct8l8/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/batman-package Check the logs for full command output.
Ok so it was actually a problem with headers as thilina lakshan said. I followed the link he posted and indeed by running export CFLAGS="-I /usr/local/lib/python3.8/site-packages/numpy/core/include $CFLAGS" in the terminal worked and I could install the package.
Thank you very very much!

MySQL-python is not supported in Python 3

How could install mysql-python in python 3 using MacOS?
I tried this too:
$ brew install mysql
$ pip install mysqlclient
and it returned me the following error:
Collecting mysqlclient
Using cached mysqlclient-1.4.6.tar.gz (85 kB)
Could not build wheels for mysqlclient, since package 'wheel' is not installed.
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kz/hw6d2_6j2xbgr4vs3c38zm040000gn/T/pip-install-_pr7g788/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/kz/hw6d2_6j2xbgr4vs3c38zm040000gn/T/pip-install-_pr7g788/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/kz/hw6d2_6j2xbgr4vs3c38zm040000gn/T/pip-record-caw5qeb2/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/mysqlclient
cwd: /private/var/folders/kz/hw6d2_6j2xbgr4vs3c38zm040000gn/T/pip-install-_pr7g788/mysqlclient/
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
creating build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/MySQLdb
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/usr/local/Cellar/mysql/8.0.19/include/mysql -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-x86_64-3.7/MySQLdb/_mysql.o
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.7/MySQLdb/_mysql.o -L/usr/local/Cellar/mysql/8.0.19/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.7/MySQLdb/_mysql.cpython-37m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kz/hw6d2_6j2xbgr4vs3c38zm040000gn/T/pip-install-_pr7g788/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/kz/hw6d2_6j2xbgr4vs3c38zm040000gn/T/pip-install-_pr7g788/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/kz/hw6d2_6j2xbgr4vs3c38zm040000gn/T/pip-record-caw5qeb2/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/mysqlclient Check the logs for full command output.
the next try I use pip instaed of brew, but keep returning error.
$ pip install mysql
Any idea about how I can install mysql-python package or someone similar to use MySQLdb module if it's possible?

Installation Error for python-crfsuite on MacOS

I want to install crfsuite for python3 using
pip3 install python-crfsuite
but it throws an error.
Building wheel for python-crfsuite (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.7/bin
/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] =
'"'"'/private/var/folders/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-
install-jcwoi004/python-crfsuite/setup.py'"'"';
__file__='"'"'/private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-install-jcwoi004/python-
crfsuite/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 /private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-wheel-evw_5zco --python-
tag cp37
cwd: /private/var/folders/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn
/T/pip-install-jcwoi004/python-crfsuite/
Complete output (25 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/pycrfsuite
copying pycrfsuite/__init__.py -> build/lib.macosx-10.9-
x86_64-3.7/pycrfsuite
copying pycrfsuite/_dumpparser.py -> build/lib.macosx-10.9-
x86_64-3.7/pycrfsuite
copying pycrfsuite/_logparser.py -> build/lib.macosx-10.9-
x86_64-3.7/pycrfsuite
running build_ext
building 'pycrfsuite._pycrfsuite' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/pycrfsuite
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib/crf
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite
/lib/crf/src
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/swig
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib/cqdb
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib/cqdb/src
creating build/temp.macosx-10.9-x86_64-3.7/liblbfgs
creating build/temp.macosx-10.9-x86_64-3.7/liblbfgs/lib
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-
common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g
-Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include
-Ipycrfsuite -I/Library/Frameworks/Python.framework/Versions
/3.7/include/python3.7m -c pycrfsuite/_pycrfsuite.cpp -o
build/temp.macosx-10.9-x86_64-3.7/pycrfsuite/_pycrfsuite.o -std=c99
error: invalid argument '-std=c99' not allowed with 'C++/ObjC++'
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for python-crfsuite
Running setup.py clean for python-crfsuite
Failed to build python-crfsuite
Installing collected packages: python-crfsuite
Running setup.py install for python-crfsuite ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.7/bin
/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] =
'"'"'/private/var/folders/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-
install-jcwoi004/python-crfsuite/setup.py'"'"';
__file__='"'"'/private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-install-jcwoi004/python-
crfsuite/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
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-record-xhn2aymp/install-
record.txt --single-version-externally-managed --compile
cwd: /private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-install-jcwoi004/python-
crfsuite/
Complete output (25 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/pycrfsuite
copying pycrfsuite/__init__.py -> build/lib.macosx-10.9-
x86_64-3.7/pycrfsuite
copying pycrfsuite/_dumpparser.py -> build/lib.macosx-10.9-
x86_64-3.7/pycrfsuite
copying pycrfsuite/_logparser.py -> build/lib.macosx-10.9-
x86_64-3.7/pycrfsuite
running build_ext
building 'pycrfsuite._pycrfsuite' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/pycrfsuite
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib/crf
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib/crf/src
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/swig
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib/cqdb
creating build/temp.macosx-10.9-x86_64-3.7/crfsuite
/lib/cqdb/src
creating build/temp.macosx-10.9-x86_64-3.7/liblbfgs
creating build/temp.macosx-10.9-x86_64-3.7/liblbfgs/lib
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-
common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g
-Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include
-Ipycrfsuite -I/Library/Frameworks/Python.framework/Versions
/3.7/include/python3.7m -c pycrfsuite/_pycrfsuite.cpp -o
build/temp.macosx-10.9-x86_64-3.7/pycrfsuite/_pycrfsuite.o -std=c99
error: invalid argument '-std=c99' not allowed with
'C++/ObjC++'
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks
/Python.framework/Versions/3.7/bin/python3 -u -c 'import sys,
setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-install-jcwoi004/python-
crfsuite/setup.py'"'"'; __file__='"'"'/private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-install-jcwoi004/python-
crfsuite/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
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-record-xhn2aymp/install-
record.txt --single-version-externally-managed --compile Check the
logs for full command output.
I haven't seen anyone else with the same problem, perhaps it's something obvious that I just can't see. I'm also new to MacOS and this didn't happen to me on Windows.
the pip version is 19.2.3 .
If somebody could please help me with this.
There are a bunch of issues about this problem on the github repo, but are mostly closed with a reference to just use conda install, which is not really applicable in this case. One of them is mentioned in a pull request removing the flag causing the problem, so you might try installing from source, using the version from the pedning pull request like so:
pip install git+git://github.com/kvinwang/python-crfsuite.git#fix69

How to connect to Message Hub from Data Science Experience / Spark as a Service using confluent-kafka-python?

The Bluemix MessageHub docs point python users to the confluent kafka library:
So I tried to install:
!pip install --user confluent-kafka
However, I've hit this error:
Collecting confluent-kafka
Using cached confluent-kafka-0.9.1.2.tar.gz
Installing collected packages: confluent-kafka
Running setup.py install for confluent-kafka ... - \ error
Complete output from command /usr/local/src/bluemix_jupyter_bundle.v22/notebook/bin/python -u -c "import setuptools, tokenize;__file__='/gpfs/global_fs01/sym_shared/YPProdSpark/user/xxxx/notebook/tmp/pip-build-N3zDUh/confluent-kafka/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /gpfs/fs01/user/xxxx/notebook/tmp/pip-PyAwq2-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
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/confluent_kafka
copying confluent_kafka/__init__.py -> build/lib.linux-x86_64-2.7/confluent_kafka
creating build/lib.linux-x86_64-2.7/confluent_kafka/kafkatest
copying confluent_kafka/kafkatest/__init__.py -> build/lib.linux-x86_64-2.7/confluent_kafka/kafkatest
copying confluent_kafka/kafkatest/verifiable_consumer.py -> build/lib.linux-x86_64-2.7/confluent_kafka/kafkatest
copying confluent_kafka/kafkatest/verifiable_producer.py -> build/lib.linux-x86_64-2.7/confluent_kafka/kafkatest
copying confluent_kafka/kafkatest/verifiable_client.py -> build/lib.linux-x86_64-2.7/confluent_kafka/kafkatest
running build_ext
building 'confluent_kafka.cimpl' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/confluent_kafka
creating build/temp.linux-x86_64-2.7/confluent_kafka/src
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/src/bluemix_jupyter_bundle.v22/notebook/include/python2.7 -c confluent_kafka/src/confluent_kafka.c -o build/temp.linux-x86_64-2.7/confluent_kafka/src/confluent_kafka.o
In file included from confluent_kafka/src/confluent_kafka.c:17:0:
confluent_kafka/src/confluent_kafka.h:20:32: fatal error: librdkafka/rdkafka.h: No such file or directory
#include <librdkafka/rdkafka.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/local/src/bluemix_jupyter_bundle.v22/notebook/bin/python -u -c "import setuptools, tokenize;__file__='/gpfs/global_fs01/sym_shared/YPProdSpark/user/xxxx/notebook/tmp/pip-build-N3zDUh/confluent-kafka/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /gpfs/fs01/user/xxxx/notebook/tmp/pip-PyAwq2-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /gpfs/global_fs01/sym_shared/YPProdSpark/user/xxxx/notebook/tmp/pip-build-N3zDUh/confluent-kafka/
As per the confluent readme, you need the librdkafka native library installed before you can use their Python client.
As you found in your other comment their is the alternative pure Python library kafka-python which you might find easier to work with for a Bluemix application

Resources