2

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.

sinoroc
  • 18,409
  • 2
  • 39
  • 70
stefanbschneider
  • 5,460
  • 8
  • 50
  • 88
  • 1
    Did you eventually figure it out? -- Looks like I can not recreate the issue. The requirement notation seems correct. -- Wait, looks like I can recreate the issue after all... – sinoroc Feb 18 '21 at 19:48

1 Answers1

3

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.

sinoroc
  • 18,409
  • 2
  • 39
  • 70
  • So `pip install --editable .` works for you? I'll also check it out and let you know. – stefanbschneider Feb 19 '21 at 08:49
  • 1
    Yes with pip it works for me. I was able to recreate the issue when using `python setup.py develop` but never when using `python -m pip install --editable .`. – sinoroc Feb 19 '21 at 17:46