pyodbc installation issue in jupyter lab

1,360 views
Skip to first unread message

Dinakar Chennubotla

unread,
Jul 28, 2021, 5:50:17 AM7/28/21
to Project Jupyter
Hi All,

could someone help me here,
Facing pyodbc installation issue.

command:
pip install pyodbc


error:
=====
Collecting pyodbc
  Downloading pyodbc-4.0.31.tar.gz (280 kB)
     |████████████████████████████████| 280 kB 4.6 MB/s eta 0:00:01
Building wheels for collected packages: pyodbc
  Building wheel for pyodbc (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /srv/conda/envs/notebook/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lx0nvnbu/pyodbc_bde09eeb034e4518acf81d3236cbabbf/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lx0nvnbu/pyodbc_bde09eeb034e4518acf81d3236cbabbf/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-szs7gw8z
       cwd: /tmp/pip-install-lx0nvnbu/pyodbc_bde09eeb034e4518acf81d3236cbabbf/
  Complete output (15 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'pyodbc' extension
  creating build
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/src
  /srv/conda/envs/notebook/bin/x86_64-conda-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /srv/conda/envs/notebook/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /srv/conda/envs/notebook/include -fPIC -DPYODBC_VERSION=4.0.31 -I/srv/conda/envs/notebook/include/python3.7m -c src/buffer.cpp -o build/temp.linux-x86_64-3.7/src/buffer.o -Wno-write-strings
  cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
  In file included from src/buffer.cpp:12:0:
  src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
   #include <sql.h>
            ^~~~~~~
  compilation terminated.
  error: command '/srv/conda/envs/notebook/bin/x86_64-conda-linux-gnu-cc' failed with exit status 1



screenshot for the same.
image.png

Konstantin Markov

unread,
Jul 30, 2021, 1:06:03 AM7/30/21
to Project Jupyter

Try to install  libiodbc2-dev first. You are missing the sql.h which is provided by that package.

Dinakar Chennubotla

unread,
Jul 30, 2021, 7:01:11 AM7/30/21
to Project Jupyter
Hi Konstantin Markov,

firstly, thank you for your response and for helping me.
As said, I installed  libiodbc2-deV,   but I got the same error.

could you, kindly help me here.
######################################################################################################
Step 1:
https://zoomadmin.com/HowToInstall/UbuntuPackage/libiodbc2-dev
sudo apt-get update -y

Step 2:
sudo apt-get install -y libiodbc2-dev

Step 3:
(base) root@fc3a3bc29019:~# pip install pyodbc


Error:
++++++
(base) root@fc3a3bc29019:~# pip install pyodbc
WARNING: The directory '/home/jovyan/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.

Collecting pyodbc
  Downloading pyodbc-4.0.31.tar.gz (280 kB)
     |████████████████████████████████| 280 kB 2.4 MB/s

Building wheels for collected packages: pyodbc
  Building wheel for pyodbc (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/conda/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-eyrl2bs8/pyodbc_77cb6245f74143008b5a63191361a16c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-eyrl2bs8/pyodbc_77cb6245f74143008b5a63191361a16c/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-ow0t0mro
       cwd: /tmp/pip-install-eyrl2bs8/pyodbc_77cb6245f74143008b5a63191361a16c/
  Complete output (14 lines):

  running bdist_wheel
  running build
  running build_ext
  building 'pyodbc' extension
  creating build
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/src
  gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/conda/include -fPIC -O2 -isystem /opt/conda/include -fPIC -DPYODBC_VERSION=4.0.31 -I/opt/conda/include/python3.9 -c src/buffer.cpp -o build/temp.linux-x86_64-3.9/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
     56 | #include <sql.h>
        |          ^~~~~~~
  compilation terminated.
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for pyodbc
  Running setup.py clean for pyodbc
Failed to build pyodbc
Installing collected packages: pyodbc
    Running setup.py install for pyodbc ... error

    ERROR: Command errored out with exit status 1:
     command: /opt/conda/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-eyrl2bs8/pyodbc_77cb6245f74143008b5a63191361a16c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-eyrl2bs8/pyodbc_77cb6245f74143008b5a63191361a16c/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'"'"'))' install --record /tmp/pip-record-4snraduo/install-record.txt --single-version-externally-managed --compile --install-headers /opt/conda/include/python3.9/pyodbc
         cwd: /tmp/pip-install-eyrl2bs8/pyodbc_77cb6245f74143008b5a63191361a16c/
    Complete output (14 lines):


--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/41f8ab2c-43a1-43da-bc13-049833cd0d95n%40googlegroups.com.

Dinakar Chennubotla

unread,
Jul 30, 2021, 2:42:55 PM7/30/21
to Project Jupyter, Konstantin Markov
Hi Konstanin Markov,

installing pyodbc is solved,
thank you so much for the clarification and help.

screenshot for the same
image.png

Thanks,
Dinakar.
Reply all
Reply to author
Forward
0 new messages