Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: make opencv-contrib an optional dependency #308

Open
Gregwar opened this issue Oct 5, 2022 · 4 comments
Open

Request: make opencv-contrib an optional dependency #308

Gregwar opened this issue Oct 5, 2022 · 4 comments

Comments

@Gregwar
Copy link
Contributor

Gregwar commented Oct 5, 2022

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.

@ymollard
Copy link
Member

ymollard commented Oct 5, 2022

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).

@Gregwar
Copy link
Contributor Author

Gregwar commented Oct 5, 2022

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.)

@ymollard
Copy link
Member

ymollard commented Oct 5, 2022

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?

@Gregwar
Copy link
Contributor Author

Gregwar commented Oct 6, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants