GEM-benchmark / NL-Augmenter

NL-Augmenter 🦎 → 🐍 A Collaborative Repository of Natural Language Transformations
MIT License
777 stars 196 forks source link

`ocr_perturbation` requirements issues #320

Open Saad-Mahamood opened 3 years ago

Saad-Mahamood commented 3 years ago

The ocr_perturbation package requires trdg==1.6.0. However, under macOS 11.6 with Python 3.9 it will not install due to a dependency on pillow==7.0.0, which generates a RequiredDependencyException: zlib error.

Installing pillow==8.3.2 works fine but is too new for trdg==1.6.0.

Installing trdg==1.7.0 has a dependency conflicts with opencv-python:

ERROR: Cannot install opencv-python==4.5.3.56, trdg and trdg==1.7.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    trdg 1.7.0 depends on numpy<1.17 and >=1.16.4
    opencv-python 4.5.3.56 depends on numpy>=1.19.3
    trdg 1.7.0 depends on numpy<1.17 and >=1.16.4
    opencv-python 4.5.2.54 depends on numpy>=1.19.3
    trdg 1.7.0 depends on numpy<1.17 and >=1.16.4
    opencv-python 4.5.2.52 depends on numpy>=1.19.3
    trdg 1.7.0 depends on numpy<1.17 and >=1.16.4
    opencv-python 4.5.1.48 depends on numpy>=1.19.3
    trdg 1.7.0 depends on numpy<1.17 and >=1.16.4
    opencv-python 4.4.0.46 depends on numpy>=1.19.3
    trdg 1.7.0 depends on numpy<1.17 and >=1.16.4
    opencv-python 4.4.0.42 depends on numpy>=1.17.3
    trdg 1.7.0 depends on numpy<1.17 and >=1.16.4
    opencv-python 4.4.0.40 depends on numpy>=1.17.3
    trdg 1.7.0 depends on numpy<1.17 and >=1.16.4
    opencv-python 4.3.0.38 depends on numpy>=1.17.3
AbinayaM02 commented 3 years ago

@mnamysl: Please look into this issue.

mnamysl commented 3 years ago

Hi @Saad-Mahamood. Thank you for reporting this issue.

As you already noticed, the problem is caused by the mutually exclusive dependencies: trdg 1.7.0 requires numpy<1.17 and >=1.16.4 and opencv-python 4.5.2.54 requires numpy>=1.19.3.

On the other hand, trdg 1.6.0 requires numpy>=1.17.3 but it puts a strict requirement on the Pillow package: pillow==7.0.0.

I tested both setups using Docker with a Python3.9 base image and the current version that uses trdg 1.6.0 seems to work fine, although I had to additionally install the libjpeg system package (apt-get install -y libjpeg-dev).

If you experience problems with zlib, please make sure that it is installed. Under Debian-based Linux systems, you could use: apt-get install zlib1g-dev and probably brew install zlib or brew install zlib-devel on Mac OS.

Please let me know if that helped.