Repository: pypa/pip

Issue:
Unexpected --user behavior since version 23.1
### Description

Hey everyone,
I'm using pip typically in virtual environments (managed by PyCharm). Since version 23.1 I get an error message when installing packages.

```
(venv) C:\Users\florian.wiese\PycharmProjects\GUIManager>pip --version
pip 23.1 from c:\users\florian.wiese\pycharmprojects\guimanager\venv\lib\site-packages\pip (python 3.9)

(venv) C:\Users\florian.wiese\PycharmProjects\GUIManager>pip install numpy
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
```

A little research told me, that a --user flag within a venv does not really make sense. However, it seems that some kind of default --user is set since 23.1.

A workaround I found is to add the --no-user flag.   

```
(venv) C:\Users\florian.wiese\PycharmProjects\GUIManager>pip install numpy --no-user
Collecting numpy
   Using cached numpy-1.24.2-cp39-cp39-win_amd64.whl (14.9 MB)
Installing collected packages: numpy
Successfully installed numpy-1.24.2
```  

For completeness, downgrading to 23.0.1 with the --no-user flag gives the me the behavior I'm used to.
 
```
(venv) C:\Users\florian.wiese\PycharmProjects\GUIManager>pip --version
pip 23.1 from c:\users\florian.wiese\pycharmprojects\guimanager\venv\lib\site-packages\pip (python 3.9)

(venv) C:\Users\florian.wiese\PycharmProjects\GUIManager>python.exe -m pip install --upgrade pip==23.0.1 --no-user
Collecting pip==23.0.1
  Using cached pip-23.0.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 23.1
    Uninstalling pip-23.1:
      Successfully uninstalled pip-23.1
Successfully installed pip-23.0.1

(venv) C:\Users\florian.wiese\PycharmProjects\GUIManager>pip install numpy
Collecting numpy
  Using cached numpy-1.24.2-cp39-cp39-win_amd64.whl (14.9 MB)
Installing collected packages: numpy
Successfully installed numpy-1.24.2

[notice] A new release of pip is available: 23.0.1 -> 23.1
[notice] To update, run: python.exe -m pip install --upgrade pip
```
  
Not sure if this is a bug or a feature. Maybe I'm also missing something very obvious. But at least it is documented now for anyone experiencing the same issue :)

### Expected behavior

_No response_

### pip version

23.1

### Python version

3.9

### OS

Windows 10

### How to Reproduce

create a venv with pip 23.1
try to install a package with `pip install <any-package-name>`

### Output

`ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.`

### Code of Conduct

- [X] I agree to follow the [PSF Code of Conduct](https://www.python.org/psf/conduct/).

Discussion:

Patch:
diff --git a/docs/html/topics/configuration.md b/docs/html/topics/configuration.md
index 521bc9af4..e4aafcd2b 100644
--- a/docs/html/topics/configuration.md
+++ b/docs/html/topics/configuration.md
@@ -19,14 +19,13 @@ and how they are related to pip's various command line options.
 
 ## Configuration Files
 
-Configuration files can change the default values for command line options.
-They are written using standard INI style configuration files.
+Configuration files can change the default values for command line option.
+They are written using a standard INI style configuration files.
 
-pip has 4 "levels" of configuration files:
+pip has 3 "levels" of configuration files:
 
-- `global`: system-wide configuration file, shared across all users.
-- `user`: per-user configuration file, shared across all environments.
-- `base` : per-base environment configuration file, shared across all virtualenvs with the same base. (available since pip 23.0)
+- `global`: system-wide configuration file, shared across users.
+- `user`: per-user configuration file.
 - `site`: per-environment configuration file; i.e. per-virtualenv.
 
 ### Location
@@ -48,9 +47,6 @@ User
 
   The legacy "per-user" configuration file is also loaded, if it exists: {file}`$HOME/.pip/pip.conf`.
 
-Base
-: {file}`\{sys.base_prefix\}/pip.conf`
-
 Site
 : {file}`$VIRTUAL_ENV/pip.conf`
 ```
@@ -67,9 +63,6 @@ User
 
   The legacy "per-user" configuration file is also loaded, if it exists: {file}`$HOME/.pip/pip.conf`.
 
-Base
-: {file}`\{sys.base_prefix\}/pip.conf`
-
 Site
 : {file}`$VIRTUAL_ENV/pip.conf`
 ```
@@ -88,9 +81,6 @@ User
 
   The legacy "per-user" configuration file is also loaded, if it exists: {file}`%HOME%\\pip\\pip.ini`
 
-Base
-: {file}`\{sys.base_prefix\}\\pip.ini`
-
 Site
 : {file}`%VIRTUAL_ENV%\\pip.ini`
 ```
@@ -112,7 +102,6 @@ order:
 - `PIP_CONFIG_FILE`, if given.
 - Global
 - User
-- Base
 - Site
 
 Each file read overrides any values read from previous files, so if the
diff --git a/news/11987.bugfix.rst b/news/11987.bugfix.rst
new file mode 100644
index 000000000..de03de640
--- /dev/null
+++ b/news/11987.bugfix.rst
@@ -0,0 +1,1 @@
+Revert `#11487 <https://github.com/pypa/pip/pull/11487>`_, as it causes issues with virtualenvs created by the Windows Store distribution of Python.
diff --git a/src/pip/_internal/configuration.py b/src/pip/_internal/configuration.py
index 6cce8bcbc..8fd46c9b8 100644
--- a/src/pip/_internal/configuration.py
+++ b/src/pip/_internal/configuration.py
@@ -36,20 +36,12 @@ ENV_NAMES_IGNORED = "version", "help"
 kinds = enum(
     USER="user",  # User Specific
     GLOBAL="global",  # System Wide
-    BASE="base",  # Base environment specific (e.g. for all venvs with the same base)
-    SITE="site",  # Environment Specific (e.g. per venv)
+    SITE="site",  # [Virtual] Environment Specific
     ENV="env",  # from PIP_CONFIG_FILE
     ENV_VAR="env-var",  # from Environment Variables
 )
-OVERRIDE_ORDER = (
-    kinds.GLOBAL,
-    kinds.USER,
-    kinds.BASE,
-    kinds.SITE,
-    kinds.ENV,
-    kinds.ENV_VAR,
-)
-VALID_LOAD_ONLY = kinds.USER, kinds.GLOBAL, kinds.BASE, kinds.SITE
+OVERRIDE_ORDER = kinds.GLOBAL, kinds.USER, kinds.SITE, kinds.ENV, kinds.ENV_VAR
+VALID_LOAD_ONLY = kinds.USER, kinds.GLOBAL, kinds.SITE
 
 logger = getLogger(__name__)
 
@@ -78,7 +70,6 @@ def get_configuration_files() -> Dict[Kind, List[str]]:
         os.path.join(path, CONFIG_BASENAME) for path in appdirs.site_config_dirs("pip")
     ]
 
-    base_config_file = os.path.join(sys.base_prefix, CONFIG_BASENAME)
     site_config_file = os.path.join(sys.prefix, CONFIG_BASENAME)
     legacy_config_file = os.path.join(
         os.path.expanduser("~"),
@@ -87,7 +78,6 @@ def get_configuration_files() -> Dict[Kind, List[str]]:
     )
     new_config_file = os.path.join(appdirs.user_config_dir("pip"), CONFIG_BASENAME)
     return {
-        kinds.BASE: [base_config_file],
         kinds.GLOBAL: global_config_files,
         kinds.SITE: [site_config_file],
         kinds.USER: [legacy_config_file, new_config_file],
@@ -354,8 +344,6 @@ class Configuration:
             # The legacy config file is overridden by the new config file
             yield kinds.USER, config_files[kinds.USER]
 
-        yield kinds.BASE, config_files[kinds.BASE]
-
         # finally virtualenv configuration first trumping others
         yield kinds.SITE, config_files[kinds.SITE]
 


Test patch:
diff --git a/tests/unit/test_configuration.py b/tests/unit/test_configuration.py
index b0d655d8f..c6b44d45a 100644
--- a/tests/unit/test_configuration.py
+++ b/tests/unit/test_configuration.py
@@ -24,17 +24,11 @@ class TestConfigurationLoading(ConfigurationMixin):
         self.configuration.load()
         assert self.configuration.get_value("test.hello") == "2"
 
-    def test_base_loading(self) -> None:
-        self.patch_configuration(kinds.BASE, {"test.hello": "3"})
-
-        self.configuration.load()
-        assert self.configuration.get_value("test.hello") == "3"
-
     def test_site_loading(self) -> None:
-        self.patch_configuration(kinds.SITE, {"test.hello": "4"})
+        self.patch_configuration(kinds.SITE, {"test.hello": "3"})
 
         self.configuration.load()
-        assert self.configuration.get_value("test.hello") == "4"
+        assert self.configuration.get_value("test.hello") == "3"
 
     def test_environment_config_loading(self, monkeypatch: pytest.MonkeyPatch) -> None:
         contents = """
@@ -113,15 +107,6 @@ class TestConfigurationLoading(ConfigurationMixin):
         with pytest.raises(ConfigurationError, match=pat):
             self.configuration.get_value("global.index-url")
 
-    def test_overrides_normalization(self) -> None:
-        # Check that normalized names are used in precedence calculations.
-        # Reminder: USER has higher precedence than GLOBAL.
-        self.patch_configuration(kinds.USER, {"test.hello-world": "1"})
-        self.patch_configuration(kinds.GLOBAL, {"test.hello_world": "0"})
-        self.configuration.load()
-
-        assert self.configuration.get_value("test.hello_world") == "1"
-
 
 class TestConfigurationPrecedence(ConfigurationMixin):
     # Tests for methods to that determine the order of precedence of
@@ -148,13 +133,6 @@ class TestConfigurationPrecedence(ConfigurationMixin):
 
         assert self.configuration.get_value("test.hello") == "0"
 
-    def test_site_overides_base(self) -> None:
-        self.patch_configuration(kinds.BASE, {"test.hello": "2"})
-        self.patch_configuration(kinds.SITE, {"test.hello": "1"})
-        self.configuration.load()
-
-        assert self.configuration.get_value("test.hello") == "1"
-
     def test_site_overides_user(self) -> None:
         self.patch_configuration(kinds.USER, {"test.hello": "2"})
         self.patch_configuration(kinds.SITE, {"test.hello": "1"})
@@ -169,13 +147,6 @@ class TestConfigurationPrecedence(ConfigurationMixin):
 
         assert self.configuration.get_value("test.hello") == "1"
 
-    def test_base_overides_user(self) -> None:
-        self.patch_configuration(kinds.USER, {"test.hello": "2"})
-        self.patch_configuration(kinds.BASE, {"test.hello": "1"})
-        self.configuration.load()
-
-        assert self.configuration.get_value("test.hello") == "1"
-
     def test_user_overides_global(self) -> None:
         self.patch_configuration(kinds.GLOBAL, {"test.hello": "3"})
         self.patch_configuration(kinds.USER, {"test.hello": "2"})
diff --git a/tests/unit/test_options.py b/tests/unit/test_options.py
index 9e3a0a5d6..43d5fdd3d 100644
--- a/tests/unit/test_options.py
+++ b/tests/unit/test_options.py
@@ -587,7 +587,7 @@ class TestOptionsConfigFiles:
         for _, val in cp.iter_config_files():
             files.extend(val)
 
-        assert len(files) == 5
+        assert len(files) == 4
 
     @pytest.mark.parametrize(
         "args, expect",