Search code examples
pythonsetuptoolsxlib

How to include Python-Xlib as a dependency in setup.py?


In my setup.py file, I can declare that PyUserInput is a requirement for my project (Python 3), but a prerequisite for PyUserInput on Linux is the Python module Xlib.

This is the relevant part of my setup.py file:

setup(...
      install_requires=['requests', 'nose', 'PyUserInput'],
      ...
      )

I tried putting Python-Xlib and Xlib into the install_requires argument, which didn't work since setuptools couldn't resolve those names automatically.

What do I need to do? I would prefer to be able to have the single command sudo python3 setup.py install handle installing all of the prerequisites for my package and not have to ask the user to manually install some prerequisites.


Solution

  • Using pip search xlib, I found that there was a package named python3-xlib. Adding python3-xlib as a requirement in setup.py was sufficient.