7

I want to install pyodbc for connection mssql server using sqlalchemy I am googling and tried in several ways like

pip install pyodbc

Followed this link Pyodbc installation error on Ubuntu 16.04 with Sql Server installed but have not solved below type error thrown

src/pyodbc.h:56:17: fatal error: sql.h: No such file or directory
  compilation terminated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for pyodbc
Zaynul Abadin Tuhin
  • 31,407
  • 5
  • 33
  • 63
  • Per the question you referenced, did you install unixODBC before trying to install pyodbc via pip? `sudo apt-get install unixodbc-dev` –  Jul 25 '17 at 13:04
  • jinksPadlock Yes I have installed unixODBC before pyodbc – Zaynul Abadin Tuhin Jul 25 '17 at 13:16
  • i have used sudo apt-get install unixodbc-dev and pip install pyodbc for installation but it shows bellow error ""No driver name specified; " (pyodbc.Error) ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)') " – Zaynul Abadin Tuhin Jul 26 '17 at 16:24
  • Are you specifically naming the Driver? http://docs.sqlalchemy.org/en/latest/dialects/mssql.html#hostname-connections –  Jul 26 '17 at 17:04

3 Answers3

18

For pyodbc case I used command

sudo apt-get install unixodbc-dev
pip install pyodbc

and able to success pyodbc installation but facing my comment problem (not able to push data into mssql server)

For pymssql i used command

sudo apt-get install freetds-dev
pip install pymssql

then able to success pymssql installation and data insert into mssql server

Zaynul Abadin Tuhin
  • 31,407
  • 5
  • 33
  • 63
2

For RH/Cent-OS/Linux use,

yum install unixODBC
yum install unixODBC-devel
KnowledgeSeeeker
  • 620
  • 1
  • 9
  • 14
0

Try this without utf16:

According to @jinksPadlock I have successfully installed:

sudo apt-get install unixodbc-dev
Md Sirajus Salayhin
  • 4,974
  • 5
  • 37
  • 46