Pyenv – lets you easily switch between multiple versions of Python
141–150 of 341 posts
Re: Pyenv – lets you easily switch between multiple versions of Python
#142I thought the recommended approach these days was to use the venv package built in to python3 with `python3 -mvenv ...`
It is, but the problem with `venv` is that it can only use the same version of Python that you're using. E.g. if your Python installation is 3.8, your `venv` will also use 3.8. Pyenv allows you to use whatever version of Python you want.
On most Linux distros you probably don't want to change your system python to whatever, because there are a lot of system programs that may not be compatible with a version other than what is on the system by default.
Then once you activate it you can make sure your python
Re: Pyenv – lets you easily switch between multiple versions of Python
#143Several years in ops in a large company where I had to hand-hold couple hundreds of programmers a lot of whom needed to install Python for development on their computers... One of the troubleshooting steps when "something mysterious" happens on developer's computer (eg. package installation fails for inexplicable reasons, Python "standard" library components missing or present when shouldn't be, incorrect component v…
> Multiple versions of CPython can be installed and used together without the use of any extra tools. I.e. the solution to this "problem" is simply to learn how to do that. How do you do that? For example, if you're on Ubuntu LTS but want to use the latest Python version, how do you do that? The system package manager won't have it. Do you rely on a third-party PPA? What about other distros, where you don't have that…
But, you can also download CPython source tarballs and skip the Git part. I haven't used CPython installers in a very long time... but, I'd imagine that the MSI would have a way to specify at least the location where Python is to be installed...
Re: Pyenv – lets you easily switch between multiple versions of Python
#144Earlier quoted context omitted.
> Every solution that I know of on Linux requires you to build Python on the machine Unless you need a Python that's not supported by your Linux distribution, you can just use what's available. On macOS, MacPorts provides compiled versions for 3.2 all the way to 3.13, as well as 2.6 and 2.7. Right now, I have 3.8, 3.9, 3.10, 3.11, 3.12, and a 3.13 development build. The fact it's not Linux (or x86) might cause some f…
If you’re lucky enough to be on a Linux system that uses apt some thankless soul maintains a repo called deadsnakes with all these binaries. Fabulous if you’re using any somewhat old version of Python in CI for instance. Yum based systems are SOL as far as I can tell. Build and host your own binary for that. Apk doesn’t have this either IIRC
Re: Pyenv – lets you easily switch between multiple versions of Python
#145I 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…
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?
I think his point was that you shouldn't pretend to users that just switching to pyenv is the solution.
Re: Pyenv – lets you easily switch between multiple versions of Python
#146Earlier quoted context omitted.
Actually, it only builds it locally if it can't find a pre-packaged version for your system/arch. Admittedly that's most of the recent ones on a Mac, but there is a difference (I've been using pyenv for nearly ten years[1] now). The big advantage for me is that I can match whatever runtime and standard library a target has (and yes, that's needed more times than not, even in this new age of Docker). Additionally, you…
That happens way more often than people want to admit, and I think it's not genuine to present the tool that way. E.G, I'm on Ubuntu 20.04 on an Dell XPS, a fairly standard machine, I'll get: pyenv install 3.9 -v /tmp/python-build.20240325124651.73089 ~ Downloading Python-3.9.19.tar.xz... -> https://www.python.org/ftp/python/3.9.19/Python-3.9.19.tar.xz ... LD_LIBRARY_PATH=/tmp/python-build.20240325124651.73089/Python…
Re: Pyenv – lets you easily switch between multiple versions of Python
#147Re: Pyenv – lets you easily switch between multiple versions of Python
#148Re: Pyenv – lets you easily switch between multiple versions of Python
#149Earlier quoted context omitted.
Yeah, ASDF is fantastic, I'm glad stuff like pyenv and rvm existed and paved the way for it but ASDF is the way to go nowadays.
asdf for python is a wrapper around pyenv, it didn't "pave the way", it's an important part of asdf. (Also I like mise better currently: https://github.com/jdx/mise )
Re: Pyenv – lets you easily switch between multiple versions of Python
#150Python (and Ruby) handling of versions and dependencies is truly awful... :-(