Ensurepip failing with “Access is denied” error when attempting to read Windows file

Here is a transcript of using venv --system-site-packages that just worked.
I show that the global install of config-path is available in the venv.
Also show that pip is in the venv and that it works by using pip.exe list.

Hopefully this helps you find the difference between your setup and mine.

: 10:40:43.09 C:\Users\barry
: \\BARNSTONE\barry> C:\Users\barry\AppData\Local\Programs\Python\Python310\python.exe -m pip install config-path
Collecting config-path
  Downloading config_path-1.0.3-py3-none-any.whl (8.8 kB)
Installing collected packages: config-path
Successfully installed config-path-1.0.3

[notice] A new release of pip is available: 23.0.1 -> 23.2.1
[notice] To update, run: C:\Users\barry\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip

: 10:41:16.02 C:\Users\barry
: \\BARNSTONE\barry> C:\Users\barry\AppData\Local\Programs\Python\Python310\python.exe -m venv --system-site-packages wvenv

: 10:42:26.03 C:\Users\barry
: \\BARNSTONE\barry> dir wvenv\Scripts
 Volume in drive C is Windows
 Volume Serial Number is E824-EA1B

 Directory of C:\Users\barry\wvenv\Scripts

2023-07-29  10:42    <DIR>          .
2023-07-29  10:42    <DIR>          ..
2023-07-29  10:42             2,062 activate
2023-07-29  10:42               991 activate.bat
2023-07-29  10:42            26,199 Activate.ps1
2023-07-29  10:42               393 deactivate.bat
2023-07-29  10:42           108,398 pip.exe
2023-07-29  10:42           108,398 pip3.10.exe
2023-07-29  10:42           108,398 pip3.exe
2023-07-29  10:42           268,568 python.exe
2023-07-29  10:42           257,304 pythonw.exe
               9 File(s)        880,711 bytes
               2 Dir(s)  95,793,012,736 bytes free

: 10:43:13.30 C:\Users\barry
: \\BARNSTONE\barry> wvenv\Scripts\pip.exe list
Package               Version
--------------------- -----------
colour-text           1.0.4
config-path           1.0.3
et-xmlfile            1.1.0
namedstruct           1.2.3
pip                   23.0.1
PyQt5                 5.15.7
PyQt5-Qt5             5.15.2
PyQt5-sip             12.11.0
PyQt6                 6.4.0
PyQt6-Qt6             6.4.1
PyQt6-sip             13.4.0
pytz-deprecation-shim 0.1.0.post0
setuptools            65.5.0
tzdata                2022.7
tzlocal               4.2
win-app-packager      1.5.0

[notice] A new release of pip is available: 23.0.1 -> 23.2.1
[notice] To update, run: C:\Users\barry\wvenv\Scripts\python.exe -m pip install --upgrade pip

: 10:43:45.39 C:\Users\barry
: \\BARNSTONE\barry> wvenv\Scripts\python.exe
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import config_path
>>> config_path
<module 'config_path' from 'C:\\Users\\barry\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\config_path\\__init__.py'>
>>> ^Z

Sorry for misleading you, this is what I set. Use 2 with extract tool.

As I have to work now, roll back to 3.9, waiting for further analysis later.

Paste code for further testing.

import runpy
import sys
sys.path = ['D:\\Documents\\Downloads\\Test\\setuptools-65.5.0-py3-none-any.whl', 'D:\\Documents\\Downloads\\Test\\pip-23.0.1-py3-none-any.whl'] + sys.path
sys.argv[1:] = ['install', '--no-cache-dir', '--no-index', '--find-links', 'D:\\Documents\\Downloads\\Test', '--upgrade', 'setuptools', 'pip']
runpy.run_module("pip", run_name="__main__", alter_sys=True)

With the workaround in Discussion, it solved.
Let’s close it in the future.