3 ms·
I would generally not see the need, except I spent an hour helping a friend set up a Python dev environment, and it was terrible. The problem wasn't that the en
by StavrosK 6y ago
I would generally not see the need, except I spent an hour helping a friend set up a Python dev environment, and it was terrible. The problem wasn't that the env itself was hard to set up, the problem was that it was very hard to figure out which Python it would use, where the packages would go, how to prevent the other four Python versions installed from interfering with it, etc.
This looks pretty great, so I'm probably going to give it a shot. Then again, a script would use a specific/known Python version and create a virtualenv with would also work.
EDIT: Maybe I should write a script that downloads all the necessary files somewhere and creates a virtualenv with a given Python version, a la `curl https://www.whatever.com/setupvenv.py https://www.whatever.com/setupvenv.py | bash`.
- spoondan 6y agoFor the specific problem of easily setting up Python environments, you may wish to look into pipenv: https://pipenv.pypa.io/en/latest/ https://pipenv.pypa.io/en/latest/
- sdepablos 6y agoAgree 100%
- laingc 6y agoI would generally recommend poetry over pipenv.
- StavrosK 6y agoPipenv is a bit deprecated, Poetry is the current recommendation (and what I use).
- ies7 6y agoPipenv and poetry seems ok, but before those two (and wheel) we use conda and it covers our need. And this is my top concern when introducing python to new team. There still no 'single' way to do this.
- StavrosK 6y agoThe problem with conda is that it's what broke the machine I was talking about. Apparently it doesn't very much like when you use a package manager other than conda, and things break in subtle ways.
- orbifold 6y agopipenv felt like it took forever to complete simple tasks. I briefly used it for a small project and quickly realized that it was a mistake. I now just use conda environment.yml and a requirements.txt, those two cover most bases I feel like.
- jedieaston 6y agopyenv[0] is designed to automate what you had to do. You install it + the libs for your distro[1], type pyenv global $VERSION into your terminal, and don't think about it anymore. venvs are made from the current version, and work exactly as intended. [0]: https://github.com/pyenv/pyenv https://github.com/pyenv/pyenv [1]: https://github.com/pyenv/pyenv/wiki/Common-build-problems https://github.com/pyenv/pyenv/wiki/Common-build-problems
- StavrosK 6y agoI'll try that, thanks. An additional complication was that virtualenv (the script) was bokred on that computer, but maybe pyenv would have helped.
- dathinab 6y agoHonestly I don't understand the python community anymore wrt. their module system. It looked fine when I learned programming with python but the more I learned about it and what is possible the more I got irritated. Pythons module system is in the end in my opinion fundamentally broken, and the python virtual env's are also in the end just a hack to somehow make it work. I think it's kinda sad that the hack to somehow make it work became the standard solution.