Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: stderr: ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'E:\\AI\\stable-diffusion-webui\\venv\\Lib\\site-packages\\cv2\\cv2.pyd' Check the permissions. #2297

Closed
1 task done
dilectiogames opened this issue Dec 6, 2023 · 15 comments

Comments

@dilectiogames
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits of both this extension and the webui

What happened?

short story

I'm trying to install controlnet

It fails with this output

stderr: ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'E:\AI\stable-diffusion-webui\venv\Lib\site-packages\cv2\cv2.pyd'
Check the permissions.

then

Warning: Failed to install mediapipe, some preprocessors may not work.

There are no other extensions installed. automatic1111 is on version v1.6.1 and it works

version: v1.6.1  •  python: 3.10.11  •  torch: 2.0.1+cu118  •  xformers: 0.0.20  •  gradio: 3.41.2

long story

I've tried to install controlnet twice

first time it broke automatic1111 installation, I've not saved the error from automatic after the controlnet extension failed to install. I've restored automatic by deleting the entire venv folder and this forced automatic to create that folder again.

trying to install again, got the same error message. fortunately automatic still works but controlnet extensions is not loaded and is not listed in the extensions tab. it also vanished from the available repository list.

deleting the controlnet folder from the extension folder will make the extension appear again in the available repository list. Attempting to install it again and I get the same error.

full output of the error while installing controlnet

Error code: 1
stdout: Collecting mediapipe
Downloading mediapipe-0.10.8-cp310-cp310-win_amd64.whl (50.5 MB)
---------------------------------------- 50.5/50.5 MB 2.5 MB/s eta 0:00:00
Requirement already satisfied: absl-py in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from mediapipe) (2.0.0)
Requirement already satisfied: numpy in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from mediapipe) (1.23.5)
Requirement already satisfied: matplotlib in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from mediapipe) (3.8.2)
Requirement already satisfied: attrs>=19.1.0 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from mediapipe) (23.1.0)
Collecting opencv-contrib-python
Downloading opencv_contrib_python-4.8.1.78-cp37-abi3-win_amd64.whl (44.8 MB)
---------------------------------------- 44.8/44.8 MB 2.7 MB/s eta 0:00:00
Requirement already satisfied: protobuf<4,>=3.11 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from mediapipe) (3.20.0)
Collecting sounddevice>=0.4.4
Downloading sounddevice-0.4.6-py3-none-win_amd64.whl (199 kB)
-------------------------------------- 199.7/199.7 kB 1.2 MB/s eta 0:00:00
Collecting flatbuffers>=2.0
Downloading flatbuffers-23.5.26-py2.py3-none-any.whl (26 kB)
Collecting CFFI>=1.0
Downloading cffi-1.16.0-cp310-cp310-win_amd64.whl (181 kB)
-------------------------------------- 181.6/181.6 kB 1.8 MB/s eta 0:00:00
Requirement already satisfied: cycler>=0.10 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (0.12.1)
Requirement already satisfied: contourpy>=1.0.1 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (1.2.0)
Requirement already satisfied: kiwisolver>=1.3.1 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (1.4.5)
Requirement already satisfied: pillow>=8 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (9.5.0)
Requirement already satisfied: pyparsing>=2.3.1 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (3.1.1)
Requirement already satisfied: packaging>=20.0 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (23.2)
Requirement already satisfied: python-dateutil>=2.7 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (2.8.2)
Requirement already satisfied: fonttools>=4.22.0 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (4.46.0)
Collecting pycparser
Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
-------------------------------------- 118.7/118.7 kB 2.3 MB/s eta 0:00:00
Requirement already satisfied: six>=1.5 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from python-dateutil>=2.7->matplotlib->mediapipe) (1.16.0)
Installing collected packages: flatbuffers, pycparser, opencv-contrib-python, CFFI, sounddevice, mediapipe

stderr: ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'E:\AI\stable-diffusion-webui\venv\Lib\site-packages\cv2\cv2.pyd'
Check the permissions.

[notice] A new release of pip is available: 23.0.1 -> 23.3.1
[notice] To update, run: E:\AI\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip

Warning: Failed to install mediapipe, some preprocessors may not work.
Installing sd-webui-controlnet requirement: svglib
Installing sd-webui-controlnet requirement: fvcore

Steps to reproduce the problem

try to install controlnet

What should have happened?

controlnet should had been installed and worked

Commit where the problem happens

webui: 4afaaf8a020c1df457bcf7250cb1c7f609699fa7
controlnet: I'have no idea which commit is trying to install the one from 6 December 2023

What browsers do you use to access the UI ?

No response

Command Line Arguments

--xformers --theme dark

List of enabled extensions

none, no extension installed except those that are installed by automatic

Console logs

Couldn't install sd-webui-controlnet requirement: mediapipe.
Command: "E:\AI\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install mediapipe --prefer-binary
Error code: 1
stdout: Collecting mediapipe
  Using cached mediapipe-0.10.8-cp310-cp310-win_amd64.whl (50.5 MB)
Requirement already satisfied: matplotlib in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from mediapipe) (3.8.2)
Requirement already satisfied: protobuf<4,>=3.11 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from mediapipe) (3.20.0)
Collecting opencv-contrib-python
  Using cached opencv_contrib_python-4.8.1.78-cp37-abi3-win_amd64.whl (44.8 MB)
Collecting sounddevice>=0.4.4
  Using cached sounddevice-0.4.6-py3-none-win_amd64.whl (199 kB)
Requirement already satisfied: attrs>=19.1.0 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from mediapipe) (23.1.0)
Requirement already satisfied: absl-py in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from mediapipe) (2.0.0)
Requirement already satisfied: numpy in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from mediapipe) (1.23.5)
Requirement already satisfied: flatbuffers>=2.0 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from mediapipe) (23.5.26)
Collecting CFFI>=1.0
  Using cached cffi-1.16.0-cp310-cp310-win_amd64.whl (181 kB)
Requirement already satisfied: packaging>=20.0 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (23.2)
Requirement already satisfied: pillow>=8 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (9.5.0)
Requirement already satisfied: cycler>=0.10 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (0.12.1)
Requirement already satisfied: pyparsing>=2.3.1 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (3.1.1)
Requirement already satisfied: kiwisolver>=1.3.1 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (1.4.5)
Requirement already satisfied: contourpy>=1.0.1 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (1.2.0)
Requirement already satisfied: fonttools>=4.22.0 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (4.46.0)
Requirement already satisfied: python-dateutil>=2.7 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mediapipe) (2.8.2)
Requirement already satisfied: pycparser in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from CFFI>=1.0->sounddevice>=0.4.4->mediapipe) (2.21)
Requirement already satisfied: six>=1.5 in e:\ai\stable-diffusion-webui\venv\lib\site-packages (from python-dateutil>=2.7->matplotlib->mediapipe) (1.16.0)
Installing collected packages: opencv-contrib-python, CFFI, sounddevice, mediapipe

stderr: ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'E:\\AI\\stable-diffusion-webui\\venv\\Lib\\site-packages\\cv2\\cv2.pyd'
Check the permissions.


[notice] A new release of pip is available: 23.0.1 -> 23.3.1
[notice] To update, run: E:\AI\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip

Warning: Failed to install mediapipe, some preprocessors may not work.

Additional information

No response

@FugueSegue
Copy link

@dilectiogames
Copy link
Author

dilectiogames commented Dec 6, 2023

I'm having the exact same problem.

this website search is a mess. I never get the results when searching

edit: but it doesn't look the same issue?

@FugueSegue
Copy link

I'm having the exact same problem.

this website search is a mess. I never get the results when searching

edit: but it doesn't look the same issue?

Yes, it's the same issue but different symptom. The extension installs but doesn't fully function. When I reinstalled Windows 10, installed A4, and then installed the extension, I noticed that "Warning: Failed to install mediapipe, some preprocessors may not work" error message. That's when I noticed your post. I think your post more directly addresses this bug.

Incidentally, I restored a fresh install of Windows 10. Without installing any other software, I installed A4 and then I tried to install the ControlNet extension again. Same thing happened again.

@dilectiogames
Copy link
Author

I'm having the exact same problem.

this website search is a mess. I never get the results when searching
edit: but it doesn't look the same issue?

Yes, it's the same issue but different symptom. The extension installs but doesn't fully function. When I reinstalled Windows 10, installed A4, and then installed the extension, I noticed that "Warning: Failed to install mediapipe, some preprocessors may not work" error message. That's when I noticed your post. I think your post more directly addresses this bug.

Incidentally, I restored a fresh install of Windows 10. Without installing any other software, I installed A4 and then I tried to install the ControlNet extension again. Same thing happened again.

for me it worked fine, controlnet but I've not used autoamtic for a month, tried to update it, for some reason it had NONE in the extension tab version. deleted the extension to reinstall it as new. then this happens

@FugueSegue
Copy link

FugueSegue commented Dec 6, 2023

My guess is the problem (as usual) came from upstream. There was some sort of big update for A4 recently.

EDIT: Nope, last A4 update was last month.

@FugueSegue
Copy link

I did a fresh install of Windows 10 again. A fresh install of A4 again. Tried to install the ControlNet extension and got the EXACT same errors as OP. Again. Clearly, the "media pipe" installation is the problem.

I wish I could provide more help. I'm just an artist with only a little programming experience.

@FugueSegue
Copy link

#1439

I found this issue from May/June. I tried the suggested command using PowerShell in Administrator mode:

C:\ai\stable-diffusion-webui\venv\Scripts\python.exe -m pip install mediapipe --prefer-binary

It said that all requirements were already there. I don't think it did anything. In A4, the Depth preprocessor still doesn't work.

This is baffling me. I've tried reinstalling Windows, A4, and the extension several times. Same results.

The extension works in SD.Next but I think it is because it is built into that repo in some sort of customized manner.

In A4, it doesn't work.

@dilectiogames
Copy link
Author

I believe mediapipe is already installed, after running this

pip install mediapipe --prefer-binary

I've got

Requirement already satisfied: mediapipe in c:\users\username\appdata\local\programs\python\python310\lib\site-packages (0.9.3.0)

why is trying to install it again? also. I've already had controlnet on this automatic installation working fine before removing the extension folder and trying a new install

@FugueSegue
Copy link

I had a theory that the sharing permissions I had set up may have caused problems. I had been putting all my AI art software and files in one directory in the C: root directory. Then I set up sharing permissions so I can access the files over the LAN. I thought that might have caused some sort of conflict.

I tried installing the webui in the C: root directory instead of the shared folder. Same result. Media pipe won't install.

I also tried installing the CUDA Toolkit, the latest drivers for my Nvidia A5000, and Python 3.10.11. None of that made any difference.

Is there any way I can install media pipe manually for the ControlNet extension?

I'm running Windows 10. Would installing Windows 11 make a difference?

I'm at my wit's end. It's been almost a week that I've been trying to solve this problem.

@FugueSegue
Copy link

#1258 (comment)

This post states a way to manually install mediapipe. It did not work.

@FugueSegue
Copy link

I made some progress. I was able to manually install a preprocessor.

When I last attempted to run the depth preprocessor, I got this error:

Downloading: "https://huggingface.co/lllyasviel/ControlNet/resolve/main/annotator/ckpts/dpt_hybrid-midas-501f0c75.pt" to C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads\midas\dpt_hybrid-midas-501f0c75.pt

Traceback (most recent call last):
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1283, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1329, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1278, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1038, in _send_output
    self.send(msg)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 976, in send
    self.connect()
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1455, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1071, in _create
    self.do_handshake()
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet_ui\controlnet_ui_group.py", line 694, in run_annotator
    result, is_image = preprocessor(
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\utils.py", line 75, in decorated_func
    return cached_func(*args, **kwargs)
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\utils.py", line 63, in cached_func
    return func(*args, **kwargs)
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\global_state.py", line 37, in unified_preprocessor
    return preprocessor_modules[preprocessor_name](*args, **kwargs)
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\processor.py", line 180, in midas
    result, _ = model_midas(img, a)
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\midas\__init__.py", line 19, in apply_midas
    model = MiDaSInference(model_type="dpt_hybrid")
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\midas\api.py", line 173, in __init__
    model, _ = load_model(model_type)
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\midas\api.py", line 106, in load_model
    load_file_from_url(remote_model_path, model_dir=base_model_path)
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\basicsr\utils\download_util.py", line 98, in load_file_from_url
    download_url_to_file(url, cached_file, hash_prefix=None, progress=progress)
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\torch\hub.py", line 611, in download_url_to_file
    u = urlopen(req)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 519, in open
    response = self._open(req, data)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)>

I copied this address:

https://huggingface.co/lllyasviel/ControlNet/resolve/main/annotator/ckpts/dpt_hybrid-midas-501f0c75.pt

and manually downloaded it in my browser. I placed in sd-webui-controlnet\annotator\downloads\midas

That worked. The depth preprocessor now functions. I'll see if I can manually download the others.

@FugueSegue
Copy link

I managed to get the ControlNet extension functioning.

With a fresh install of A4, I manually installed mediapipe using the procedure I linked to above. Then I installed the ControlNet extension and did not see any errors concerning mediapipe.

Another huge problem that might not be related is the fact that the extension fails to successfully download most of the preprocessors. By examining each error that shows up in the CLI, I copied the link to each preprocessor file from Huggingface. Then I moved them to the proper folder that the extension tried to put them.

My ControlNet extension works now. But the mediapipe issue and the preprocessor issue needs to be fixed.

@dilectiogames
Copy link
Author

dilectiogames commented Dec 11, 2023

I've managed to make the extension work

first all the various libraries that controlnet needs were already installed on my computer.

using the fix code that FugueSegue linked always returned that the requirements are already meet.

so I believe that trying to install the extension from the list of extensions in automatic may be the issue. I've clicked on the available tab and used the button in that list.

and every time I've got the error.

now I've instead used the manual installation to install using the direct link as it is linked on the extension github help file, this method

Open "Extensions" tab.
Open "Install from URL" tab in the tab.
Enter https://github.com/Mikubill/sd-webui-controlnet.git to "URL for extension's git repository".
Press "Install" button.
Wait for 5 seconds, and you will see the message "Installed into stable-diffusion-webui\extensions\sd-webui-controlnet. Use Installed tab to restart".
Go to "Installed" tab, click "Check for updates", and then click "Apply and restart UI". (The next time you can also use these buttons to update ControlNet.)
Completely restart A1111 webui including your terminal. (If you do not know what is a "terminal", you can reboot your computer to achieve the same effect.)
Download models (see below). (I had already the models and the preprocessors saved)
After you put models in the correct folder, you may need to refresh to see the models. The refresh button is right to your "Model" dropdown.

so now it works, no error no nothing.

@huchenlei huchenlei closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2024
@minh-ncm
Copy link

minh-ncm commented Apr 7, 2024

This work for me: https://stackoverflow.com/a/57132010. I Just followed the answer and changed the venv folder permission

@Rajnish2000
Copy link

hey Please help me to resolve my issue.

I am getting this error, when I am trying to install img2table package.
from img2table.document import Image

run command:- pip install img2table
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\Users\raj\AppData\Local\Programs\Python\Python312\Lib\site-packages\cv2\cv2.pyd'
Consider using the --user option or check the permissions.

please help me to reslove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants