-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Bug] opencv-python vs opencv-python-headless dependency issue #298
Comments
Hello,
you mean that it works locally but not in the CI? I think the current setup is correct for the normal user: open cv non-headless version is required when possible (to use |
Sorry, I was installing |
|
I did a quick test and the SB3 import works fine in the docker image (I can run a PPO model), however I get this error (not a seg fault) when I try to import cv2:
However, if you use a fake display, as we do in the rl zoo (see this folder), then you can use |
Sorry, I was probably not clear. I am sure the docker image itself is fine. My point is more that the dependencies of the Python package are set up in a confusing mannner, which requires this deletion of a |
An alternative, at least with poetry, would be something like the following: ` opencv-python-headless = {version = "~4.5", optional = true} opencv-python = {version = "~4.5", optional = true} [tool.poetry.extras] extra = ["atari_py", "opencv-python"] extra-headless = ["atari_py", "opencv-python-headless"] and then people can install either Not sure if this is possible with I would be happy to try to submit a PR that sets the project using poetry, if you are interested. |
As it is quite a specific problem. I would rather document it, we already have that |
OK, cool. Yes, it is a bit niche, I suppose. :) I'll submit a PR for the documentation. |
Important Note: We do not do technical support, nor consulting and don't answer personal questions per email.
Please post your question on reddit or stack overflow in that case.
If your issue is related to a custom gym environment, please use the custom gym env template.
🐛 Bug
Currently you have your
setup.py
file configured to installopencv-python
. However, in your docker file you then uninstallopencv-python
and installopencv-python-headless
. I assume this is because you get a segmentation fault in the docker container unless you do this step.I have a repo with stable-baselines3 as a dependency. I had my tests working locally (macOS), but got a segmentation fault in CI (ubuntu).
I use Poetry, so I have resolved the issue using environment markers in my dependency configuration.
`
stable-baselines3 = "0.10.0"
atari_py = {version = "~0.2"}
opencv-python-headless = {version = "~4.5", markers = "sys_platform == 'linux'"}
opencv-python = {version = "~4.5", markers = "sys_platform == 'darwin'"}
`
If you used poetry you could take a similar approach, which would be cleaner than your current solution, I think.
To Reproduce
Install stable-baselines3[extra] in ubuntu and then run the following:
Expected behavior
No segmentation fault.
### System Info
Describe the characteristic of your environment:
Additional context
Add any other context about the problem here.
Checklist
The text was updated successfully, but these errors were encountered: