7

I'm testing Debian 10 in a VM to check if i can use it for my stream servers (headless minimal netinstall).

Why does pip3 install, e.g supervisor, in ~/.local?

I did read the release notes but couldn't find anything about the .local folder. As far as I understand, I will run in to trouble with PATH, and there are a lot of other reasons to install it to /usr/local rather then ~/.local.

How can I avoid this, or is this the way it meant to be in Debian?

4
  • Did you try running pip as root? Does that change the location?
    – Panki
    Jul 17, 2019 at 8:49
  • Yes, and No, it did not change anything.
    – Tom
    Jul 17, 2019 at 9:06
  • 3
    "there are a lot of other reasons to install it to /usr/local" ... and there are a lot more reasons to just use virtual environments instead, when using Python and Pip.
    – muru
    Jul 17, 2019 at 9:15
  • Thank you everybody for your answers and links which leaded me to a working solution. as muru pointed out, the best solution for my purpose is using virtual envs with python/pip. if anyone else has the same problem/situation and knows about as much as i do, here's a link that discribs pretty well how to use it. packaging.python.org/guides/…
    – Tom
    Jul 17, 2019 at 11:17

2 Answers 2

8

The following warning in packaging.python.org may answer you questions

Warning Recent Debian/Ubuntu versions have modified pip to use the “User Scheme” by default, which is a significant behavior change that can be surprising to some users.

2
  • Thx for the link, that made a view things clearer, unfortunately my knowledge about python is close to zero,(i just need pip to install a tool called supervisor, which i need) if i understand correctly i have to run pip with virtual environments as muru mentionend above.
    – Tom
    Jul 17, 2019 at 9:29
  • Yes , muru tip to use virtual environments is the right way when using Python and Pip and NOT to try to find a way to install the package widely.
    – user274160
    Jul 17, 2019 at 9:59
6

In Debian, pip3 defaults to the user scheme when run outside virtual envs, and files are installed under ~/.local.

If you want to install a tool system-wide using pip3 on Debian and derivatives, you can still use

pip3 install --system ...

to use the system scheme.

(It’s worth checking whether the tool in question is available as a Debian package; Debian 10 added many packages...)

As muru points out, virtual envs are a better approach in many cases. The whole topic of Python tool installation generates lots of discussion, even among core Python developers!

2
  • e.g. IPython is available as a Debian package - added before Debian 10
    – wjandrea
    Jul 17, 2019 at 19:52
  • 1
    @wjandrea indeed. My point was really that since the OP is using Debian 10 already, but they haven’t looked at the new packages, it might be worth doing so (especially if they’re resorting to pip3 based on the fact that the module they’re interested in wasn’t available in previous releases of Debian). Jul 17, 2019 at 21:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .