pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: python opencv dependency



> 
> I am using pkgsrc opencv. Running python3.7, "import cv2" works. Trying
> to write a setup.py file which mentions that dependency fails:
> 
> # cat setup.py 
> from setuptools import setup
> 
> setup(
>        name='cvtest',
>        version='0.1',
>        description='How to depend on cv2',
>        install_requires=['cv2']
> )
> # python3.7 setup.py install
> running install
> ...
> Processing dependencies for cvtest==0.1
> Searching for cv2
> Reading https://pypi.org/simple/cv2/
> No local packages or working download links found for cv2
> error: Could not find suitable distribution for Requirement.parse('cv2')
> 
> 
> If I change 'cv2' to 'numpy', the same code happily finds py37-numpy-1.16.4
> 
> Any idea on what the difference is?

graphics/opencv does not install a real Python module(egg), but just  a bunch of Python files.
Also, cv2 package does not exist on PyPI.

In your setup.py, you can check the presence of OpenCV in a different way (e.g. try: import cv2). If not found, fail with a message that a binary OpenCV is required.

Kind regards,
Adam


Home | Main Index | Thread Index | Old Index