How to handle external dependencies in python?

I have a python script that runs well on ubuntu. I have also maintained a requirement file using pip freeze command. But when I try to install the requirements in centOS, I get dependency issues for the packages. These dependencies are external and not relating to python.

For example, I tried installing mysql-python in my ubuntu machine, it was installed successfully. But when I tried installing mysql-python on my centos machine, it failed because mysql-python had a dependency on something else that could not have been listed by pip freeze.

The error I received and its solution is addressed in the link below. But what I want to know is how to handle such dependencies.

mysql_config not found when installing mysqldb python interface

Upvotes: 2

Views: 1836

Answers (1)

Jeril
Jeril

Reputation: 8521

How I used to do during deployment is, create a shell script. The shell script will install mysql-server first, the do the Python library installation.

Sample shell script can be found below initial_setup.sh:

#!/bin/bash
apt-get install mysql-server
apt-get install libmysqlclient-dev

pip install -r requirements.txt

Upvotes: 1

Related Questions