Hacker News new | ask | show | jobs
by TheChaplain 2407 days ago
I never had any issue myself, but I guess that is because I use the standard tools:

python3 -m venv /tmp/foo

/tmp/foo/bin/pip -U pip wheel

/tmp/foo/bin/pip -r requirements.txt

I understand some might not like it, but really, it's simple and it works.

2 comments

Note how you only use one version of Python above, which is not the case discussed.
Until now I just deal with that by always explicitly specifying the whole path to the python executable. Granted my needs are very run-of-the-mill, but wouldn't that suffice for many people? I've tried several times over the last few months to get into all this python environment/package stuff, but it all feels like yak shaving... much like the hours and hours I spend customizing vim years ago, which were fun (at that time) but which weren't 'productive' in that they'll never in my lifetime pay themselves off.
>Granted my needs are very run-of-the-mill, but wouldn't that suffice for many people?

For individual people perhaps. For companies with older projects, newer projects, greenfield stuff, etc, no.

I maintain a mix of old and new python projects (sadly, still working on migrating some older 2.7 stuff to 3) and my setup is the same as TheChaplain. I just keep a separate venv for each project and have it setup appropriately in VSCode. With VSCode, I don't even have to think about which venv I am working with outside of when I initially set the interpreter.
Until you have to deploy on a machine without internet access, and suddenly pip -r requirements is not enough, especially if you don't have a local pip mirror.
I develop a project that gets deployed to some users with locked down boxes (tight permissions, no internet), and it's really not that bad. You just download the dependencies using `pip download package_name` and bundle them with your project. Your install is basically the same; `pip install -r requirements.txt --no-index --find-links /path/localdeps/`.

It's not as nice as just doing a regular pip -r, but it works and isn't that much effort.