Pip: Modify location of entry point scripts

I use pyproject.toml and it’s [project.scripts] section to define entry points.

On Debian 11 (stable) the generated scripts are placed in /usr/local/bin when I run pip via sudo or as root user. I don’t know how this location is determined.

The problem is that not in all circumstances (e.g. running via pkexec) the PATH of the root user doesn’t contain /usr/local/bin.

Can this be influenced in some way?

Or is it nearly on all GNU/Linux based systems the same directory?
In that case I can use the full path explicit.

The path is determined by sysconfig (or distutils.sysconfig, on older Python versions) in the Python standard library. Debian has their own custom patches on top of Python to change how pip installs packages.

I asume that Debian set /usr/local/bin as the target so that you do not overwrite any Debian installed programs that are in /usr/bin.

It’s general seems as a bad idea to use pip as root on a unix system.
It is far to easy to damage the system in ways that are hard to fix.

1 Like

There is a solution we’ve agreed on for the sudo pip thing; it’s very much a “long term solution for long term problem” approach though. :slight_smile: