SQL Server connection using pymssql on Raspberry Pi 3 - python-3.x

I'm trying to connect to SQL Server from Raspberry Pi 3. I've already tried everything that google search suggested and still can't manage to install pymssql using pip3.
All the needed packages were installed, but it still fails to create the wheel-file.
I get this error:
pi#nl-raspi:~ $ sudo pip3 install pymssql
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pymssql
Using cached https://files.pythonhosted.org/packages/25/f4/7a8f70edbfdc4de0f72ba44611b6ed6c175a1b2b1ce22051af0e8a8111c1/pymssql-2.2.2.tar.gz
Installing build dependencies ... done
Building wheels for collected packages: pymssql
Running setup.py bdist_wheel for pymssql ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-19za_p6j/pymssql/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-3kw1_04w --python-tag cp37:
setup.py: platform.system() => Linux
setup.py: platform.architecture() => ('32bit', 'ELF')
setup.py: platform.libc_ver() => ('glibc', '2.28')
setup.py: include_dirs => []
setup.py: library_dirs => []
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.7
creating build/lib.linux-armv7l-3.7/pymssql
copying src/pymssql/__init__.py -> build/lib.linux-armv7l-3.7/pymssql
running build_ext
cythoning src/pymssql/_mssql.pyx to src/pymssql/_mssql.c
cythoning src/pymssql/_pymssql.pyx to src/pymssql/_pymssql.c
building 'pymssql._mssql' extension
creating build/temp.linux-armv7l-3.7
creating build/temp.linux-armv7l-3.7/src
creating build/temp.linux-armv7l-3.7/src/pymssql
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.7m -c src/pymssql/_mssql.c -o build/temp.linux-armv7l-3.7/src/pymssql/_mssql.o -DMSDBLIB
arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-armv7l-3.7/src/pymssql/_mssql.o -lsybdb -lssl -lcrypto -o build/lib.linux-armv7l-3.7/pymssql/_mssql.cpython-37m-arm-linux-gnueabihf.so
/usr/bin/ld: -lssl kann nicht gefunden werden
/usr/bin/ld: -lcrypto kann nicht gefunden werden
collect2: error: ld returned 1 exit status
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pymssql
Running setup.py clean for pymssql
I've already tried to build freeTDS from source code, which also didn't helped.
Can someone help me to install pymssql on Raspberry Pi?

For those who had the same error, you have to install libssl-dev.
sudo apt-get install libssl-dev

Related

Unable to install Pillow in venv on ubuntu

I need help fixing this. I have pillow 7.0.0 installed but it is not accessible in my virtual environment. Trying to install using pip install pillow in the virtual env throws the error below. Can someone shed some light on how to fix this?
Collecting pillow
Using cached Pillow-9.1.0.tar.gz (49.8 MB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pillow
Building wheel for pillow (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [156 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-311
...
x86_64-linux-gnu-gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -DPILLOW_VERSION=\"9.1.0\" -I/tmp/pip-install-dxz6gg5z/pillow_5c0ecf282df741a599c5f2ec14a30181 -I/usr/local/include -I/usr/include -I/home/onah/PycharmProjects/ecommerce/venv/include -I/usr/include/python3.11 -c src/_imaging.c -o build/temp.linux-x86_64-cpython-311/src/_imaging.o
x86_64-linux-gnu-gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/tmp/pip-install-dxz6gg5z/pillow_5c0ecf282df741a599c5f2ec14a30181 -I/usr/local/include -I/usr/include -I/home/onah/PycharmProjects/ecommerce/venv/include -I/usr/include/python3.11 -c src/_imagingmorph.c -o build/temp.linux-x86_64-cpython-311/src/_imagingmorph.o

AWS Elastic Beanstalk "gcc: error trying to exec 'cc1plus': execvp: No such file or directory"

I am trying to deploy a django project, which makes use of MSSQL Server. I am trying to deploy it using AWS Elastic Beanstalk. If anyone could help me out I would really appreciate it.
I have GCC and G++ working on my computer, so I am not sure why that is causing any problems here. I searched around and wasnt able to find any solution that is directly related to mine, and I am not sure where to move forward from here.
Here is the requirements.txt
astroid==1.6.5
awsebcli==3.14.6
botocore==1.12.9
cement==2.8.2
colorama==0.3.9
Django==2.0.6
django-mssql==1.8
django-pyodbc-azure==2.0.6.1
django-sendgrid-v5==0.6.893
docutils==0.14
future==0.16.0
isort==4.3.4
jmespath==0.9.3
lazy-object-proxy==1.3.1
mccabe==0.6.1
mysql-connector-python-rf==2.2.2
pathspec==0.5.5
pylint==1.9.2
PyMySQL==0.8.1
pyodbc==4.0.23
pypyodbc==1.3.3.1
python-dateutil==2.7.3
python-http-client==3.1.0
pytz==2018.5
PyYAML==3.13
semantic-version==2.5.0
sendgrid==5.4.1
six==1.11.0
style==1.1.0
termcolor==1.1.0
update==0.0.1
urllib3==1.22
wrapt==1.10.11
This is my log, specifically the eb-activity section
/var/log/eb-activity.log
Running setup.py bdist_wheel for pyodbc: started
Running setup.py bdist_wheel for pyodbc: finished with status 'error'
Complete output from command /opt/python/run/venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-1cdwy0uv/pyodbc/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/tmpxf7u3lwwpip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYODBC_VERSION=4.0.23 -I/usr/include/python3.6m -c src/pyodbcmodule.cpp -o build/temp.linux-x86_64-3.6/src/pyodbcmodule.o -Wno-write-strings
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status
Failed building wheel for pyodbc
Running setup.py clean for pyodbc
Failed to build pyodbc
Installing collected packages: pyodbc, django-pyodbc-azure, future, python-http-client, sendgrid, django-sendgrid-v5, isort, mccabe, mysql-connector-python-rf, pylint, PyMySQL, pypyodbc, style, update
Running setup.py install for pyodbc: started
Running setup.py install for pyodbc: finished with status 'error'
Complete output from command /opt/python/run/venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-1cdwy0uv/pyodbc/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-wpg4l1dm-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.6/pyodbc:
running install
running build
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYODBC_VERSION=4.0.23 -I/usr/include/python3.6m -c src/pyodbcmodule.cpp -o build/temp.linux-x86_64-3.6/src/pyodbcmodule.o -Wno-write-strings
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1
If you do not already have a .ebextensions directory, then create one, and add a file named 01_packages.config to it with the following content:
packages:
yum:
gcc-c++: []
unixODBC-devel: []
When you run eb deploy at your console, then the config files in the .ebextensions directory will be processed before AWS runs pip install on your requirements.txt file, and you should have the right packages installed for your pypyodbc==1.3.3.1 requirement.

Installation of PyAudio on Raspberry pi 3 fails with gcc error

I'm trying to install PyAudio on my Raspbery Pi 3 using pip install pyaudio but I'm getting the following error:
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
Here are the full logs:
pip install pyaudio
Downloading/unpacking pyaudio
Downloading PyAudio-0.2.11.tar.gz
Running setup.py (path:/tmp/pip-build-u0HEK5/pyaudio/setup.py) egg_info for package pyaudio
Installing collected packages: pyaudio
Running setup.py install for pyaudio
building '_portaudio' extension
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-armv7l-2.7/src/_portaudiomodule.o
src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
#include "portaudio.h"
^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-u0HEK5/pyaudio/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-g5l7H9-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-2.7
copying src/pyaudio.py -> build/lib.linux-armv7l-2.7
running build_ext
building '_portaudio' extension
creating build/temp.linux-armv7l-2.7
creating build/temp.linux-armv7l-2.7/src
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-armv7l-2.7/src/_portaudiomodule.o
src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
#include "portaudio.h"
^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
Cleaning up...
Command /usr/bin/python -c "import setuptools,
tokenize;__file__='/tmp/pip-build-u0HEK5/pyaudio/setup.py';exec(compile(getattr(tokenize,
'open', open)(__file__).read().replace('\r\n', '\n'), __file__,
'exec'))" install --record /tmp/pip-g5l7H9-record/install-record.txt
--single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-u0HEK5/pyaudio
Storing debug log for failure in /home/pi/.pip/pip.log
Note: this a Detailed steps for the installation, for faster installation please consider using #Julian's answer.
That is because you dont have proper prerequisites for the "pyaudio", and port audio header files are one of them.
so first install the prerequisites then your installation will succeed.
try the below commands first before installing pyaudio.
sudo apt-get update
sudo apt-get install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev
sudo apt-get install python-dev
after this now install pyaudio installation either from downloaded file or from a git repository
sudo pip install pyaudio
or
sudo apt-get install git
sudo git clone http://people.csail.mit.edu/hubert/git/pyaudio.git
cd pyaudio
sudo python setup.py install
anything else leave a comment below.
This is related to Pyaudio installation error - 'command 'gcc' failed with exit status 1'
Try the same solution:
sudo apt-get install python-pyaudio

Can't install pandas for Python34 in EC2

I am trying to install pandas in an EC2 instance using the AWS linux distro for use with Python34.
I ran:
sudo pip install pandas
and I was able to successfully install pandas for the python 2.7 version but when I run:
sudo python34 -m pip install pandas
I get the error:
gcc -pthread -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1
-DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Ipandas/_libs/src/klib -Ipandas/_libs/src -I/usr/local/lib64/python3.4/site-packages/numpy/core/include -I/usr/include/python3.4m -c pandas/_libs/index.c -o build/temp.linux-x86_64-3.4/pandas/_libs/index.o -Wno-unused-function
pandas/_libs/index.c:4:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
followed by:
Command "/usr/bin/python34 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zsa12w6w/pandas/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-svj_8okf-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-zsa12w6w/pandas/
How do I successfully install pandas for the python34 version?
I'm guessing you have an old version of pip, otherwise it would try to install via a wheel (binary dist). So one option would be to upgrade pip, then install pandas. (python34 -m pip install -U pip)
If you do want to build pandas from source, or any python c-extension, you need to install the python development headers, probably something like yum install python34-python-devel.x86_64

Error install psycopg2 linux " x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-Qunused-arguments’"

Good day. I'm trying to install in a virtual environment. I tried different tips, but the error persists. My system is Ubuntu 14.04.
(.env)volody#volody-MVG:~/program/MyProject/eveportal$ pip install psycopg2
Collecting psycopg2
Using cached psycopg2-2.6.1.tar.gz
Installing collected packages: psycopg2
Running setup.py install for psycopg2
Complete output from command /home/volody/program/MyProject/eveportal/.env/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-8OJou3/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-29kcwo-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/volody/program/MyProject/eveportal/.env/include/site/python2.7/psycopg2:
...
copying tests/test_async.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 -Qunused-arguments -Qunused-arguments -fPIC -DHAVE_MXDATETIME=1 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.1 (dt dec mx pq3 ext lo64)" -DPG_VERSION_HEX=0x09030A -DHAVE_LO64=1 -I/usr/include/python2.7/mx -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
x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-Qunused-arguments’
x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-Qunused-arguments’
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
»» option ‘-Qunused-arguments’ «« : Seems to be a "pip" thing.
`psycopg2-2.6.1' can easily be installed on Ubuntu 14.04 - 64bits with:
$ cd psycopg2-2.6.1/ && sudo python setup.py install

Resources