astral-sh / rye

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

Homebrew installs Rye without a `~/.rye/env` script #749

Open DanielKehoe opened 4 months ago

DanielKehoe commented 4 months ago

Steps to Reproduce

Without a previous installation of Rye, install Rye using Homebrew: brew install rye. Set a .zshrc or .zprofile file to configure shims for the $PATH: source "$HOME/.rye/env". Reset the terminal with source or close/open the terminal. Create a project folder: mkdir myproject then cd myproject. Specify a Python version for your project: rye pin 3. Fetch the toolchain (install the Python version): rye fetch. Verify Python installation: python --version.

Expected Result

Python 3.12.2

Actual Result

zsh: command not found: python

Version Info

$ rye --version
rye 0.25.0
commit: 0.25.0 (2024-02-19)
platform: macos (aarch64)
self-python: cpython@3.12
symlink support: true
uv enabled: false

Stacktrace

(not a crash, just unexpected behavior)

I don't know if you intend to support installation of Rye using Homebrew. Personally, I prefer to install tools and utilities with Homebrew as they are all in the same place and easy to manage (list, update, remove). I was happy to see Rye could be installed using Homebrew. However, I believe the Rye self-installation script creates a ~/.rye/env script that sets shims in the $PATH. I don't believe installation of Rye using Homebrew creates a ~/.rye/env script. Is my conjecture correct?

If you intend to support installation of Rye using Homebrew, perhaps you can create the ~/.rye/env script using Homebrew? Or add a Homebrew "Caveat" that provides post-installation instructions to add the ~/.rye/env script manually?

If you do not intend to support installation of Rye using Homebrew, perhaps you can remove the Rye package from Homebrew? So others will not encounter this problem.

In any case, as a Python beginner, I was happy to discover Rye after experiencing frustration with pip and error: externally-managed-environment and discovering I needed to learn to use multiple tools (pyenv, pip, venv, or various alternatives) to set up a Python project. Thank you for the efforts.

mitsuhiko commented 4 months ago

There is no official homebrew installation method today. I am not sure where to best place issues for it. Maybe this is something to address after the move to astral.

DanielKehoe commented 4 months ago

Is there a way to download and install the contents of the .rye directory without using the self-installer?

mitsuhiko commented 4 months ago

If you invoke rye with rye self install it bootstraps.