Arun
Arun

Reputation: 3511

Installing dependencies for Python program

I have created a Python-based GUI application which has certain dependencies such as the "request" and "psycopg2" modules among others.

I want to create a setup script that will install all such dependencies when run, so that a user can run the GUI application without having any missing package errors.

I did try looking up the distutils module, but am not able to fully understand its usage.

Upvotes: 2

Views: 1777

Answers (3)

ryry1985
ryry1985

Reputation: 336

Check out the impstall package, a project I created to meet these same needs. It's as simple as:

import impstall
impstall.now('csv')
impstall.now('wx', pipName='wxPython')

Upvotes: 0

SingleNegationElimination
SingleNegationElimination

Reputation: 156138

if you did

$ pip install SomeLib

to satisfy a requirement for developing your own library, you should have a setup script something like this:

#!/usr/bin/env python
from distutils.core import setup
setup(
    # ...
    install_requires=['SomeLib']
)

Upvotes: 3

user2665694
user2665694

Reputation:

You specify all dependent packages in the 'install_requires' option within your setup.py - that's it.

If this is not sufficient or good enough (for whatever reason): look into zc.buildout giving your more options installing and configuring external dependencies.

Upvotes: 1

Related Questions