astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.6k stars 466 forks source link

`env` gets stuck resolving `python3` or `python` when rye does not manage the default python #1077

Closed danieledapo closed 4 months ago

danieledapo commented 4 months ago

Steps to Reproduce

Install rye with curl -sSf https://rye-up.com/get | bash and when asked

"What should running python or python3 do when you are not inside a Rye managed project?"

select

"Run the old default Python (provided by your OS, pyenv, etc.)"

Run env python3 or env python, both get stuck. If I let rye manage the default python it works fine.

I tried env --debug python which just outputs the following before getting stuck

executing: python
   arg[0]= ‘python’

This means that basically all of the scripts that have a shebang like #! /usr/bin/env python are broken which is quite annoying and a deal breaker for me.

Expected Result

The command does not get stuck and the python repl opens.

Actual Result

image

Version Info

rye 0.33.0 commit: 0.33.0 (58523f69f 2024-04-24) platform: linux (x86_64) self-python: cpython@3.12.3 symlink support: true uv enabled: true

Stacktrace

No response

bluss commented 4 months ago

Would be useful to know linux distribution and contents of $PATH when this happens to try to debug this. Any other python tools active (pyenv shell integration and similar?)

danieledapo commented 4 months ago

Ah! It looks like the problem was pyenv version 2.3.1, I upgraded to the latest 2.4.1 and everything works fine now.

Fwiw, I'm on Ubuntu 22.04, fish 3.3.1 and the setup of pyenv is just pyenv init - | source in config.fish as per the pyenv doc.

I'm closing the issue because upgrading to the latest pyenv fixes and there's nothinig wrong in rye! Feel free to re-open it if you still want to look into.