|
|
Subscribe / Log in / New account

Python virtual environments

Python virtual environments

Posted Jun 15, 2018 1:40 UTC (Fri) by rahulsundaram (subscriber, #21946)
In reply to: Python virtual environments by flewellyn
Parent article: Python virtual environments

It can cause conflicts with modules installed via distribution packages. There are ways around that including

https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe


to post comments

Python virtual environments

Posted Jun 15, 2018 3:23 UTC (Fri) by flewellyn (subscriber, #5047) [Link] (1 responses)

Ahh, I see. So the reason it never bit me on the ass is that I always run pip as a regular user, and it installs just to my local, or to my venv, eh?

Makes sense. I suppose there's less issue if you use pip to install inside a container?

Python virtual environments

Posted Jun 15, 2018 10:28 UTC (Fri) by rahulsundaram (subscriber, #21946) [Link]

Yes, installing as yourself or using a container is just fine. Installing system wide is generally not recommended

Python virtual environments

Posted Jun 15, 2018 6:16 UTC (Fri) by ceplm (subscriber, #41334) [Link] (3 responses)

And why not to use packages from the distribution?

Python virtual environments

Posted Jun 15, 2018 7:02 UTC (Fri) by kushal (subscriber, #50806) [Link] (1 responses)

Because in workshops we generally use latest packages from PyPI, which are not available from system. Also, this may install some other verison than the system version, which may break other applications on the system.

Python virtual environments

Posted Jun 20, 2018 2:19 UTC (Wed) by k8to (guest, #15413) [Link]

My view is that if you want to use virtualenvs in workshops (I would suggest giving them a container or vm instead), just have the virtualenv on when they log in. You can provide a flyer on setting up virtualenvs if you think that's necessary information to read when they try to use the skills.

Personally I've found virtualenvs to be so fragile that I will never use them again. I would advise teaching students a path that doesn't fall over so easily

Python virtual environments

Posted Jun 15, 2018 10:32 UTC (Fri) by rahulsundaram (subscriber, #21946) [Link]

> And why not to use packages from the distribution?

Not everything is packaged by distributions and available in the latest version. Pip is unaware of distribution installed version and will overwrite it if a module is a dependency and vice versa.

Python virtual environments

Posted Jun 20, 2018 17:52 UTC (Wed) by cortana (subscriber, #24596) [Link]

I believe that in Debian, `pip install foo` run as root will install to /usr/local/lib/python$ver/dist-packages -- nicely out of the way of packaged modules, which all live under /usr/lib.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds