pyodbc in umbutu 19.10

49 views
Skip to first unread message

Elias Coutinho

unread,
Feb 18, 2020, 1:49:05 PM2/18/20
to Django users
Good afternoon people.


Out of curiosity I installed SQL Server on Linux.


I restored a database and made basic commands. Working properly!



I have a connection I made to a .py file to make queries and run stored procedures. It also works on windows.



As I wanted to have a SQL Server SGDB and I didn't want a virtual machine, it was setting up an optimal environment.

but when running my .py file I missed pyodbc and when installing it returned an error and does not install.



Below the log, something caught my attention, I highlighted it in bold:



elias @ eliasPai: ~ $ pip3 install pyodbc
Collecting pyodbc
Using cached pyodbc-4.0.28.tar.gz (264 kB)
Installing collected packages: pyodbc
Running setup.py install for pyodbc… error
ERROR: Command errored out with exit status 1:
command: /home/elias/.pyenv/versions/3.8.1/bin/python3.8 -u -c ‘import sys, setuptools, tokenize; sys.argv [0] = ‘" ’" ’/tmp/pip-install-07bga8vp/pyodbc/setup.py’ "’ "’; file = '"'" '/ tmp / pip-install-07bga8vp / 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-record-2nc3ppfp/install-record.txt --single-version-externally-managed --compile - install-headers /home/elias/.pyenv/versions/3.8.1/include/python3.8/pyodbc
cwd: / tmp / pip-install-07bga8vp / pyodbc /
Complete output (14 lines):
running install
running build
running build_ext
building ‘pyodbc’ extension
creating build
creating build / temp.linux-x86_64-3.8
creating build / temp.linux-x86_64-3.8 / src
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION = 4.0.28 -I / home / elias / .pyenv / versions / 3.8.1 / include / python3 .8 -c src / buffer.cpp -o build / temp.linux-x86_64-3.8 / src / buffer.o -Wno-write-strings
In file included from src / buffer.cpp: 12:
src / pyodbc.h: 56: 10: fatal error: sql.h: File or directory does not exist
56 | #include <sql.h>
** | ^ ~~~~~~ **
** compilation terminated. **
error: command ‘gcc’ failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/elias/.pyenv/versions/3.8.1/bin/python3.8 -u -c ‘import sys, setuptools, tokenize; sys.argv [0] = ‘" ’" ’/tmp/pip-install-07bga8vp/pyodbc/setup.py’ "’ "’; file = '"'" '/ tmp / pip-install-07bga8vp / 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-record-2nc3ppfp/install-record.txt --single-version-externally-managed --compile - install-headers /home/elias/.pyenv/versions/3.8.1/include/python3.8/pyodbc Check the logs for full command output.





Then I tried to install several times using:
python3 -m pip install --upgrade pip
pip3 install setuptools
pip install --upgrade setuptools

Does anyone have a tip?

Jorge Gimeno

unread,
Feb 18, 2020, 2:07:50 PM2/18/20
to django...@googlegroups.com
There may be development libraries missing. An internet search found this:  

sudo apt install unixodbc-dev

Hope it helps!

-Jorge



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7b007da3-4721-434a-8710-e2a4e8b526b5%40googlegroups.com.

Elias Coutinho

unread,
Feb 18, 2020, 2:55:49 PM2/18/20
to django...@googlegroups.com
This is my return:


elias@eliasPai:~$ sudo apt install unixodbc-dev
Lendo listas de pacotes... Pronto
Construindo árvore de dependências      
Lendo informação de estado... Pronto
Alguns pacotes não puderam ser instalados. Isto pode significar que
você solicitou uma situação impossível ou, se você está usando a
distribuição instável, que alguns pacotes requeridos não foram
criados ainda ou foram retirados da "Incoming".
A informação a seguir pode ajudar a resolver a situação:

Os pacotes a seguir têm dependências desencontradas:
 unixodbc-dev : Depende: unixodbc (= 2.3.7)
                Depende: odbcinst1debian2 (= 2.3.7) mas não será instalado
E: Impossível corrigir problemas, você manteve (hold) pacotes quebrados.

You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/Mi-g0x9iojo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANfN%3DK8ZVZBFK15UnJdZ9L1whFrLHXv%2BuSJgBWP8XKuXL1SXhA%40mail.gmail.com.


--
Elias Coutinho.
Aprender sobre alguns assuntos é fundamental.
Aprender sobre Deus é indiscutivelmente o melhor conteúdo.

Jorge Gimeno

unread,
Feb 19, 2020, 12:09:11 AM2/19/20
to django...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages