Skip to content

Commit 1268488

Browse files
Uninstall opencv included in base image (#7626)
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>
1 parent da3ecdd commit 1268488

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ RUN git clone --recursive https://github.com/zarr-developers/numcodecs.git && pi
2222

2323
WORKDIR /opt/monai
2424

25+
# remove opencv-python before opencv-python-headless installation
26+
RUN pip uninstall -y opencv && rm /usr/local/lib/python3.10/dist-packages/cv2 -r
27+
2528
# install full deps
2629
COPY requirements.txt requirements-min.txt requirements-dev.txt /tmp/
2730
RUN cp /tmp/requirements.txt /tmp/req.bak \

monai/data/video_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def get_available_codecs() -> dict[str, str]:
177177
with tempfile.TemporaryDirectory() as tmp_dir:
178178
for codec, ext in all_codecs.items():
179179
fname = os.path.join(tmp_dir, f"test{ext}")
180-
fourcc = cv2.VideoWriter_fourcc(*codec)
180+
fourcc = cv2.VideoWriter_fourcc(*codec) # type: ignore[attr-defined]
181181
noviderr = writer.open(fname, fourcc, 1, (10, 10))
182182
if noviderr:
183183
codecs[codec] = ext

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ zarr
5757
lpips==0.1.4
5858
nvidia-ml-py
5959
huggingface_hub
60+
opencv-python-headless

0 commit comments

Comments
 (0)