lllyasviel / lllyasviel/FramePack

module 'cv2.dnn' has no attribute 'DictValue'

Open
#46 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
17.3k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

I installed the app with a simple dockerfile based on the nvidia pytorch 3.10 cuda 12.6 image:

```
FROM nvcr.io/nvidia/pytorch:24.10-py3

WORKDIR /app

COPY requirements.txt .
COPY demo_gradio.py .
COPY . .

RUN pip install --upgrade pip

# Base image already has PyTorch with CUDA support

RUN pip install -r requirements.txt

# RUN pip install sageattention==1.0.6
# RUN pip install xformers
# RUN pip install flash-attn

EXPOSE 7860

CMD ["python", "demo_gradio.py", "--server-name", "0.0.0.0"]
```

However this results in:

```
File "/app/demo_gradio.py", line 19, in
from diffusers_helper.hunyuan import encode_prompt_conds, vae_decode, vae_encode, vae_decode_fake
File "/app/diffusers_helper/hunyuan.py", line 4, in
from diffusers_helper.utils import crop_or_pad_yield_mask
File "/app/diffusers_helper/utils.py", line 2, in
import cv2
File "/usr/local/lib/python3.10/dist-packages/cv2/init.py", line 181, in
bootstrap()
File "/usr/local/lib/python3.10/dist-packages/cv2/init.py", line 175, in bootstrap
if load_extra_py_code_for_module("cv2", submodule, DEBUG):
File "/usr/local/lib/python3.10/dist-packages/cv2/init.py", line 28, in load_extra_py_code_for_module
py_module = importlib.import_module(module_name)
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return bootstrap.gcd_import(name[level:], package, level)
File "/usr/local/lib/python3.10/dist-packages/cv2/typing/init.py", line 162, in
LayerId = cv2.dnn.DictValue
AttributeError: module 'cv2.dnn' has no attribute 'DictValue'
```

I believe this can be fixed by installing a specific opencv version , as per: https://github.com/opencv/opencv-python/issues/884

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with requirements.txt and the Dockerfile based on the NVIDIA PyTorch image, then reproduce the import from demo_gradio.py to inspect the installed OpenCV package and its cv2.dnn API. Compare the dependency versions involved in the reported opencv-python issue; done means demo_gradio.py imports successfully without the cv2.dnn.DictValue error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, opencv, python
Domain
computer-vision, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.