Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can pip install packages for all users (on a Linux system)?

43 views
Skip to first unread message

John Ladasky

unread,
Jul 24, 2018, 2:07:50 PM7/24/18
to
I've been using "sudo pip3 install" to add packages from the PyPI repository. I have multiple user accounts on the computer in question. My goal is to install packages that are accessible to all user accounts. I know that using the Synaptic Package Manager in Ubuntu will install for all users, but not every Python package is included in the Canonical repository.

I hadn't noticed any discrepancies until recently. I upgraded from Ubuntu 17.10 to 18.04. In parallel, I upgraded tensorflow-gpu 1.4.0 to 1.8.0. Everything worked on my main account. However, attempting to import tensorflow from Python on a secondary account failed. Eventually I checked the pip lists in each account, and I found a reference to the old tensorflow 1.4 on the secondary account. Uninstalling that, and reinstalling tensorflow-gpu 1.8 on the secondary account fixed the problem.

I believe that I now have tensorflow 1.8 installed twice on my system, once for each user. If anyone can share how to convince pip to behave like Synaptic, I would appreciate it. Thanks.

Wolfgang Maier

unread,
Jul 24, 2018, 3:37:15 PM7/24/18
to
On 24.07.2018 20:07, John Ladasky wrote:
> I've been using "sudo pip3 install" to add packages from the PyPI repository. I have multiple user accounts on the computer in question. My goal is to install packages that are accessible to all user accounts. I know that using the Synaptic Package Manager in Ubuntu will install for all users, but not every Python package is included in the Canonical repository.
>
> I hadn't noticed any discrepancies until recently. I upgraded from Ubuntu 17.10 to 18.04. In parallel, I upgraded tensorflow-gpu 1.4.0 to 1.8.0. Everything worked on my main account. However, attempting to import tensorflow from Python on a secondary account failed. Eventually I checked the pip lists in each account, and I found a reference to the old tensorflow 1.4 on the secondary account. Uninstalling that, and reinstalling tensorflow-gpu 1.8 on the secondary account fixed the problem.
>

One possible explanation for your finding: user installs normally take
precedence over system-wide installs both at import time and for pip
(list, uninstall, etc.). So if you, or your users, have installed
tensorflow 1.4.0 using pip install --user before, then a system-wide pip
install tensorflow 1.8.0 won't override this previous version (though if
your admin account has the user install, too, pip would warn you).
Otherwise, a pip install without --user is effectively a system-wide
install as long as your Python is a system-wide install.

> I believe that I now have tensorflow 1.8 installed twice on my system, once for each user. If anyone can share how to convince pip to behave like Synaptic, I would appreciate it. Thanks.
>

If a user has a user install of tensorflow, it will always shadow the
system-wide version. The only solution I know (except manipulating
Python's import path list) is to pip uninstall the per-user version.

Best,
Wolfgang

Wolfgang Maier

unread,
Jul 24, 2018, 4:45:27 PM7/24/18
to
On 24.07.2018 20:07, John Ladasky wrote:
> I've been using "sudo pip3 install" to add packages from the PyPI repository. I have multiple user accounts on the computer in question. My goal is to install packages that are accessible to all user accounts. I know that using the Synaptic Package Manager in Ubuntu will install for all users, but not every Python package is included in the Canonical repository.
>
> I hadn't noticed any discrepancies until recently. I upgraded from Ubuntu 17.10 to 18.04. In parallel, I upgraded tensorflow-gpu 1.4.0 to 1.8.0. Everything worked on my main account. However, attempting to import tensorflow from Python on a secondary account failed. Eventually I checked the pip lists in each account, and I found a reference to the old tensorflow 1.4 on the secondary account. Uninstalling that, and reinstalling tensorflow-gpu 1.8 on the secondary account fixed the problem.
>

One possible explanation for your finding: user installs normally take
precedence over system-wide installs both at import time and for pip
(list, uninstall, etc.). So if you, or your users, have installed
tensorflow 1.4.0 using pip install --user before, then a system-wide pip
install tensorflow 1.8.0 won't override this previous version (though if
your admin account has the user install, too, pip would warn you).
Otherwise, a pip install without --user is effectively a system-wide
install as long as your Python is a system-wide install.

> I believe that I now have tensorflow 1.8 installed twice on my system, once for each user. If anyone can share how to convince pip to behave like Synaptic, I would appreciate it. Thanks.
>

Stephan Houben

unread,
Jul 25, 2018, 10:15:35 AM7/25/18
to
Op 2018-07-24, John Ladasky schreef <john_l...@sbcglobal.net>:
> I believe that I now have tensorflow 1.8 installed twice on my system,
> once for each user. If anyone can share how to convince pip to behave
> like Synaptic, I would appreciate it. Thanks.

I would recommend against using pip to install packages into the system
Python. The reason is that you may get into a conflict with the package
manager. You can try to be careful and not install tensorflow using
Synaptic, but once you install some other package which happens to
depend on tensorflow, you will start getting package manager conflicts.

An alternative is to install Python yourself (from source, without the package
manager) in, say, /opt/python. You are then in splendid isolation from
the package manager and can install any version of Python and tensorflow
you desire.

Stephan

John Ladasky

unread,
Jul 26, 2018, 1:45:01 AM7/26/18
to
On Wednesday, July 25, 2018 at 7:15:35 AM UTC-7, Stephan Houben wrote:
> Op 2018-07-24, John Ladasky schreef <j..y@s...t>:
> > I believe that I now have tensorflow 1.8 installed twice on my system,
> > once for each user. If anyone can share how to convince pip to behave
> > like Synaptic, I would appreciate it. Thanks.
>
> I would recommend against using pip to install packages into the system
> Python. The reason is that you may get into a conflict with the package
> manager. You can try to be careful and not install tensorflow using
> Synaptic, but once you install some other package which happens to
> depend on tensorflow, you will start getting package manager conflicts.

That won't be a problem. Tensorflow is not available in the Canonical repository, so it cannot be installed through Synaptic unless someone has made a PPA somewhere. I don't know why Tensorflow is not part of Canonical, since it is free, open-source, and popular.

I don't (yet) have any that depends on tensorflow. Tensorflow's Python API depends on other software, the NVidia drivers and CUDA for example. But that's the opposite issue. And I did install those manually.

> An alternative is to install Python yourself (from source, without the package
> manager) in, say, /opt/python. You are then in splendid isolation from
> the package manager and can install any version of Python and tensorflow
> you desire.

That's an interesting strategy, and I will consider it. Two copies of Python are easier to accept than two copies of tensorflow.

> Stephan

0 new messages