pipx icon indicating copy to clipboard operation
pipx copied to clipboard

pipx ensurepath failure

Open scrooop opened this issue 1 year ago • 2 comments

Describe the bug

I am somewhat uneducated w.r.t. programming, learning everything from CharGPT, so please forgive me if this is a dumb question. This isn't a big deal, I can modify the PATH manually, but I thought I'd bring this to your attention in case it's a problem on pipx's end and not something specific to my system.

When I installed my first package with pipx, I get the message:

Note: '/Users//.local/bin' is not on your PATH environment variable. These apps will not be globally accessible until your PATH is updated. Run pipx ensurepath to automatically add it, or manually modify your PATH in your shell's config file (i.e. ~/.bashrc).

Then when I run pipx ensurepath I get:

'utf-8' codec can't decode byte 0x9c in position 64: invalid start byte

How to reproduce

brew install pipx
==> Downloading https://formulae.brew.sh/api/formula.jws.json
###################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
###################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pipx/manifests/1.4.3-1
###################################################################### 100.0%
==> Fetching pipx
==> Downloading https://ghcr.io/v2/homebrew/core/pipx/blobs/sha256:9b8ee8858e
###################################################################### 100.0%
==> Pouring pipx--1.4.3.arm64_sonoma.bottle.1.tar.gz
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Summary
🍺  /opt/homebrew/Cellar/pipx/1.4.3: 157 files, 1005.9KB
==> Running `brew cleanup pipx`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
pipx install poetry
  installed package poetry 1.7.1, installed using Python 3.12.2
  These apps are now globally available
    - poetry
⚠️  Note: '/Users/<me>/.local/bin' is not on your PATH environment variable.
    These apps will not be globally accessible until your PATH is updated.
    Run `pipx ensurepath` to automatically add it, or manually modify your
    PATH in your shell's config file (i.e. ~/.bashrc).
done! ✨ 🌟 ✨
pipx --verbose ensurepath
'utf-8' codec can't decode byte 0x9c in position 64: invalid start byte

I tried:

brew upgrade pipx
==> Downloading https://formulae.brew.sh/api/formula.jws.json
###################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/formula.jws.json
###################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/formula.jws.json
###################################################################### 100.0%
Error: Cannot download non-corrupt https://formulae.brew.sh/api/formula.jws.json!

but it didn't solve the issue (also I'm not sure what the final error is or if it's related to the ensurepath issue. To try to investigate solve that error, I did:

brew update
==> Updated Homebrew from a54150168 to 1d614fc02.
No changes to formulae or casks.

brew upgrade pipx
Warning: pipx 1.4.3 already installed

brew doctor
Your system is ready to brew.

Expected behavior

Should have added /.local/bin to PATH.

scrooop avatar Feb 23 '24 21:02 scrooop

Hello @pure-blue, thanks for raising this.

Your brew upgrade issue might be fixable with some of the solutions mentioned here.

Could you try installing pipx via pip install --user pipx and repeat the steps you've described, so we can figure out if it's directly pipx related or maybe has something to do with brew?

If that also fails I can only assume it has something to do with your existing PATH, so if you could send that as well, that would be a huge help (echo $PATH).

Gitznik avatar Feb 23 '24 22:02 Gitznik

just met the same issue, I think @pure-blue might modified the PATH env in login shell, like

export PATH=$HOME/bin:$PATH

so all brew installed python path won't locate correctly.

after reinstall homebrew and comment out export PATH, everything works fine.

whchi avatar Jun 21 '24 16:06 whchi

Will close this as we don't seem to be getting more information and @whchi has provided a potential fix.

Gitznik avatar Aug 23 '24 09:08 Gitznik