Home > Software engineering >  Trying to install pyodbc from vscode terminal in Kali linux , it's getting error
Trying to install pyodbc from vscode terminal in Kali linux , it's getting error

Time:06-26

I am running Kali Linux and trying to install pyodbc. I am doing pip install pyodbc and get a very long list of errors, which end in I'm trying to install pyodbc from vscode terminal in Kali linux, it's getting error. I have installed python3 and python2 also and also set environment variable in system and updated pip version.

pip install pyodbc  
        
Defaulting to user installation because normal site-packages is not writeable
Collecting pyodbc
  Using cached pyodbc-4.0.32.tar.gz (280 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyodbc
  Building wheel for pyodbc (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'pyodbc' extension
      creating build
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/src
      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 -DPYODBC_VERSION=4.0.32 -I/usr/include/python3.10 -c src/buffer.cpp -o build/temp.linux-x86_64-3.10/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/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  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: subprocess-exited-with-error
  
  × Running setup.py install for pyodbc did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running install
      /usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'pyodbc' extension
      creating build
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/src
      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 -DPYODBC_VERSION=4.0.32 -I/usr/include/python3.10 -c src/buffer.cpp -o build/temp.linux-x86_64-3.10/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/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyodbc

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.```
                                              

CodePudding user response:

This seems to be a known issue with pyodbc. In the github issue, the author says "You don't have the required ODBC header files on your machine."

For Ubuntu, he suggests sudo apt install unixodbc-dev, which I think would also work on Kali Linux.

CodePudding user response:

Its probably, cause you installed multiple version of python interpreters, as you said yourself, and pip is not know to which python interpreter to install to. try this:

python3 -m pip install

or

python -m pip install
  • Related