UnknownExtra error when installing via setup.py but not via pip

Viewed 318

I use ray[rllib] as a dependency for my Python package. Installing it via pip install ray[rllib] works perfectly fine. But listing ray[rllib] as dependency in my setup.py like this:

requirements = [
    'ray[rllib]==1.1.0',
# ...
}

leads to an error when running python setup.py develop: pkg_resources.UnknownExtra: ray 1.1.0 has no such extra feature 'rllib'.

I found a few related questions, eg, this, but they don't apply/solve my problem. ray does define the extra rllib in its setup.py.

Any idea how to solve this? I'm happy to contribute a patch/PR to ray.

Currently, my only workaround is first to manually install ray[rllib] via pip and then the remaining dependencies of my package with python setup.py install. But this isn't nice.

1 Answers

The general recommendation nowadays (from setuptools maintainers themselves) is to stop using:

  • python setup.py install
  • python setup.py develop

and instead use the following:

  • python -m pip install .
  • python -m pip install --editable .

But to be honest, I am a bit surprised that things fail here. I do not know exactly what is going wrong here in setuptools, and why python setup.py develop fails here.

Related