You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Install pdm by scoop in a Windows device installed with Miniconda.
Run pdm init.
Actual behavior
> pdm init -v
Creating a pyproject.toml for PDM...
Traceback (most recent call last):
File "<frozen runpy>", line 198,in _run_module_as_main
File "<frozen runpy>", line 88,in _run_code
File "C:\Users\Leo\scoop\apps\pdm\current\venv\Scripts\pdm.exe\__main__.py", line 7,in<module>
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\pdm\core.py", line 359,in main
return core.main(args or sys.argv[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\pdm\core.py", line 277,in main
raise cast(Exception, err).with_traceback(traceback) from None
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\pdm\core.py", line 272,in main
self.handle(project, options)
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\pdm\core.py", line 208,in handle
command.handle(project, options)
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\pdm\cli\commands\init.py", line 237,in handle
self.do_init(project, options=options)
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\pdm\cli\commands\init.py", line 40,in do_init
self.set_python(project, options.python, hooks)
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\pdm\cli\commands\init.py", line 214,in set_python
python_info = UseCommand().do_use(
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\pdm\cli\commands\use.py", line 111,in do_use
selected_python = self.select_python(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\pdm\cli\commands\use.py", line 73,in select_python
found_interpreters = list(dict.fromkeys(project.iter_interpreters(python, filter_func=version_matcher)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\pdm\project\core.py", line 652,in iter_interpreters
for interpreter in self.find_interpreters(python_spec, search_venv):
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\pdm\project\core.py", line 722,in find_interpreters
for entry in finder.find_all(finder_arg, allow_prereleases=True):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\findpython\finder.py", line 122,in find_all
matched_python = set(self._find_all_python_versions())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\findpython\finder.py", line 171,in _find_all_python_versions
yield from provider.find_pythons()
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\findpython\providers\winreg.py", line 41,in find_pythons
Version(py_version) if py_version else None,
^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\packaging\version.py", line 200,in __init__
raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: 'py39_4.12.0'
According above error log, I try to locate at file "C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\findpython\providers\winreg.py and print path of invalid Python.
After that, run pdm init again. And the log shows Python in Miniconda (F:\Miniconda\python.exe) is invalid.
> pdm init
Creating a pyproject.toml for PDM...
py39_4.12.0 F:\Miniconda\python.exe
[InvalidVersion]: Invalid version: 'py39_4.12.0'
Python in Miniconda (F:\Miniconda\python.exe) is removed temporarily then pdm init works successfully. Obviously findpython cannot recognize Python version of Miniconda, which causes pdm initilization crash.
> pdm init -v
Creating a pyproject.toml for PDM...
3.7.4 D:\Python37\python.exe3.9.10 D:\Python39\python.exe
Please enter the Python interpreter to use
0. cpython@3.12 (C:\Users\Leo\scoop\apps\python\current\python.EXE)
1. cpython@3.12 (C:\Users\Leo\scoop\shims\python3.exe)
2. cpython@3.9 (D:\Python39\python.exe)
3. cpython@3.7 (D:\Python37\python37.exe)
4. cpython@3.7 (D:\Python37\python.exe)
Expected behavior
It seems Miniconda uses custom Python version format which is not supported. I hope findpython can successfully recognize miniconda Python and conflict of packaging.version.InvalidVersion: Invalid version can be solved.
The text was updated successfully, but these errors were encountered:
Steps to reproduce
scoop
in a Windows device installed with Miniconda.pdm init
.Actual behavior
According above error log, I try to locate at file
"C:\Users\Leo\scoop\apps\pdm\2.14.0\venv\Lib\site-packages\findpython\providers\winreg.py
and print path of invalid Python.After that, run
pdm init
again. And the log shows Python in Miniconda (F:\Miniconda\python.exe
) is invalid.Python in Miniconda (
F:\Miniconda\python.exe
) is removed temporarily thenpdm init
works successfully. Obviouslyfindpython
cannot recognize Python version of Miniconda, which causes pdm initilization crash.Expected behavior
It seems Miniconda uses custom Python version format which is not supported. I hope
findpython
can successfully recognize miniconda Python and conflict ofpackaging.version.InvalidVersion: Invalid version
can be solved.The text was updated successfully, but these errors were encountered: