Azure-App-Service / python

base image for Python on linux app service
Apache License 2.0
54 stars 49 forks source link

Unable to install the pyodbc package #49

Open thetestgame opened 4 years ago

thetestgame commented 4 years ago

We are currently unable to use SQL Server on our Python App Service instance due to an error preventing the install of pyodbc from pip.

    Running setup.py install for pyodbc ... error
    ERROR: Command errored out with exit status 1:
     command: /opt/python/3/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hu419imp/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hu419imp/pyodbc/s
etup.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-dl7e4jt2/install-record.txt --single-version-externally-managed --compile
         cwd: /tmp/pip-install-hu419imp/pyodbc/
    Complete output (10 lines):
    running install
    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
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.28 -I/opt/python/3/include/python3.7m -c src/buffer.cpp -o build/temp.linux-x86_64-3.7/s
rc/buffer.o -Wno-write-strings
    unable to execute 'gcc': No such file or directory
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
Cleaning up...
ERROR: Command errored out with exit status 1: /opt/python/3/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hu419imp/pyodbc/setup.py'"'"'; __file__='"'"'/
tmp/pip-install-hu419imp/pyodbc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'ex
ec'"'"'))' install --record /tmp/pip-record-dl7e4jt2/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
jaceaser commented 4 years ago

@thetestgame I was able to get it installed by running the below commands, however when I deploy the application it fails.

apt-get install build-essential libssl-dev libffi-dev python3-dev
apt-get install unixodbc-dev

this has me puzzled.

thetestgame commented 4 years ago

I had the same result. When you deploy an application it seems to reset the container effectively uninstalling everything. At least from my experience deploying from Visual Studio Code. If I deploy and hand install everything via ssh then it works as intended but next deploy its wiped again.