1

The albumentations package requires some version of opencv-python. From setup.py:

# If none of packages in first installed, install second package
CHOOSE_INSTALL_REQUIRES = [
    (
        ("opencv-python>=4.1.1", "opencv-contrib-python>=4.1.1", "opencv-contrib-python-headless>=4.1.1"),
        "opencv-python-headless>=4.1.1",
    )
]

When I pip install, it seems to choose opencv-python-headless, which has a bug that prevents installation. (If you read the bug, it looks like I could install a different version of scikit-build, but that didn't seem to work.)

The workaround is to install a dev version of opencv-python, which I can with this line in requirements.txt:

git+https://github.com/opencv/opencv-python@5de8d66d454c8fd946ae17dcfcb285b16aa6049b

However, while installing albumentations, it decides to still install opencv-python-headless, presumably because the version number (installed from github) doesn't compare well.

How can I install albumentations and have it use my existing opencv-python install?

I installed pip-tools, and compiled the requirements for albumentation, and I've been messing with the file, but pip still follows dependencies for each package.

Can I use pip to install a package directly, without dependencies? Then I could do it one at a time, with the versions I want.

dfrankow
  • 20,191
  • 41
  • 152
  • 214

1 Answers1

0

Hi I had a similar problem what have done is:

  1. Install opencv-python using pip install opencv-python==4.5.5
  2. Download albumentations from github
  3. git checkout {albumentations_version} you want to install
  4. Change in albumentations/setup.py opencv-python>=4.1.1 with opencv-python==4.5.5.64
  5. Update pip. pip install pip --upgrade. My version is 22.1.2
  6. pip install albumentations/

At the end i have albumentations 1.1.0 installed with opencv-python==4.5.5 and not the latest version of opencv.

Eric Tondelli
  • 113
  • 1
  • 11