question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need to install Python module that have system dependencies

See original GitHub issue

Problem

Unable to install Python modules that have system dependencies, such as mysqlclient, and there’s no faculty in this package to do so.

Suggested Solution

Add support for an optional pre-requirements shell script to be run. This shell script (which the end-user must write) must be able to both install system packages, and then copy any desired artifacts into the folder to get packaged. In my above instance, I would suggest something like…

  pythonRequirements:
    dockerizePip: true
    preReqScript: install-mysql-devel.sh

and that shell script install-mysql-devel.sh (in the same folder as serverless.yml) would contain…

#!/bin/bash
yum install -y mysql-devel
cp /usr/lib64/mysql/libmysqlclient.so.18.0.0 ./libmysqlclient.so.18

I’ll put a bounty on this feature of ~$100 either in money or stuff, your choice. I need this badly, and don’t have the time to make this feature right now. I will eventually implement this if no one’s free because I’ll need it and it will annoy me too much.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
jadhavmanojcommented, Jan 25, 2018

@dschep Thanks for your suggestion. I created a custom image using amazonlinux image as a base image.

FROM library/amazonlinux
RUN curl -s https://bootstrap.pypa.io/get-pip.py | python
RUN yum install -y mysql-devel
....

Note: there is an issue with MySQL-python package and mysqlclient package. So I used PyMySQL==0.8.0 which solve my problem.

1reaction
maheshgawalicommented, Jan 25, 2018

Getting same issue as @jadhavmanoj , after updating the docker image as @dschep suggested, now I am getting this Rpmdb checksum is invalid: dCDPT(pkg checksums): libsepol-devel.x86_64 0:2.1.7-3.12.amzn1 - u

is this issue related to https://forums.aws.amazon.com/thread.jspa?threadID=244745

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to download Python dependencies - ActiveState
Use the pipdeptree utility to gather a list of all dependencies, create a requirements.txt file listing all the dependencies, and then download ...
Read more >
Installing Python Modules — Python 3.11.1 documentation
A number of scientific Python packages have complex binary dependencies, and aren't currently easy to install using pip directly. At this point in...
Read more >
How to install python modules and their dependencies easily?
The best and recommended way to install Python modules is to use pip, the Python package manager.
Read more >
How to install Python dependencies in an application
Find Divio's how-to guide to installing Python dependencies in an app. The options described in this article are ready to cover most needs....
Read more >
python - How to install packages offline? - Stack Overflow
NOTE: the destination machine needs to have the same version of Python installed, and also any C-based dependencies your app may have must...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found