Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you’re installing a Python package into the global site packages directory (ie, into the system Python) you might need sudo. That’s how permissions work.

I don’t know the -u flag on pip, never used it can’t find it in the docs.

With a virtual environment sudo is not needed. Assuming you created it, and/or it is owned by you.

Virtual environments are just directories on disk. They are not complex.

I don’t use conda because it’s never felt even remotely necessary to me.

pip and a requirements file is all you need.



-u flag is short for --user ( https://stackoverflow.com/questions/42988977/what-is-the-pur... )

how about when you are authoring script under your name, but then want to schedule it for cron to run periodically?

I often find myself working under my user on remote server, but then I want to schedule cron job - and run into all sorts of permissions / bugs and missing packages.

especially when multiple machines need to run this script, and I don't want to involve containers to run 20-lines simple python script.

this is why Golang is so popular - you can just scp a single binary across machines and it will just work.


I’ve started packaging up my clients python scripts as docker images. Works great for cron tasks and updates/rollbacks are a breeze


I also forget a out:

1. pip install (with/out --user flag )

2. pip3 install (with/out --user flag )

3. sudo pip install

4. sudo pip3 install

5. conda install

6. sudo conda install




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: