4 ms·
Really? Pip should be pretty straight forward. Maybe you use different libraries than I do.
by brianwawok 9y ago
Really? Pip should be pretty straight forward. Maybe you use different libraries than I do.
- autokad 9y agopip (py2) on windows is an absolute disaster. pip install numpy .... if you are using windows, using python without this website is nearly impossible: http://www.lfd.uci.edu/~gohlke/pythonlibs/ http://www.lfd.uci.edu/~gohlke/pythonlibs/
- int_19h 9y agoThings are a lot better with Python 3 on Windows, and especially so with Python 3.5+. "pip install numpy" will actually work, among other things. But even for packages that don't have binary wheels and have to compile things, it's much easier now to install a compiler toolchain (it's actually a single download!), and have your Python installation just pick it up automatically.
- pen2l 9y ago> Things are a lot better with Python 3 on Windows, and especially so with Python 3.5+. For one of my main applications py3 proved to be too slow. For my application I use: numpy, pil, tkinter, and subprocess (and process/produce/draw on screen images (at a rate of 120/sec)). I don't know WHY but with python2 it runs acceptably fast, on python3 it's 20% slower. This has been something common for me actually. I do tend to use py3 when doing any kind of data science though.
- wlesieutre 9y agoBut 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 :)
- ufmace 9y agoI do mostly Ruby professionally and dabble in Python, and I agree with heydonovan. Pip works fine for installing things, but near as I can tell, Python has no equivalent of bundler - a tool to install specific versions of a bunch of libraries, generate a lockfile ensuring that your production server and all of the devs are all running it with the same version of everything, and letting you have as many versions of a gem installed as you want, and still running a project with specific versions other than the latest.
- cshenton 9y agoThat's not true. A requirements file is the canonical way to do this. Just use a requirements file and pip install -r requirements.txt. Then version control that file and other Devs do the same. Just like a gemfile.
- brianwawok 9y agopip install -r requirements.txt Pretty simple, no? Most any python project I have seen in the last 5-6 years uses it.
- yen223 9y agorequirements.txt don't track transitive dependencies. Your project could break if a dependency decided to swap out its own dependencies. This isn't theoretical either - it happened to us in production. We are using `pip-tools` to manage that: https://github.com/jazzband/pip-tools https://github.com/jazzband/pip-tools
- Spiritus 9y agoWhat do you mean? `pip freeze > requirements.txt.lock` will freeze all your current deps, including transitive.
- yen223 9y agoThis is only practical if you only have one set of requirements. If you have multiple sets of requirements (for dev vs testing vs production, eg), this becomes impractical real quick. You'll essentially have to tear down and rebuild your dependencies multiple times to update your reqs.