I have a module called ModernGL

I want to add the following modules as dependencies for my module when installing on Ubuntu. I have some installing notes already:

apt-get install python3-dev libgl1-mesa-dev libx11-dev
python3 setup.py install
  • How can I detect if python3-dev, libgl1-mesa-dev and libx11-dev is not installed?

  • Can I add these packages as a dependency in the setup.py?

  • How can I print a message from setup.py properly to let the user know what to install?

Some files that are relevant:

1 Answer 1


A while ago I added these lines to a shell script:

for P in gnome-common yelp-tools yelp-xsl; do
    if ! dpkg -l $P >/dev/null 2>&1; then
if [ -n "$INSTALL" ]; then
    echo "To use this script, please install required packages by running this command:"
    echo "\nsudo apt install$INSTALL\n"
    exit 1

The same approach can be applied with Python code, I suppose.

  • @DombiSzabolcs: Great that it proved to be useful. I was too lazy to convert it to Python. ;) Jun 5, 2017 at 21:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .