Multiple CV2 Python errors running ComfyUI

I am getting several errors with Python 3.10 running ComfyUI related to CV2. Errors state – AttributeError: module ‘cv2.gapi.wip.draw’ has no attribute ‘Text’

Google showed that I need to uninstall and reinstall opencv-python and opencv-contrib-python. In attemption to uninstall both from the venv folder in ComfyUI I received the following errors –

I am a real neophyte and have no idea where to go next. People that have reported this error also report that the action above solves it but obviously not if I can’t do the uninstalls prior to reinstalling. Appreciate any assistance – thanks.

fredlefevre@MacBook-Pro-2 comfyui % cd venv
fredlefevre@MacBook-Pro-2 venv % pip uninstall opencv-python
Found existing installation: opencv-python 4.8.1.78
Uninstalling opencv-python-4.8.1.78:
  Would remove:
    /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/opencv_python-4.8.1.78.dist-info/*
Proceed (Y/n)? y
ERROR: Exception:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 816, in move
    os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/opencv_python-4.8.1.78.dist-info/' -> '/private/var/folders/lk/rkxhyrr966v_s_jq18ck1zb00000gn/T/pip-uninstall-ofezrs7a'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
    status = run_func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_internal/commands/uninstall.py", line 105, in run
    uninstall_pathset = req.uninstall(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_internal/req/req_install.py", line 725, in uninstall
    uninstalled_pathset.remove(auto_confirm, verbose)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_internal/req/req_uninstall.py", line 381, in remove
    moved.stash(path)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_internal/req/req_uninstall.py", line 272, in stash
    renames(path, new_path)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_internal/utils/misc.py", line 362, in renames
    shutil.move(old, new)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 834, in move
    rmtree(src)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 731, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 729, in rmtree
    os.rmdir(path)
PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/opencv_python-4.8.1.78.dist-info/'
fredlefevre@MacBook-Pro-2 venv % pip uninstall opencv-contrib-python
Found existing installation: opencv-contrib-python 4.8.1.78
Uninstalling opencv-contrib-python-4.8.1.78:
  Would remove:
    /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/opencv_contrib_python-4.8.1.78.dist-info/*
Proceed (Y/n)? Y
ERROR: Exception:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 816, in move
    os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/opencv_contrib_python-4.8.1.78.dist-info/' -> '/private/var/folders/lk/rkxhyrr966v_s_jq18ck1zb00000gn/T/pip-uninstall-76x65p93'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
    status = run_func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_internal/commands/uninstall.py", line 105, in run
    uninstall_pathset = req.uninstall(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_internal/req/req_install.py", line 725, in uninstall
    uninstalled_pathset.remove(auto_confirm, verbose)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_internal/req/req_uninstall.py", line 381, in remove
    moved.stash(path)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_internal/req/req_uninstall.py", line 272, in stash
    renames(path, new_path)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_internal/utils/misc.py", line 362, in renames
    shutil.move(old, new)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 834, in move
    rmtree(src)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 731, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 729, in rmtree
    os.rmdir(path)
PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/opencv_contrib_python-4.8.1.78.dist-info/

As noted above I tried running two uninstall commands and received the errors noted.

Leave a Comment