4 ms·
But be sure to use Pip into this year's flavor of virtual environments rather than globally, since you might have multiple projects that need different versions
by wlesieutre 9y ago
But be sure to use Pip into this year's flavor of virtual environments rather than globally, since you might have multiple projects that need different versions of the same package. And be sure to run the right version, I've seen situations where a computer had python 2 and 3 installed, somehow python3 became the default when running "python" but if you ran "pip" you'd get dumped into the old version.
And if your editor has a "Run script" function, it also needs to deal with "Activate the correct environment" for whichever flavor of virtual environment you've used.
Any what beginner would be confused by tutorials using all sorts of different setups (virtualenv, venv, pyenv, pipenv, virtualenvwrapper, pyenv-virtualenvwrapper)? Most of them, I think.
"venv" is the newest one - shipped in the python3 package except when it's not (Ubuntu, maybe others) and doesn't make copies of the python binaries for each environment. That always seemed wasteful to me, but I suppose it was the easy way around path problems with the ecosystem not having a solution built in.
I love python when I'm only using the standard libraries, but if I have dependencies it's messier to set up than I want it to be.
- brianwawok 9y agoThose all seem like pretty basic developer best practices to me. Of course each project needs it's own virtualenv. In fact, each project should have it's own docker image. Why install an application library to the entire system? That is not a good idea in ANY language. And of course scripts need to use the right virtualenv. Or better yet - why not put each app in it's own docker? That bundles up everything into a single "file" you can run on command. All of these things you are listing as downsides seem like things that one normally moves away from, when they put a codebase in git and stop deploying to prod by copying a few files to a shared network drive and restarting the server?????
- jetpks 9y ago> Those all seem like pretty basic developer best practices to me. Those are all bleeding edge developer best practices that didn't exist five years ago. Folks coming from matlab (an example I read above,) probably aren't in the industry and many likely don't even know docker exists OR why they would want to use it.
- brianwawok 9y agorequirements.txt is NOT bleeding edge. And the GP was saying that the ruby package manager is more magical then the python package manager... when pip solved all of the complaints mentioned. Odd.
- Twirrim 9y agoHonestly, virtualenv works. Every single time. I use virtualenvwrapper because I find it and the aliases it provides useful. I'll stop using virutalenv when it actually becomes a hindrance. I know venv exists, but I have precisely zero incentive to use it when virtualenv works and allows me to get on with what I actually want to do.
- insulanian 9y agovirtualenvwrapper, virtualenv, venv... This is kinda discouraging :)
- AzMoo_ 9y agovirtualenv is python2, venv is python3. virtualenvwrapper is as described, a wrapper around them to provide some convenience functions, but they're perfectly functional without it.