Live data from Hacker News

Pyenv – lets you easily switch between multiple versions of Python

github.com

201–210 of 341 posts

Re: Pyenv – lets you easily switch between multiple versions of Python

#201

I really love miniconda for managing python versions and deps myself.

Conda/Miniconda randomly breaks every few months or so when updating and I can't fix it. Idk why I stick with it, its been like this for years.

Odd. I always do `conda activate base && conda update conda` on Mac and never have any issues.

Re: Pyenv – lets you easily switch between multiple versions of Python

#202
post #65

Earlier quoted context omitted.

I am always curious how many people, outside of those building code for third party clients, actually hit this problem? In the 10+ years of using Python I have never had a problem using the core tools. The ecosystem is far from perfect but it has never cause me a problem. Edit: Wow y'all are some sour people for voting down this question. I truly wonder how often people run into this problem compared to just complain…

I just hit it a few days ago. 3rd party script that I did not write. The dev has lost interest in it 3 years ago. It is written for 2.7.x (and it is a nontrivial amount of code). So my choices are some sort of pyenv thing (or one of them), or fix up the script myself so it runs on 3.12. I lucked out and someone else had already done the second thing. One project I worked on was 2.4.x. If they ever have to update that…

download python 2.7 and run it? no pyenv needed

Re: Pyenv – lets you easily switch between multiple versions of Python

#203
post #65

Tools you can use to make sure the Python program you wrote keeps working: requirements.txt, pip, pipenv, pyenv, virtualenv, pyenv-virtualenv, virtualenvwrapper, pyenv-virtualenvwrapper, venv, pyvenv, conda, miniconda, poetry, docker, nix. Which ones did I miss? Which of them actually ensure your program always works the same as when you first wrote it, without asterisks?

I am always curious how many people, outside of those building code for third party clients, actually hit this problem? In the 10+ years of using Python I have never had a problem using the core tools. The ecosystem is far from perfect but it has never cause me a problem. Edit: Wow y'all are some sour people for voting down this question. I truly wonder how often people run into this problem compared to just complain…

Just a requirements.txt that you can install with pip in a venv works 95% of the time. Unless you need a specific python version, which you only figure out halfway through by reading the documentation. Or you are using pytorch, because on windows and linux the version on pypi lacks GPU support, but there's no good way to encode the download url in your dependencies. Or when people don't properly maintain the requirements.txt, because you are supposed to somehow manually keep it in sync.

I run into some kind of packaging or dependency problem for basically every non-trivial project. Hence the many "solutions", but somehow most end up worse than the problems they attempt to solve

Re: Pyenv – lets you easily switch between multiple versions of Python

#204

Earlier quoted context omitted.

So, what is "the tool for beginners fighting with python packaging problems"? That is, the pattern seems to be that someone mentions a solution, then a zillion responses as to why it sucks. Is there any tool or pair that sucks least for most cases and beginners? I get that every case is different, but perhaps there are some useful starting points?

You could just give up and resort to using Docker.

this is the way.

Re: Pyenv – lets you easily switch between multiple versions of Python

#205
post #36

Earlier quoted context omitted.

Also a bit confused as to why this is currently the #1 post.

Because it's not a solved problem, pyenv is niche and people discover it once again and think that they finally solved their pain. They will try it, and most of them will pay the price for it. It's a cycle.

Cue ominous Reaper sounds

Re: Pyenv – lets you easily switch between multiple versions of Python

#206

Earlier quoted context omitted.

Because it's not a solved problem, pyenv is niche and people discover it once again and think that they finally solved their pain. They will try it, and most of them will pay the price for it. It's a cycle.

Cue ominous Reaper sounds

username checks out

Re: Pyenv – lets you easily switch between multiple versions of Python

#207
post #21

I used to use this a lot when working on a Windows machine. Worked pretty well. But nowadays Nix solves the same problem in a fully general way, for all software rather than a single language. You can have whatever versions of whatever you want, side by side, without interfering with each other.

What is your solution here? Are you using a project-specific flake? Do you still install packages with pip?

Re: Pyenv – lets you easily switch between multiple versions of Python

#209

Earlier quoted context omitted.

As. Homebrew maintainer: confirmed. You can also adjust your settings to pin versions or avoid cleanup, too. ‘brew pyenv-sync’ may be useful around this area, too.

If I pin a version of Python, isn't that going to wreck any tooling that depends on it? Unless you're saying have multiple versions of Python installed. This is practically the only remaining annoyance I have with the Python ecosystem (relative imports aside). I use some tools, like Glances [0] whose formula relies on a much newer version (3.12) than the actual package requires (3.8) [1]. So when there's a Python upd…

Pinning won’t break things but it may block upgrades (where they would break something or unpin).

Re: Pyenv – lets you easily switch between multiple versions of Python

#210

I have to warn again users that think they have found the silver bullet that pyenv comes with a big caveat: it compiles python on your machine. The number of possible modes of failure in this situation is huge. See also: "Why not tell people to "simply" use pyenv, poetry or anaconda" https://www.bitecode.dev/p/why-not-tell-people-to-simply-use I'm not saying pyenv is not a useful tool, but it is not a tool for beginn…

Python is quite self contained, it's not a chore to build it.
Post reply on HN