Mitchell van Zuylen
Mitchell van Zuylen

Reputation: 4125

Can I use pip install to install a module for another users?

I'm wish to install Numpy for the www-data user, but I can not log into this user using login. How can I make www-data make us of the Numpy module?

To clarify. Numpy is available for root, and for my default user.

Upvotes: 6

Views: 10661

Answers (3)

Viktor Nagy
Viktor Nagy

Reputation: 29

Another option would be to switch to that user and run it with

pip install --user package

There is that one issue (you probably ran into) that you cant switch to some users because some users have nologin shell. But you can always switch to that user passing shell you want like this:

sudo su -s /usr/bin www-data

Upvotes: 0

H. Gourlé
H. Gourlé

Reputation: 894

Running pip with sudo should install a package for all users

sudo pip install numpy

If it doesn't work, try

sudo -H -u www-data pip install --user numpy

which should install numpy only for www-data

Upvotes: 5

Dadep
Dadep

Reputation: 2788

you will find your answer here :

pip install --user numpy

Upvotes: 0

Related Questions