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

**URL:** <https://discuss.python.org/t/ensurepip-failing-with-access-is-denied-error-when-attempting-to-read-windows-file/30241>\
**Category:** Python Help\
**Tags:** help\
**Created:** [July 25, 2023, 9:34am UTC](https://discuss.python.org/t/ensurepip-failing-with-access-is-denied-error-when-attempting-to-read-windows-file/30241 "2023-07-25T09:34:55Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![barry-scott](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@barry-scott](https://discuss.python.org/u/barry-scott)\
**Post date:** [July 29, 2023, 9:52am UTC](https://discuss.python.org/t/ensurepip-failing-with-access-is-denied-error-when-attempting-to-read-windows-file/30241/21 "2023-07-29T09:52:29Z")

</div>

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.

```bash
: 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

```

---

<div class="post-metadata">

**Author:** ![AK88](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AK88](https://discuss.python.org/u/AK88)\
**Post date:** [July 31, 2023, 7:25am UTC](https://discuss.python.org/t/ensurepip-failing-with-access-is-denied-error-when-attempting-to-read-windows-file/30241/22 "2023-07-31T07:25:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AK88](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AK88](https://discuss.python.org/u/AK88)\
**Post date:** [July 31, 2023, 8:07am UTC](https://discuss.python.org/t/ensurepip-failing-with-access-is-denied-error-when-attempting-to-read-windows-file/30241/23 "2023-07-31T08:07:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AK88](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AK88](https://discuss.python.org/u/AK88)\
**Post date:** [August 1, 2023, 2:28am UTC](https://discuss.python.org/t/ensurepip-failing-with-access-is-denied-error-when-attempting-to-read-windows-file/30241/24 "2023-08-01T02:28:25Z")

</div>

Paste code for further testing.

```auto
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)

```

---

<div class="post-metadata">

**Author:** ![AK88](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AK88](https://discuss.python.org/u/AK88)\
**Post date:** [August 4, 2023, 1:39am UTC](https://discuss.python.org/t/ensurepip-failing-with-access-is-denied-error-when-attempting-to-read-windows-file/30241/25 "2023-08-04T01:39:14Z")

</div>

With the workaround in [Discussion](https://discuss.python.org/t/ensurepip-failing-with-access-is-denied-error-when-attempting-to-read-windows-registry/21482/10), it solved.  
Let’s close it in the future.

[Previous page](https://discuss.python.org/t/ensurepip-failing-with-access-is-denied-error-when-attempting-to-read-windows-file/30241.md?page=1)
