Ask coding questions

← Back to all posts
Unable to add package <pyodbc>
TMPSRK (4)

I get below error while add package pyodbc. Pls advise the solution.

Repl.it: Updating package configuration

--> /usr/local/bin/python3 -m poetry add pyodbc
Using version ^4.0 for pyodbc

Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing pyodbc (4.0.30)

[EnvCommandError]
Command ['/home/runner/.local/share/virtualenvs/python3/bin/python', '-m', '
pip', 'install', '--no-deps', 'pyodbc==4.0.30'] errored with the following o
utput:
Collecting pyodbc==4.0.30
Downloading https://files.pythonhosted.org/packages/81/0d/bb08bb16c9776524
4791c73e49de9fd4c24bb3ef00313aed82e5640dee5d/pyodbc-4.0.30.tar.gz (266kB)
Installing collected packages: pyodbc
Running setup.py install for pyodbc: started
Running setup.py install for pyodbc: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /home/runner/.local/share/virtualenvs/python3/bin/python -u -c
'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-yel
7sfk/pyodbc/setup.py'"'"'; file='"'"'/tmp/pip-install-yel_7sfk/pyodbc/se
tup.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-816fk1vn/install-recor
d.txt --single-version-externally-managed --compile --install-headers /home/
runner/.local/share/virtualenvs/python3/include/site/python3.8/pyodbc
cwd: /tmp/pip-install-yel_7sfk/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.30 -I/home/runner/.local/share/virtualenvs/p
ython3/include -I/usr/local/include/python3.8 -c src/buffer.cpp -o build/tem
p.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: No such file or directory
#include <sql.h>
^~~
compilation terminated.
error: command 'gcc' failed with exit status 1

----------------------------------------

ERROR: Command errored out with exit status 1: /home/runner/.local/share/vir
tualenvs/python3/bin/python -u -c 'import sys, setuptools, tokenize; sys.arg
v[0] = '"'"'/tmp/pip-install-yel_7sfk/pyodbc/setup.py'"'"'; file='"'"'/t
mp/pip-install-yel_7sfk/pyodbc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"
'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.c
lose();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/
pip-record-816fk1vn/install-record.txt --single-version-externally-managed -
-compile --install-headers /home/runner/.local/share/virtualenvs/python3/inc
lude/site/python3.8/pyodbc Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is availab
le.
You should consider upgrading via the 'pip install --upgrade pip' command.

add [-D|--dev] [--path PATH] [--optional][--platform PLATFORM] [--dry-run] <name> (<name>)...

exit status 1

Repl.it: Package operation failed.

Comments
hotnewtop
aGEEKdude (4)

Same here. Installing it on PyCharm works, however. If I find a solution, I'll post it here.

pdxJaxon (0)

I have the exact same issue

GatorGirl (18)

I have a similar problem.