Installation of poetry in default location for macOS not working for framework builds

Open
#110 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
github-actions, macos, python
Domain
cli, devops, tooling

Research direction

Start with the installer’s bin_dir function and reproduce the Python 3.11 macOS behavior of site.getuserbase() returning ~/Library/Python/3.11. Compare the resulting bin path with PATH handling in the installation flow and the GitHub Actions workaround. Done means the default installation is either placed on PATH or the intended PATH setup is clearly defined and tested.

Written by the indexing model from the issue text.

Description

After poetry installation, poetry is not a recognized command.

I am running python 3.11 on macOS. I inspected the installation code and I see the following function:

def bin_dir(version: Optional[str] = None) -> Path:
    if os.getenv("POETRY_HOME"):
        return Path(os.getenv("POETRY_HOME"), "bin").expanduser()

    user_base = site.getuserbase()

    if WINDOWS:
        bin_dir = os.path.join(user_base, "Scripts")
    else:
        bin_dir = os.path.join(user_base, "bin")

    return Path(bin_dir)

It seems like site.getuserbase() resolves to ~/Library/Python/3.11. That is not part of my PATH and therefore I get poetry: command not found.

Since I am configuring poetry with github-actions, I ended up doing the following:

python -c "import os, site; print(os.path.join(site.getuserbase(), 'bin'))" >> $GITHUB_PATH

I was just wondering if site-packages is the best default location for poetry and I presented an example on how sometimes poetry is not installed by default in a location included by PATH. Usually the decision is to install it in /usr/bin or /usr/local/bin.

Dominant language
Python
Stars
255
Forks
65
Avg merge
2h 48m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python-poetry/install.python-poetry.org

All issues in python-poetry/install.python-poetry.org

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.