question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

message_about_scripts_not_on_PATH does not expanduser()

See original GitHub issue

Environment

  • pip version: 18.1
  • Python version: 3.7
  • OS: Fedora 29

from python3-pip-18.1-1.fc29.noarch

Description I was trying to install PyGitUp with pip3 install --user git-up and ran into an issue where I was warned:

  The script git-up is installed in '/home/jflorian/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. 

I callled BS because I knew this was on my PATH. But then I noticed my PATH actually had ~/.local/bin and not /home/jflorian/.local/bin as claimed. I looked at wheel.py where the error originates and sure enough, there was no usage of os.path.expanduser(). I changed my PATH to have this already expanded and the error message disappeared.

Expected behavior Most tools seem to know how to expand the tilde in my PATH, I would expect Pip to do so as well.

How to Reproduce

  1. export PATH with a local bin directory using a tilde, e.g., ~/.local/bin
  2. Install any package with scripts using the --user option.
  3. Observe the technically correct warning, but which is misleading w/o serious thought because it must be taken very literally and not as most users are likely to understand.
  4. Repeat with PATH having the tilde already expanded, e.g., /home/jflorian/.local/bin and observe the behavior I’d expect in step 3.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
chrahuntcommented, Aug 11, 2019

What if we warn about this case if we see a path in PATH that starts with ~? For example:

The script git-up is installed in '/home/jflorian/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
NOTE: The current PATH contains path(s) starting with `~`, which may not be expanded by all applications.
2reactions
chrahuntcommented, Nov 16, 2019

Closed in #7345. Thanks @mdebi!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python | os.path.expanduser() method - GeeksforGeeks
expanduser() method in Python is used to expand an initial path component ~( tilde symbol) or ~user in the given path to user's...
Read more >
Issue 39899: `pathlib.Path.expanduser()` does not call `os ...
expanduser() returns the path unchanged when a home directory cannot be resolved, pathlib.Path.expanduser() raises an error. The latter behavior ...
Read more >
Why is os.path.expanduser not returning the home directory?
First, why might os.path.expanduser misbehave on certain systems, but not on others? Second, even if it's in the wrong directory, open() should ......
Read more >
Replace os.getenv('HOME') with os.path.expanduser - 389-ds ...
When HOME env var is not set, the call will fail with an exception. ... The expanduser will do the right thing and...
Read more >
click.Path expanduser · Issue #287 · pallets/click - GitHub
At this point I was not really thinking: is the command run through the shell or not. IMO click stands for usability. That's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found