poppy-project/pypot

Request: make opencv-contrib an optional dependency

Gregwar opened this issue · 4 comments

In a project with students, the installation of pypot on a Raspberry Pi takes very long because of the dependency with opencv-contrib-python.

I think it should be possible to use Pypot without this external dependency since people using a library to communicate with Dynamixel devices don't necessary need OpenCV's contrib. Maybe this should move to extra_requires, where pypot features using opencv contrib (which I don't know) would then be unavailable.

Do you think to an alternative solution where we could make it optional in some situations where this is explicitly requested?
e.g. another package pypot-nocv or maybe make it optional only for specific CPU archs (but I don't like so much this later option since it also breaks the current behavior for all users including those who need using cv on raspi).

I don't know what features require the use of OpenCV contribs in PyPot.

Strangely, a comment in your setup.py seems to imply that using cameras is something extra/optional:
https://github.com/poppy-project/pypot/blob/master/setup.py#L49

But opencv-contrib-python is in the basic dependencies (maybe it was added later).

My opinion is that using cameras and OpenCV should not be a requirement when your needs boils down to merely communicate with Dynamixel servos, so there should be a way to install pypot without it. (I forked it, removed opencv dependency and pushed it as pypot_gregwar so that the students can install it this week.)

I don't know what features require the use of OpenCV contribs in PyPot.

OpenCV is used by pypot/sensors/*, and more especially in OpenCVCamera that is loaded on all Poppy-* robots by default (e.g. here for Poppy Ergo Jr robot).

Therefore, deleting the requirement to OpenCV in the setup file would break all installations of poppy- packages: at instantiation (e.g. p = PoppyErgoJr()), an ImportError would be raised.

OpenCV should not be a requirement when your needs boils down to merely communicate with Dynamixel servos, so there should be a way to install pypot without it

Pypot does much more than just communication with Dynamixel motors :) But I get the idea.

I don't know much the behavior of install_requires: according to you, in the situation I described here above, if poppy-ergo-jr (and all poppy- packages for robots) have install_requires=opencv-contrib-python and pypot has only extra_requires=opencv-contrib-python, that would satisfy your request without breaking Poppy robots?

Yes, if opencv-contrib-python is already a dependency of poppy-ergo-jr, that would work.

Another way would be to:

  1. Move opencv-contrib-python dependency to extra_requires (for example in the camera section)
  2. Update dependencies to pypot to pypot[camera] for example where you use a library that itself will need the camera