Skip to content

Commit

Permalink
Uninstall opencv included in base image (#7626)
Browse files Browse the repository at this point in the history
Fixes [tutorial
#1689](Project-MONAI/tutorials#1689)

### Description

Uninstall opencv included in base image.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
KumoLiu and pre-commit-ci[bot] authored Apr 12, 2024
1 parent da3ecdd commit 1268488
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ RUN git clone --recursive https://github.com/zarr-developers/numcodecs.git && pi

WORKDIR /opt/monai

# remove opencv-python before opencv-python-headless installation
RUN pip uninstall -y opencv && rm /usr/local/lib/python3.10/dist-packages/cv2 -r

# install full deps
COPY requirements.txt requirements-min.txt requirements-dev.txt /tmp/
RUN cp /tmp/requirements.txt /tmp/req.bak \
Expand Down
2 changes: 1 addition & 1 deletion monai/data/video_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def get_available_codecs() -> dict[str, str]:
with tempfile.TemporaryDirectory() as tmp_dir:
for codec, ext in all_codecs.items():
fname = os.path.join(tmp_dir, f"test{ext}")
fourcc = cv2.VideoWriter_fourcc(*codec)
fourcc = cv2.VideoWriter_fourcc(*codec) # type: ignore[attr-defined]
noviderr = writer.open(fname, fourcc, 1, (10, 10))
if noviderr:
codecs[codec] = ext
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ zarr
lpips==0.1.4
nvidia-ml-py
huggingface_hub
opencv-python-headless

0 comments on commit 1268488

Please sign in to comment.