Closed wwarriner closed 9 months ago
Arguably, this is an issue with your environment - the registry key you mention is used to locate the "Common App Data" standard directory, so if it's missing your Windows installation has an issue. It wouldn't be unreasonable to say that the error could be better though.
However, the issue is in the library pip vendors to locate those common directories, and that's where I have an issue. We no longer use appdirs
for that purpose, we now use the newer platformdirs
- and did so in pip 23.3.1, which you claim is the pip versioon you're using. In the error log, though, the file reported as having the error is C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip_vendor\appdirs.py
. That's not a pip installation (note that the package name is pip_vendor
). So it looks like this is some form of patched or vendored and debundled version of pip that miniconda is using. So you'd need to take this up with miniconda. And the likely solution is initially to get them to use an up to date version of pip, and if that still has the issue when using platformdirs, to report the issue to the platformdirs project (we'll pick up any fix they make as part of our normal vendoring process, I don't know how miniconda will do so).
Description
This error falls too close to the boundary of Anaconda and pip for me to tell where the underlying cause is. I assumed it was a pip error due to it occurring within the pip subprocess. If you want me to post this on the conda issue tracker, please let me know.
When installing a Conda environment from a YML file containing an array of packages to install with pip, I see a FileNotFoundError: [WinError 2] emitted by the pip subprocess.
In pip version 23.3.1, the error occurs on line 486 of
pip/_vendor/appdirs.py
which looks likeI am able to consistently reproduce this on my machine, but I have concerns it may not be readily reproducible on other machines. I was able to resolve/workaround the error by adding a registry entry. Evidently, my install of Windows 10 is missing the REG_SZ entry "Common AppData" from
Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
. Adding this entry with the valueC:\Users\$user\AppData\Local
prevented reproduction of the error, and the environment installed as expected.It may be worth looking at #7495, as it seems to involve the same part of the pip code.
I do not know if Anaconda is required to reproduce this error. I do know that running pip at the command line to install packages individually works as expected, i.e.
pip install $package
.Expected behavior
Environment installation to complete without error.
pip version
23.3.1
Python version
3.11.7
OS
Windows 10 build 19045
How to Reproduce
conda update --all
(has Python 3.11.7 and pip 23.3.1 as of this writing, I can supply the exact base environment if needed)conda env create --file env.yml
containing apip:
array of packages to install with pipI can supply my specific
env.yml
, but nothing I change in the file makes any difference, except removing the pip array.Output
(base) D:\repos\uabrc.github.io>conda env create --file build_env.yml --name mkdocs3 Channels:
Downloading and Extracting Packages:
Preparing transaction: done Verifying transaction: done Executing transaction: done Installing pip dependencies: / Ran pip subprocess with arguments: ['C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\python.exe', '-m', 'pip', 'install', '-U', '-r', 'D:\repos\uabrc.github.io\condaenv.10006g3c.requirements.txt', '--exists-action=b'] Pip subprocess output:
Pip subprocess error: Traceback (most recent call last): File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip__main__.py", line 31, in
sys.exit(_main())
^^^^^^^
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip_internal\cli\main.py", line 55, in main
cmd_name, cmd_args = parse_command(args)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip_internal\cli\main_parser.py", line 58, in parse_command
general_options, args_else = parser.parse_args(args)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\optparse.py", line 1371, in parse_args
values = self.get_default_values()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip_internal\cli\parser.py", line 277, in get_default_values
self.config.load()
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip_internal\configuration.py", line 134, in load
self._load_config_files()
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip_internal\configuration.py", line 256, in _load_config_files
config_files = dict(self.iter_config_files())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip_internal\configuration.py", line 359, in iter_config_files
config_files = get_configuration_files()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip_internal\configuration.py", line 75, in get_configuration_files
for path in appdirs.site_config_dirs('pip')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip_internal\utils\appdirs.py", line 31, in site_config_dirs
dirval = _appdirs.site_config_dir(appname, appauthor=False, multipath=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip_vendor\appdirs.py", line 243, in site_config_dir
path = site_data_dir(appname, appauthor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip_vendor\appdirs.py", line 138, in site_data_dir
path = os.path.normpath(_get_win_folder("CSIDL_COMMON_APPDATA"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wwarr\AppData\Local\miniconda3\envs\mkdocs3\Lib\site-packages\pip_vendor\appdirs.py", line 486, in _get_win_folder_from_registry
dir, type = _winreg.QueryValueEx(key, shell_folder_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
failed
CondaEnvException: Pip failed
Code of Conduct