Kitware / nrtk

The Natural Robustness Toolkit (NRTK) is an open source toolkit for generating operationally-realistic perturbations to evaluate the natural robustness of computer vision algorithms.
Apache License 2.0
9 stars 3 forks source link

Dependency on opencv-python #2

Closed Erotemic closed 1 week ago

Erotemic commented 2 months ago

In the pyproject.toml there is a dependency on opencv-python, which has an unfortunate set of consequences when you install this library with another application that needs opencv-python-headless.

This issue is documented here: https://github.com/opencv/opencv-python/issues/467

This is something I've mentioned to the mmcv team, although it looks like they haven't seen or reviewed: https://github.com/open-mmlab/mmcv/pull/2775

The workaround that I've used to address this problem is by adding both opencv-python and opencv-python-headless as different "extras" dependencies. This means the user is forced to use either: pip install nrtk[headless] or pip install nrtk[graphics], which is annoying, but an import-time message can help with any confusion caused by this, and I can't think of a better way.

This issue is also present in a second dependency https://github.com/Kitware/pyBSM which I found by running: johnnydep nrtk

``` nrtk An open source toolkit for evaluating the natural robustness of computer vision algorithms. ├── Pillow>=10.3.0 Python Imaging Library (Fork) ├── numpy<2.0,>=1.25 Fundamental package for array computing in Python ├── opencv-python>=4.6 Wrapper package for OpenCV python bindings. │ ├── numpy>=1.17.0 Fundamental package for array computing in Python │ ├── numpy>=1.17.3 Fundamental package for array computing in Python │ ├── numpy>=1.19.3 Fundamental package for array computing in Python │ ├── numpy>=1.21.2 Fundamental package for array computing in Python │ └── numpy>=1.23.5 Fundamental package for array computing in Python ├── pybsm>=0.5.1 pyBSM is a Python-based tool for sensor modeling. It provides common components useful for simulating the image formation process through different imaging systems. │ ├── matplotlib>=3.5.2 Python plotting package │ │ ├── contourpy>=1.0.1 Python library for calculating contours of 2D quadrilateral grids │ │ │ └── numpy>=1.20 Fundamental package for array computing in Python │ │ ├── cycler>=0.10 Composable style cycles │ │ ├── fonttools>=4.22.0 Tools to manipulate font files │ │ ├── kiwisolver>=1.3.1 A fast implementation of the Cassowary constraint solver │ │ ├── numpy>=1.23 Fundamental package for array computing in Python │ │ ├── packaging>=20.0 Core utilities for Python packages │ │ ├── pillow>=8 Python Imaging Library (Fork) │ │ ├── pyparsing>=2.3.1 pyparsing module - Classes and methods to define and execute parsing grammars │ │ └── python-dateutil>=2.7 Extensions to the standard Python datetime module │ │ └── six>=1.5 Python 2 and 3 compatibility utilities │ ├── numpy<2.0,>=1.25 Fundamental package for array computing in Python │ ├── opencv-python>=4.6 Wrapper package for OpenCV python bindings. │ │ ├── numpy>=1.17.0 Fundamental package for array computing in Python │ │ ├── numpy>=1.17.3 Fundamental package for array computing in Python │ │ ├── numpy>=1.19.3 Fundamental package for array computing in Python │ │ ├── numpy>=1.21.2 Fundamental package for array computing in Python │ │ └── numpy>=1.23.5 Fundamental package for array computing in Python │ ├── scipy<1.14,>=1.10.0 Fundamental algorithms for scientific computing in Python │ │ └── numpy<2.3,>=1.22.4 Fundamental package for array computing in Python │ └── setuptools>=65.6.1 Easily download, build, install, upgrade, and uninstall Python packages ├── pycocotools>=2.0.6 Official APIs for the MS-COCO dataset │ ├── matplotlib>=2.1.0 Python plotting package │ │ ├── contourpy>=1.0.1 Python library for calculating contours of 2D quadrilateral grids │ │ │ └── numpy>=1.20 Fundamental package for array computing in Python │ │ ├── cycler>=0.10 Composable style cycles │ │ ├── fonttools>=4.22.0 Tools to manipulate font files │ │ ├── kiwisolver>=1.3.1 A fast implementation of the Cassowary constraint solver │ │ ├── numpy>=1.23 Fundamental package for array computing in Python │ │ ├── packaging>=20.0 Core utilities for Python packages │ │ ├── pillow>=8 Python Imaging Library (Fork) │ │ ├── pyparsing>=2.3.1 pyparsing module - Classes and methods to define and execute parsing grammars │ │ └── python-dateutil>=2.7 Extensions to the standard Python datetime module │ │ └── six>=1.5 Python 2 and 3 compatibility utilities │ └── numpy Fundamental package for array computing in Python ├── scikit-image<0.22,>=0.21 Image processing in Python │ ├── PyWavelets>=1.1.1 PyWavelets, wavelet transform module │ │ └── numpy<3,>=1.22.4 Fundamental package for array computing in Python │ ├── imageio>=2.27 Library for reading and writing a wide range of image, video, scientific, and volumetric data formats. │ │ ├── numpy Fundamental package for array computing in Python │ │ └── pillow>=8.3.2 Python Imaging Library (Fork) │ ├── lazy_loader>=0.2 Makes it easy to load subpackages and functions on demand. │ │ └── packaging Core utilities for Python packages │ ├── networkx>=2.8 Python package for creating and manipulating graphs and networks │ ├── numpy>=1.21.1 Fundamental package for array computing in Python │ ├── packaging>=21 Core utilities for Python packages │ ├── pillow>=9.0.1 Python Imaging Library (Fork) │ ├── scipy>=1.8 Fundamental algorithms for scientific computing in Python │ │ └── numpy<2.3,>=1.23.5 Fundamental package for array computing in Python │ └── tifffile>=2022.8.12 Read and write TIFF files │ └── numpy Fundamental package for array computing in Python ├── setuptools>=65.6.1 Easily download, build, install, upgrade, and uninstall Python packages ├── smqtk-classifier>=0.19.0 Algorithms, data structures and utilities around performing classificationof inputs. │ ├── numpy<2.0.0,>=1.19.5 Fundamental package for array computing in Python │ ├── smqtk-core>=0.18.0 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ ├── smqtk-dataprovider>=0.16.0 SMQTK Data provision abstractions and implementations │ │ ├── numpy>=1.23.5 Fundamental package for array computing in Python │ │ ├── requests>=2.28.1 Python HTTP for Humans. │ │ │ ├── certifi>=2017.4.17 Python package for providing Mozilla's CA Bundle. │ │ │ ├── charset-normalizer<4,>=2 The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. │ │ │ ├── idna<4,>=2.5 Internationalized Domain Names in Applications (IDNA) │ │ │ └── urllib3<3,>=1.21.1 HTTP library with thread-safe connection pooling, file post, and more. │ │ └── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ └── smqtk-descriptors>=0.18 Algorithms, data structures and utilities around computingdescriptor vectors from data. │ ├── numpy>=1.19.5 Fundamental package for array computing in Python │ ├── smqtk-core>=0.18.0 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ ├── smqtk-dataprovider>=0.16.0 SMQTK Data provision abstractions and implementations │ │ ├── numpy>=1.23.5 Fundamental package for array computing in Python │ │ ├── requests>=2.28.1 Python HTTP for Humans. │ │ │ ├── certifi>=2017.4.17 Python package for providing Mozilla's CA Bundle. │ │ │ ├── charset-normalizer<4,>=2 The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. │ │ │ ├── idna<4,>=2.5 Internationalized Domain Names in Applications (IDNA) │ │ │ └── urllib3<3,>=1.21.1 HTTP library with thread-safe connection pooling, file post, and more. │ │ └── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ └── smqtk-image-io>=0.17.0 SMQTK Image IO │ ├── numpy>=1.21 Fundamental package for array computing in Python │ ├── pillow>=8.2.0 Python Imaging Library (Fork) │ ├── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ └── smqtk-dataprovider>=0.16.0 SMQTK Data provision abstractions and implementations │ ├── numpy>=1.23.5 Fundamental package for array computing in Python │ ├── requests>=2.28.1 Python HTTP for Humans. │ │ ├── certifi>=2017.4.17 Python package for providing Mozilla's CA Bundle. │ │ ├── charset-normalizer<4,>=2 The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. │ │ ├── idna<4,>=2.5 Internationalized Domain Names in Applications (IDNA) │ │ └── urllib3<3,>=1.21.1 HTTP library with thread-safe connection pooling, file post, and more. │ └── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. ├── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. ├── smqtk-detection>=0.19.0 Algorithms, data structures and utilities around performing detection of inputs │ ├── smqtk-classifier>=0.19.0 Algorithms, data structures and utilities around performing classificationof inputs. │ │ ├── numpy<2.0.0,>=1.19.5 Fundamental package for array computing in Python │ │ ├── smqtk-core>=0.18.0 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ │ ├── smqtk-dataprovider>=0.16.0 SMQTK Data provision abstractions and implementations │ │ │ ├── numpy>=1.23.5 Fundamental package for array computing in Python │ │ │ ├── requests>=2.28.1 Python HTTP for Humans. │ │ │ │ ├── certifi>=2017.4.17 Python package for providing Mozilla's CA Bundle. │ │ │ │ ├── charset-normalizer<4,>=2 The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. │ │ │ │ ├── idna<4,>=2.5 Internationalized Domain Names in Applications (IDNA) │ │ │ │ └── urllib3<3,>=1.21.1 HTTP library with thread-safe connection pooling, file post, and more. │ │ │ └── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ │ └── smqtk-descriptors>=0.18 Algorithms, data structures and utilities around computingdescriptor vectors from data. │ │ ├── numpy>=1.19.5 Fundamental package for array computing in Python │ │ ├── smqtk-core>=0.18.0 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ │ ├── smqtk-dataprovider>=0.16.0 SMQTK Data provision abstractions and implementations │ │ │ ├── numpy>=1.23.5 Fundamental package for array computing in Python │ │ │ ├── requests>=2.28.1 Python HTTP for Humans. │ │ │ │ ├── certifi>=2017.4.17 Python package for providing Mozilla's CA Bundle. │ │ │ │ ├── charset-normalizer<4,>=2 The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. │ │ │ │ ├── idna<4,>=2.5 Internationalized Domain Names in Applications (IDNA) │ │ │ │ └── urllib3<3,>=1.21.1 HTTP library with thread-safe connection pooling, file post, and more. │ │ │ └── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ │ └── smqtk-image-io>=0.17.0 SMQTK Image IO │ │ ├── numpy>=1.21 Fundamental package for array computing in Python │ │ ├── pillow>=8.2.0 Python Imaging Library (Fork) │ │ ├── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ │ └── smqtk-dataprovider>=0.16.0 SMQTK Data provision abstractions and implementations │ │ ├── numpy>=1.23.5 Fundamental package for array computing in Python │ │ ├── requests>=2.28.1 Python HTTP for Humans. │ │ │ ├── certifi>=2017.4.17 Python package for providing Mozilla's CA Bundle. │ │ │ ├── charset-normalizer<4,>=2 The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. │ │ │ ├── idna<4,>=2.5 Internationalized Domain Names in Applications (IDNA) │ │ │ └── urllib3<3,>=1.21.1 HTTP library with thread-safe connection pooling, file post, and more. │ │ └── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ ├── smqtk-core>=0.18.0 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ ├── smqtk-dataprovider>=0.16.0 SMQTK Data provision abstractions and implementations │ │ ├── numpy>=1.23.5 Fundamental package for array computing in Python │ │ ├── requests>=2.28.1 Python HTTP for Humans. │ │ │ ├── certifi>=2017.4.17 Python package for providing Mozilla's CA Bundle. │ │ │ ├── charset-normalizer<4,>=2 The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. │ │ │ ├── idna<4,>=2.5 Internationalized Domain Names in Applications (IDNA) │ │ │ └── urllib3<3,>=1.21.1 HTTP library with thread-safe connection pooling, file post, and more. │ │ └── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ └── smqtk-image-io>=0.17.0 SMQTK Image IO │ ├── numpy>=1.21 Fundamental package for array computing in Python │ ├── pillow>=8.2.0 Python Imaging Library (Fork) │ ├── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ └── smqtk-dataprovider>=0.16.0 SMQTK Data provision abstractions and implementations │ ├── numpy>=1.23.5 Fundamental package for array computing in Python │ ├── requests>=2.28.1 Python HTTP for Humans. │ │ ├── certifi>=2017.4.17 Python package for providing Mozilla's CA Bundle. │ │ ├── charset-normalizer<4,>=2 The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. │ │ ├── idna<4,>=2.5 Internationalized Domain Names in Applications (IDNA) │ │ └── urllib3<3,>=1.21.1 HTTP library with thread-safe connection pooling, file post, and more. │ └── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. ├── smqtk-image-io>=0.17.1 SMQTK Image IO │ ├── numpy>=1.21 Fundamental package for array computing in Python │ ├── pillow>=8.2.0 Python Imaging Library (Fork) │ ├── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. │ └── smqtk-dataprovider>=0.16.0 SMQTK Data provision abstractions and implementations │ ├── numpy>=1.23.5 Fundamental package for array computing in Python │ ├── requests>=2.28.1 Python HTTP for Humans. │ │ ├── certifi>=2017.4.17 Python package for providing Mozilla's CA Bundle. │ │ ├── charset-normalizer<4,>=2 The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. │ │ ├── idna<4,>=2.5 Internationalized Domain Names in Applications (IDNA) │ │ └── urllib3<3,>=1.21.1 HTTP library with thread-safe connection pooling, file post, and more. │ └── smqtk-core>=0.19 Python toolkit for pluggable algorithms and data structures for multimedia-based machine learning. └── tqdm>=4.64 Fast, Extensible Progress Meter ```

So it will need to be fixed there first. I will post an issue there as well.

bjrichardwebster commented 1 week ago

The fix should be in now as of this commit, and was released in nrtk==0.12.0 and pybsm==0.7.0. Closing the Issue, please re-open if the issue persists.