brent timothy saner via plug on 20 May 2020 10:23:09 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Fixing a Python library mismatch


On 5/18/20 18:52, Fred Stluka via plug wrote:
> On 5/16/20 4:14 PM, Walt Mankowski via plug wrote:
>> I think both venv and pyvenv are more than I need most of the
>> time.
> Walt,
> 
> Keep in mind that Python virtual environments are astonishingly
> lightweight.  Much, much, much simpler than you might expect.
> I dodged them for a little while, as one more complication that
> I didn;t yet need.  Not true.  Really simple and really useful.  I
> now use them for EVERY python project, no matter how small.
> 

Worth noting that venvs don't provide a secure segregation. It's still
running as the same user as using system libs would, and if you're
accepting input validation or running arbitrary python or an untrusted
library, which WOULD be insane in the first place, but it's fairly easy to:

1.) detect if you're in a venv in the first place by examining
environment variables

2.) easily switch out of the venv by just modifying the PYTHONPATH
variable (or even directly importing other libraries with importlib)

Being that Walt was using numpy, he probably would benefit from a system
install of it as it's a hefty module as far as python modules go. The
wheel file is 20MB for linux x86_64.

Attachment: signature.asc
Description: OpenPGP digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug