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

pointpats on conda-forge fails pip check #80

Closed
giswqs opened this issue Apr 2, 2022 · 5 comments
Closed

pointpats on conda-forge fails pip check #80

giswqs opened this issue Apr 2, 2022 · 5 comments

Comments

@giswqs
Copy link
Contributor

giswqs commented Apr 2, 2022

Conda-forge now recommends adding pip check in the recipe. The pointpats package on the conda-forge channel fails pip check with an error pointpats 2.2.0 requires opencv-contrib-python, which is not installed. This is causing issues for all downstream packages that might be submitted to the conda-forge channel in the future. It appears that opencv-contrib-python in the setup.py, but it is not available on the conda-forge channel.

https://github.com/conda-forge/pointpats-feedstock/blob/b433cecfc45129bae5fe956f11f0b7b20efa339d/recipe/meta.yaml#L21

@giswqs
Copy link
Contributor Author

giswqs commented Apr 2, 2022

Steps to reproduce the error:

conda install -c conda-forge pointpats
pip check

@ljwolf
Copy link
Member

ljwolf commented Apr 8, 2022

Hi @giswqs! The odd thing is that, I think, the package does not require opencv. It's a "soft dependency," being that one function attempts to import it, but if the package is not provided, then the function simply errors. This pattern is used elsehwere in python (such as pandas.read_excel) and is pretty common... I will need to read up on how pip check works in order to resolve the issue.

@giswqs
Copy link
Contributor Author

giswqs commented Apr 8, 2022

The opencv-contrib-python package is listed on the requirements.txt, which is causing the issue. If you remove it from requirements.txt and check the dependency in a module and prompt users to install them if needed, that should solve the issue.

@giswqs
Copy link
Contributor Author

giswqs commented Apr 15, 2022

It appears that the only function using opencv is minimum_rotated_rectangle(). Since the function already provides error handling, I think opencv-contrib-python can be safely removed from requirements.txt. Otherwise, it will cause issues for all pysal downstream packages on conda-forge with pip check. Also, opencv-contrib-python is quite a large package (150MB). including such a large package as a required dependency that is only used by one function is not ideal.

try:
from cv2 import minAreaRect, boxPoints
except ModuleNotFoundError:
raise ModuleNotFoundError("OpenCV2 is required to use this function.")

@martinfleis
Copy link
Member

I believe that this was resolved by #82.

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

3 participants