Unable to install sasl on MAC - python

In order to connect to Hive data warehouse from python.
Using pyhive requires sasl - ModuleNotFoundError: No module named 'sasl'
Installing sasl fails with errors below
Python 3.9.4
installed gcc, libsasl2
MACOS Mojave v 10.14
pip3 install sasl
Collecting sasl
Using cached sasl-0.2.1.tar.gz (30 kB)
Requirement already satisfied: six in /usr/local/lib/python3.9/site-packages (from sasl) (1.15.0)
Building wheels for collected packages: sasl
Building wheel for sasl (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python#3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/7l/zbp16k6s11v5rypxj86mq_z00000gn/T/pip-install-3a1mge3r/sasl_ebeeb9cd2f6b4067a93195d45bbf68c1/setup.py'"'"'; __file__='"'"'/private/var/folders/7l/zbp16k6s11v5rypxj86mq_z00000gn/T/pip-install-3a1mge3r/sasl_ebeeb9cd2f6b4067a93195d45bbf68c1/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/7l/zbp16k6s11v5rypxj86mq_z00000gn/T/pip-wheel-r3vsh0mm
cwd: /private/var/folders/7l/zbp16k6s11v5rypxj86mq_z00000gn/T/pip-install-3a1mge3r/sasl_ebeeb9cd2f6b4067a93195d45bbf68c1/
Complete output (333 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.9
creating build/lib.macosx-10.14-x86_64-3.9/sasl
copying sasl/__init__.py -> build/lib.macosx-10.14-x86_64-3.9/sasl
running egg_info
writing sasl.egg-info/PKG-INFO
writing dependency_links to sasl.egg-info/dependency_links.txt
writing requirements to sasl.egg-info/requires.txt
writing top-level names to sasl.egg-info/top_level.txt
reading manifest file 'sasl.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'sasl.egg-info/SOURCES.txt'
copying sasl/saslwrapper.cpp -> build/lib.macosx-10.14-x86_64-3.9/sasl
copying sasl/saslwrapper.h -> build/lib.macosx-10.14-x86_64-3.9/sasl
copying sasl/saslwrapper.pyx -> build/lib.macosx-10.14-x86_64-3.9/sasl
running build_ext
building 'sasl.saslwrapper' extension
creating build/temp.macosx-10.14-x86_64-3.9
creating build/temp.macosx-10.14-x86_64-3.9/sasl
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Isasl -I/usr/local/include -I/usr/local/opt/openssl#1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python#3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c sasl/saslwrapper.cpp -o build/temp.macosx-10.14-x86_64-3.9/sasl/saslwrapper.o
In file included from sasl/saslwrapper.cpp:254:
sasl/saslwrapper.h:36:35: warning: 'sasl_dispose' is deprecated: first deprecated in macOS 10.11 [-Wdeprecated-declarations]
~ClientImpl() { if (conn) sasl_dispose(&conn); conn = 0; }
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sasl/sasl.h:746:18: note: 'sasl_dispose' has been explicitly marked deprecated here
LIBSASL_API void sasl_dispose(sasl_conn_t **pconn) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_11,__IPHONE_NA,__IPHONE_NA);
^
In file included from sasl/saslwrapper.cpp:254:
sasl/saslwrapper.h:179:18: warning: 'sasl_client_init' is deprecated: first deprecated in macOS 10.11 [-Wdeprecated-declarations]
result = sasl_client_init(0);
....

It doesn't support Python3.9 yet
Python 3.7 works
Thank you for your attention folks :)

Related

Pip install hiredis fails on building wheels [duplicate]

This question already has answers here:
fatal error: Python.h: No such file or directory
(35 answers)
Closed 8 months ago.
I upgraded my python to version 3.10, but when I was installing dependencies for one of my projects (which worked fine before), I got this error from hiredis (hiredis==2.0.0):
ERROR: Command errored out with exit status 1:
command: /home/sajad/com/nilva/codebase/nilmal/nilmal-django-backend/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pp4tya0l/hiredis_77cc0a3cc0244a81bdc153910e791620/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pp4tya0l/hiredis_77cc0a3cc0244a81bdc153910e791620/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-11hzakag
cwd: /tmp/pip-install-pp4tya0l/hiredis_77cc0a3cc0244a81bdc153910e791620/
Complete output (27 lines):
/tmp/pip-install-pp4tya0l/hiredis_77cc0a3cc0244a81bdc153910e791620/setup.py:7: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
import sys, imp, os, glob, io
/home/sajad/com/nilva/codebase/nilmal/nilmal-django-backend/venv/lib/python3.10/site-packages/setuptools/dist.py:691: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.10
creating build/lib.linux-x86_64-3.10/hiredis
copying hiredis/__init__.py -> build/lib.linux-x86_64-3.10/hiredis
copying hiredis/version.py -> build/lib.linux-x86_64-3.10/hiredis
copying hiredis/hiredis.pyi -> build/lib.linux-x86_64-3.10/hiredis
copying hiredis/py.typed -> build/lib.linux-x86_64-3.10/hiredis
running build_ext
building 'hiredis.hiredis' extension
creating build/temp.linux-x86_64-3.10
creating build/temp.linux-x86_64-3.10/src
creating build/temp.linux-x86_64-3.10/vendor
creating build/temp.linux-x86_64-3.10/vendor/hiredis
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Ivendor -I/home/sajad/com/nilva/codebase/nilmal/nilmal-django-backend/venv/include -I/usr/include/python3.10 -c src/hiredis.c -o build/temp.linux-x86_64-3.10/src/hiredis.o
In file included from src/hiredis.c:1:
src/hiredis.h:4:10: fatal error: Python.h: No such file or directory
4 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for hiredis
I'm not sure what the problem is, could anyone help?
if your version of python is 3.9 :
py -3.9 -m pip install --upgrade pip
py -3.9 -m pip install hiredis
that work for me if doesnt work try :
py -3.9 -m pip uninstall hiredis

How to fix pynput installation error on pop os?

I had a freash installation of pop os, installed pip and I updated everything usig the following command
sudo apt update
sudo apt upgrade
now I want to install the pynput module so I tried the following command
pip install pynput
But I got the following error
Collecting pynput
Using cached pynput-1.7.3-py2.py3-none-any.whl (99 kB)
Collecting evdev>=1.3; "linux" in sys_platform
Using cached evdev-1.4.0.tar.gz (26 kB)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from pynput) (1.15.0)
Requirement already satisfied: python-xlib>=0.17; "linux" in sys_platform in /usr/lib/python3/dist-packages (from pynput) (0.27)
Building wheels for collected packages: evdev
Building wheel for evdev (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-x6x_dhp2/evdev/setup.py'"'"'; __file__='"'"'/tmp/pip-install-x6x_dhp2/evdev/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-98m4gy5x
cwd: /tmp/pip-install-x6x_dhp2/evdev/
Complete output (29 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/evdev
copying evdev/__init__.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/ecodes.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/events.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/ff.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/uinput.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/eventio_async.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/util.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/genecodes.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/evtest.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/eventio.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/device.py -> build/lib.linux-x86_64-3.8/evdev
running build_ext
running build_ecodes
writing ecodes.c (using /usr/include/linux/input.h /usr/include/linux/input-event-codes.h /usr/include/linux/uinput.h)
building 'evdev._input' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/evdev
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c evdev/input.c -o build/temp.linux-x86_64-3.8/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
evdev/input.c:10:10: fatal error: Python.h: No such file or directory
10 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for evdev
Running setup.py clean for evdev
Failed to build evdev
Installing collected packages: evdev, pynput
Running setup.py install for evdev ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] =
What to do now?

Running setup.py install for regex ... error is driving me crazy

I am begging for help! I cannot get anything to work in anaconda anymore and I am trying to resolve it since days. I get the following error when I try to install several packages:
Building wheel for regex (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /opt/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wc/1pgwt_g16sn0026xr90vh_x80000gn/T/pip-install-6dc2clpx/regex/setup.py'"'"'; __file__='"'"'/private/var/folders/wc/1pgwt_g16sn0026xr90vh_x80000gn/T/pip-install-6dc2clpx/regex/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/wc/1pgwt_g16sn0026xr90vh_x80000gn/T/pip-wheel-r01lufl5
cwd: /private/var/folders/wc/1pgwt_g16sn0026xr90vh_x80000gn/T/pip-install-6dc2clpx/regex/
Complete output (17 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/regex
copying regex_3/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/regex
copying regex_3/regex.py -> build/lib.macosx-10.9-x86_64-3.7/regex
copying regex_3/_regex_core.py -> build/lib.macosx-10.9-x86_64-3.7/regex
copying regex_3/test_regex.py -> build/lib.macosx-10.9-x86_64-3.7/regex
running build_ext
building 'regex._regex' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/regex_3
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/anaconda3/include -arch x86_64 -I/opt/anaconda3/include -arch x86_64 -I/opt/anaconda3/include/python3.7m -c regex_3/_regex.c -o build/temp.macosx-10.9-x86_64-3.7/regex_3/_regex.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for regex
I tried everything. I uninstalled anaconda, I tried pip install regex NOTHING works. I am desperate. I cannot work since days. Please help me.
Make sure regex version is up to date in requirements.txt. For me it works when I set regex==2022.3.2.

Can't install sasl package in Ubuntu 18

I want to install pyHive package in ubuntu. Using this step:-
sudo apt-get install gcc
sudo apt-get install libsasl2-dev
pip install sasl
pip install thrift
pip install thrift-sasl
pip install PyHive
but when i install sasl package it's given me error
Using cached sasl-0.2.1.tar.gz (30 kB)
Requirement already satisfied: six in /home/shivam_gupta/Documents/pip3-venv/lib/python3.7/site-packages (from sasl) (1.14.0)
Installing collected packages: sasl
Running setup.py install for sasl ... error
ERROR: Command errored out with exit status 1:
command: /home/shivam_gupta/Documents/pip3-venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vokx0cvb/sasl/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vokx0cvb/sasl/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-hqi5nw58/install-record.txt --single-version-externally-managed --compile --install-headers /home/shivam_gupta/Documents/pip3-venv/include/site/python3.7/sasl
cwd: /tmp/pip-install-vokx0cvb/sasl/
Complete output (32 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/sasl
copying sasl/__init__.py -> build/lib.linux-x86_64-3.7/sasl
running egg_info
writing sasl.egg-info/PKG-INFO
writing dependency_links to sasl.egg-info/dependency_links.txt
writing requirements to sasl.egg-info/requires.txt
writing top-level names to sasl.egg-info/top_level.txt
reading manifest file 'sasl.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'sasl.egg-info/SOURCES.txt'
copying sasl/saslwrapper.cpp -> build/lib.linux-x86_64-3.7/sasl
copying sasl/saslwrapper.h -> build/lib.linux-x86_64-3.7/sasl
copying sasl/saslwrapper.pyx -> build/lib.linux-x86_64-3.7/sasl
running build_ext
building 'sasl.saslwrapper' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/sasl
gcc -pthread -B /home/shivam_gupta/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/home/shivam_gupta/Documents/pip3-venv/include -I/home/shivam_gupta/anaconda3/include/python3.7m -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-3.7/sasl/saslwrapper.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from sasl/saslwrapper.cpp:254:0:
sasl/saslwrapper.h: In member function ‘void saslwrapper::ClientImpl::interact(sasl_interact_t*)’:
sasl/saslwrapper.h:437:11: warning: unused variable ‘input’ [-Wunused-variable]
char* input;
^~~~~
g++ -pthread -shared -B /home/shivam_gupta/anaconda3/compiler_compat -L/home/shivam_gupta/anaconda3/lib -Wl,-rpath=/home/shivam_gupta/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/sasl/saslwrapper.o -lsasl2 -o build/lib.linux-x86_64-3.7/sasl/saslwrapper.cpython-37m-x86_64-linux-gnu.so
unable to execute 'g++': No such file or directory
error: command 'g++' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/shivam_gupta/Documents/pip3-venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vokx0cvb/sasl/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vokx0cvb/sasl/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-hqi5nw58/install-record.txt --single-version-externally-managed --compile --install-headers /home/shivam_gupta/Documents/pip3-venv/include/site/python3.7/sasl Check the logs for full command output.
My python version:- 3.7.6
What I do for installing hive in my ubuntu system?
And thrift-sasl also not installed.
unable to execute 'g++': No such file or directory
You don't have GNU C++ compiler. Install it:
sudo apt-get install g++

python buildpack - fatal error: sasl/sasl.h: No such file or directory

I get the following error installing sasl in my Bluemix app:
Installing collected packages: sasl, thrift-sasl
Running setup.py install for sasl: started
Running setup.py install for sasl: finished with status 'error'
Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9mi8225r/sasl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3l4o04ga-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-9mi8225r/sasl/
running install
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/sasl
copying sasl/__init__.py -> build/lib.linux-x86_64-3.5/sasl
running egg_info
writing dependency_links to sasl.egg-info/dependency_links.txt
writing top-level names to sasl.egg-info/top_level.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'sasl.egg-info/SOURCES.txt'
writing manifest file 'sasl.egg-info/SOURCES.txt'
copying sasl/saslwrapper.cpp -> build/lib.linux-x86_64-3.5/sasl
copying sasl/saslwrapper.pyx -> build/lib.linux-x86_64-3.5/sasl
building 'sasl.saslwrapper' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/sasl
gcc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/app/.heroku/python/include/python3.5m -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-3.5/sasl/saslwrapper.o
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
#include <sasl/sasl.h>
^
compilation terminated.
I'm using the buildpack: python 1.5.5
My runtime.txt contains: python-3.5.0
How can I install the necessary headers in the buildpack?
Update:
It looks as though the latest cloud foundry stack has the sasl library: https://github.com/cloudfoundry/cflinuxfs2/blob/1.119.0/cflinuxfs2/build/install-packages.sh#L98.
How can I use this stack on Bluemix?
Maybe you should install some system libraries before you can install sasl refer to https://pypi.python.org/pypi/sasl/0.1.3
This library contains C++ code, and will require some additional
system libraries installed.
Debian/Ubuntu
apt-get install python-dev libsasl2-dev gcc
CentOS/RHEL
yum install gcc-c++ python-devel.x86_64
cyrus-sasl-devel.x86_64
The solution for me was to use pure-sasl and install imypla and thrift_sasl from application code rather than my requirements.txt:
try:
import impyla
except ImportError:
print("Installing missing impyla")
import pip
pip.main(['install', '--no-deps', 'impyla'])
try:
import thrift_sasl
except ImportError:
print("Installing missing thrift_sasl")
import pip
# need a patched version of thrift_sasl. see https://github.com/cloudera/impyla/issues/238
pip.main(['install', '--no-deps', 'git+https://github.com/snowch/thrift_sasl'])
I added this code to a view in my flask application: https://github.com/snowch/movie-recommender-demo/blob/master/web_app/app/main/views.py
I was having similar error -
In file included from sasl/saslwrapper.cpp:254:0:
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
#include <sasl/sasl.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
Try this thread it was helpful for me
I can't install python-ldap

Categories

Resources