Skip to content

pip config failed to write pip.ini when using MS Store py #13292

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

Open
1 task done
imba-tjd opened this issue Mar 20, 2025 · 2 comments
Open
1 task done

pip config failed to write pip.ini when using MS Store py #13292

imba-tjd opened this issue Mar 20, 2025 · 2 comments
Labels
type: support User Support

Comments

@imba-tjd
Copy link

Description

Some locations are readonly when py is installed via MS Store.

I searched issues and there was one essentially reporting the same error just like what I'm encountering.
#11920

Expected behavior

Write to Appdata.

Or abort the action but show a graceful message to the user.

pip version

25.0.1

Python version

3.11

OS

Win11 24H2

How to Reproduce

  1. install python from ms store
  2. pip config set global.index-url xxx

Output

C:\Users\xxx>pip config set global.index-url xxx
Writing to C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\pip.ini
ERROR: Unable to save configuration. Please report this as a bug.
Traceback (most recent call last):
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pip\_internal\configuration.py", line 215, in save
    with open(fname, "w") as f:
         ^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\\pip.ini'
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pip\_internal\commands\configuration.py", line 265, in _save_configuration
    self.configuration.save()
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pip\_internal\configuration.py", line 218, in save
    raise ConfigurationError(
pip._internal.exceptions.ConfigurationError: An error occurred while writing to the configuration file C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\pip.ini: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\\pip.ini'
ERROR: Internal Error.

Code of Conduct

@imba-tjd imba-tjd added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Mar 20, 2025
@notatallshaw
Copy link
Member

notatallshaw commented Mar 20, 2025

If you run pip config debug you will see where the locations exist. If you want to write to the user/appdata directory that would likely be pip config set user.index-url xxx. I'm not sure but perhaps you will get automatic fallback with pip config set index-url xxx. You can check out the pip config docs here: https://pip.pypa.io/en/stable/cli/pip_config/

Pip doesn't have any control over the way it's installed via the Microsoft Store distribution, or the choices it makes about config files. I don't think it's a good design choice to automatically fall over from global to user config when the user explicitly requests global.

@notatallshaw notatallshaw added type: support User Support and removed type: bug A confirmed bug or unintended behavior S: needs triage Issues/PRs that need to be triaged labels Mar 20, 2025
@imba-tjd
Copy link
Author

imba-tjd commented Mar 21, 2025

Here are the output of pip config debug and pip config set user.index-url xxx and pip config set index-url

C:\Users\xxx>pip config debug
env_var:
env:
global:
  C:\ProgramData\pip\pip.ini, exists: False
site:
  C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\pip.ini, exists: True
    install.user: yes
    uninstall.user: yes
    freeze.user: yes
    list.user: yes
user:
  C:\Users\xxx\pip\pip.ini, exists: False
  C:\Users\xxx\AppData\Roaming\pip\pip.ini, exists: True
    global.index-url: https://mirrors.aliyun.com/pypi/simple/
 
C:\Users\xxx>pip config set user.index-url xxx
Writing to C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\pip.ini
ERROR: Unable to save configuration. Please report this as a bug.
Traceback (most recent call last):
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pip\_internal\configuration.py", line 215, in save
    with open(fname, "w") as f:
         ^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\\pip.ini'
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pip\_internal\commands\configuration.py", line 265, in _save_configuration
    self.configuration.save()
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pip\_internal\configuration.py", line 218, in save
    raise ConfigurationError(
pip._internal.exceptions.ConfigurationError: An error occurred while writing to the configuration file C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\pip.ini: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\\pip.ini'
ERROR: Internal Error.
 
C:\Users\xxx>pip config set index-url xxx
ERROR: Key does not contain dot separated section and key. Perhaps you wanted to use 'global.index-url' instead?

PS. I manually created %Appdata%\pip\pip.ini and wrote the content after posting this issue so the output shows my config.

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

No branches or pull requests

2 participants