Python Forum
Which package installation methods to use inside a python virtual environment?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Which package installation methods to use inside a python virtual environment?
#2
You only use sudo or elevated permissions when you want to install stuff for the global, system-wide Python installation.
A bonus is that virtualenv does not need elevated permissions.

It's best to always try to avoid sudo pip install,also for pip usage on OS without virtualenv.
Instead, consider using pip install --user,or pyenv as i use.
With pyenv OS installation so is Python always in user mode and never need for sudo pip install.
edwinksl Wrote:When you run pip with sudo, you run setup.py with sudo.
In other words, you run arbitrary Python code from the Internet as root.
If someone puts up a malicious project on PyPI and you install it, you give an attacker root access to your machine.
Prior to some recent fixes to pip and PyPI, n attacker could also run a man in the middle attack to inject their code when you download a trustworthy project.
Reply


Messages In This Thread
RE: Which package installation methods to use inside a python virtual environment? - by snippsat - Dec-26-2018, 01:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with creating folder and "virtual environment" AudunNilsen 1 273 Mar-21-2024, 04:41 AM
Last Post: deanhystad
  Best practice on using virtual environments in Python bytecrunch 6 963 Feb-14-2024, 03:22 PM
Last Post: snippsat
  How to run utilities from a Python package? LugosisGhost 1 477 Dec-27-2023, 12:00 PM
Last Post: Larz60+
  Virtual Env changing mysql connection string in python Fredesetes 0 410 Dec-20-2023, 04:06 PM
Last Post: Fredesetes
  Python installation for old MacOS Yonix 1 528 Sep-21-2023, 03:32 PM
Last Post: menator01
  Installing python packages in a virtual environment Led_Zeppelin 1 810 Aug-15-2023, 08:18 PM
Last Post: deanhystad
  Installation of packages to newest Python version from previous one Andrzej_Andrzej 3 920 Jul-15-2023, 11:32 AM
Last Post: snippsat
  Understanding venv; How do I ensure my python script uses the environment every time? Calab 1 2,362 May-10-2023, 02:13 PM
Last Post: Calab
  Python development environment standenman 3 1,709 May-04-2023, 07:24 PM
Last Post: snippsat
  How to see the date of installation of python modules. newbieAuggie2019 4 1,707 Mar-31-2023, 12:40 PM
Last Post: newbieAuggie2019

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020