serverless-python-requirements icon indicating copy to clipboard operation
serverless-python-requirements copied to clipboard

install pyodbc & turbodbc

Open crisnicogonzalez opened this issue 3 years ago • 1 comments

Hi! I'm trying deploy a function that has turbodbc dependency. I tryied on so many way but the file libodbc.so.2 is not found in the generated .zip.

service: lambda-dummy

frameworkVersion: '2'

provider:
  name: aws
  runtime: python3.7
  lambdaHashingVersion: 20201221
  stage: dev
  region: us-east-2

package:
  include:
    - libodbc.so.2
  exclude:
    - node_modules/**
    - layer/**
    - Dockerfile
    - .idea/**
    - venv/**
    - requirements.txt
    - README.md
    - package.json
    - package-lock.json
    - bitbucket-pipelines.yml

functions:
  hello:
    handler: handler.get_rows


plugins:
  - serverless-python-requirements

custom:
  pythonRequirements:
    dockerizePip: true
    dockerFile: Dockerfile
    dockerExtraFiles:
      - libodbc.so.2
      - /usr/lib64/libodbc.so.2
      - /usr/lib64/libodbc.so

And this is my Dockerfile.

FROM lambci/lambda:build-python3.6

# Install your dependencies
RUN yum -y install unixODBC unixODBC-devel boost-devel
RUN pip install pybind11
RUN whereis libodbc.so.2

When I run the function I have the next error

[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")

crisnicogonzalez avatar Apr 09 '21 02:04 crisnicogonzalez

Hi @crisnicogonzalez just asking, were you able to resolve the issue. I am facing same issue with pymssql as both pyodbc and pymssql use external c modules.

mudasirmirza avatar Mar 30 '22 14:03 mudasirmirza