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
  Start Idle in a virtual environment Pedroski55 4 197 7 hours ago
Last Post: snippsat
  Python automation: Sending clicks/keys to VMware virtual machine from host olips784 0 435 May-18-2025, 06:28 PM
Last Post: olips784
  MPEG DASH Package implementation similar to M3U8 package anantha_narayanan 1 971 May-05-2025, 08:34 AM
Last Post: pintailscratchy
  White Screen Issue with Toolbar After Python Installation evelynfreya 3 1,458 Apr-30-2025, 06:43 AM
Last Post: encore
  Python use of virtual environments bre67e49 4 1,056 Feb-19-2025, 04:01 AM
Last Post: Sece1967
  I cannot create a virtual environment on visual studio code using python Willem_Aucamp316 2 4,659 Nov-27-2024, 02:20 PM
Last Post: menator01
  Install a module to a specific to Python Installation (one of many)) tester_V 2 2,691 Oct-29-2024, 03:25 PM
Last Post: snippsat
  Shrink Python installation? Extract site-packages from .zip only on demand? pstein 4 1,994 Oct-28-2024, 04:29 PM
Last Post: snippsat
  How to enable Matplotlib within virtual environment? tetris_theMovie 1 1,251 Oct-11-2024, 09:56 AM
Last Post: christie2
  Troubleshooting Jupyter Notebook installation with Python using pip and a venv Drone4four 1 2,804 Jun-04-2024, 10:55 PM
Last Post: Drone4four

Forum Jump:

User Panel Messages

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