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
Is your feature request related to a problem? Please describe.
Hello.
Firstly, it is my first time to open an issue to open a source project and my English could be poor.
So excuse me if this issue is not good one and I would be very glad if you suppose a better way to post an issue.
Problem
After I installed pdm on my Mac, pdm init failed and the message was like,
<my_username>@<my_pcname> pdm_sample % pdm init -v
Creating a pyproject.toml for PDM...
Please enter the Python interpreter to use
Traceback (most recent call last):
File "/Users/<my_username>/.local/bin/pdm", line 8, in <module>
sys.exit(main())
^^^^^^
File "/Users/<my_username>/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/core.py", line 259, in main
return Core().main(args)
^^^^^^^^^^^^^^^^^
File "/Users/<my_username>/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/core.py", line 191, in main
raise cast(Exception, err).with_traceback(traceback)
File "/Users/<my_username>/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/core.py", line 186, in main
f(project, options)
File "/Users/<my_username>/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/cli/commands/init.py", line 60, in handle
python = actions.do_use(
^^^^^^^^^^^^^^^
File "/Users/<my_username>/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/cli/actions.py", line 628, in do_use
f"({py_version.identifier})"
^^^^^^^^^^^^^^^^^^^^^
File "/Users/<my_username>/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/python.py", line 78, in identifier
return f"{self.major}.{self.minor}"
^^^^^^^^^^
File "/Users/<my_username>/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/python.py", line 52, in major
return self._py_ver.major
^^^^^^^^^^^^^^^^^^
File "/Users/<my_username>/.local/pipx/venvs/pdm/lib/python3.11/site-packages/findpython/python.py", line 71, in major
return self.version.major
^^^^^^^^^^^^
File "/Users/<my_username>/.local/pipx/venvs/pdm/lib/python3.11/site-packages/findpython/python.py", line 65, in version
self._version = self._get_version()
^^^^^^^^^^^^^^^^^^^
File "/Users/<my_username>/.local/pipx/venvs/pdm/lib/python3.11/site-packages/findpython/python.py", line 164, in _get_version
version = self._run_script(script, timeout=GET_VERSION_TIMEOUT).strip()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/<my_username>/.local/pipx/venvs/pdm/lib/python3.11/site-packages/findpython/python.py", line 180, in _run_script
return subprocess.check_output(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/Users/<my_username>/.pyenv/shims/python3', '-c', 'import platform; print(platform.python_version())']' returned non-zero exit status 1.
It took some time for me to think of how to solve this, and the cause seemed to be around the command done by findpython through subprocess.
And I checked in the following fashion.
<my_username>@<my_pcname> ~ % /Users/<my_username>/.pyenv/shims/python3 -c 'import platform; print(platofrm.python_version())'
/Users/<my_username>/.pyenv/shims/python3: line 8: /usr/local/Cellar/pyenv/1.2.24.1/libexec/pyenv: No such file or directory
My environment and How I Solved
I installed pyenv with homebrew, and It seems that pyenv was updated with homebrew.
And the path of ~/.pyenv/shims/python became outdated.
After I renewed the path with pyenv rehash, pdm init succeeded.
Describe the solution you'd like
The future users might save their time if the message directly suggest to trying pyenv rehash, not just throwing traceback message.
If it is OK, I will implement and make a Pull Request.
Or is it better to post another issue to findpython?
The text was updated successfully, but these errors were encountered:
We landed a resolution to skip the invalid paths(because it is the case for other non-pyenv pythons). No reason to treat pyenv special. If users find it doesn't show in the list, they should check the paths manually.
Is your feature request related to a problem? Please describe.
Hello.
Firstly, it is my first time to open an issue to open a source project and my English could be poor.
So excuse me if this issue is not good one and I would be very glad if you suppose a better way to post an issue.
Problem
After I installed pdm on my Mac,
pdm init
failed and the message was like,It took some time for me to think of how to solve this, and the cause seemed to be around the command done by findpython through subprocess.
And I checked in the following fashion.
My environment and How I Solved
I installed pyenv with homebrew, and It seems that pyenv was updated with homebrew.
And the path of
~/.pyenv/shims/python
became outdated.After I renewed the path with
pyenv rehash
,pdm init
succeeded.Describe the solution you'd like
The future users might save their time if the message directly suggest to trying
pyenv rehash
, not just throwing traceback message.If it is OK, I will implement and make a Pull Request.
Or is it better to post another issue to findpython?
The text was updated successfully, but these errors were encountered: