I'm trying to make my own package which uses OpenCV Python module cv2
. However when using PyCharm, it warns that the
Package requirement is not satisfied.
I suspect this is because I used the recommended method of copy/pasting cv2.pyd
into my python dir. Note that pip install cv2
doesn't work.
What's the right method to ensure that requirements are met when this package is brought in?
EDIT:
My setup.py file is as follows
from setuptools import setup
setup(name='image_processing',
version='0.1',
install_requires=['numpy', 'scipy', 'cv2'],
description='Collection of useful image processing functions',
url='',
author='Bill',
license='MIT',
packages=['image_processing'],
zip_safe=False)
This is where the error shows up when trying to package my code. Normally I have no issues importing numpy or cv2. I installed Numpy using pip, and cv2 via the method mentioned above. Everything works if I just run scripts using cv2, but it's this packaging that's tricking me up.
You need to add opencv-python
to requirements.
The package is here: https://pypi.python.org/pypi/opencv-python
Then, your requirements.txt
file is OK, but sometimes PyCharm keeps whining. If this is the case, then next to the "Install requirement" label there is "Ignore requirement". The latter is your way to go.
(current - 2018.2 PyCharm version does not complain about cv2
when opencv-python
is specified in requirements)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With