News for hackers. Stuff that matters.
Re:Python 3.11 by warent on Sunday October 03, 2021 @09:53PM (#28742199)
just spent about 4 hrs getting Python 2 and pip setup on my Mac. Any time I have the misfortune of needing to use python I get cold sweats at the thought of the environment stuff.

Why is this still such a massive problem?

Re:Python 3.11 by i_like_apis on Sunday October 03, 2021 @10:09PM (#28742283)
4 hours? Yeesh. Here's how to do it in 5-10 minutes.

Use pyenv to install any python version and pyenv-virtualenv to manage virutal environments.

https://github.com/pyenv/pyenv

https://github.com/pyenv/pyenv-virtualenv

Re:Python 3.11 by nomel on Monday October 04, 2021 @12:03AM (#28742933)
For me, pyenv on Mac is about 15 minute compile time with a bunch of environment variables required to make sure tkinter works properly.
Re:Python 3.11 by uranusjr on Monday October 04, 2021 @02:18AM (#28743628)
The compile time depends largely on dependencies. If you have OpenSSL, zlib, and whatnot pre-installed (either via Homebrew or self-compiled and specified with environment variables), the compile time is close to 5 minutes. If you don’t, by default pyenv (actually python-build) compiles all those from scratch, and can easily spend north of 20 minutes (mostly for OpenSSL).
Re:Python 3.11 by stonecharioteer on Monday October 04, 2021 @02:07PM (#28750226)
Use miniconda. It's much better.
Re:Python 3.11 by nomel on Monday October 04, 2021 @10:44PM (#28754941)
The licensing is not compatible with my companies legal team.
Re:Python 3.11 by heavyset_go on Monday October 04, 2021 @02:19AM (#28743642)

    brew install pyenv
Re:Python 3.11 by rlayton2 on Monday October 04, 2021 @03:06AM (#28743945)
Anaconda is also great for beginners - GUI, lots of normal packages precompiled (also numpy, scipy, pandas, scikit-learn). If you do the full install, it comes with lots of packages pre-loaded.
Re:Python 3.11 by NelsonMinar on Sunday October 03, 2021 @10:03PM (#28742245)
Using Python 2 is a big part of the problem. Modern Python 3 is a lot nicer. Also you're much better off if each Python project has its own virtual environment using the venv module.
Re:Python 3.11 by yjftsjthsd-h on Sunday October 03, 2021 @11:26PM (#28742688)
While I also quirked an eyebrow at the exact version, is 3 better at package management & environments?
Re:Python 3.11 by DangitBobby on Sunday October 03, 2021 @11:44PM (#28742840)
Yes, virtual environments are baked into the language. python3 -m venv venv will make an environment named venv. source venv/bin/activate activates it. pip install package in an activated environment installs the package only into the active environment.
Re:Python 3.11 by lacker on Monday October 04, 2021 @01:05AM (#28743291)
It's still a mess, honestly. They tried to standardize on venv but since it doesn't deal well with Python libraries that depend on non-Python components, conda is still better for many purposes.
Re:Python 3.11 by isoprophlex on Monday October 04, 2021 @01:45AM (#28743461)
Can you give a specific example?

I've had nothing but pain with conda in mixed linux/mac/win environment at work, and actively worked to get it deprecated. We're on plain venvs now, with the occasional setup.py

Curious if I missed some useful case for it.

- very slow dependency resolvers

- using conda in docker is annoying

- the worst thing: inconsistencies in downloading binaries and other resources between win/mac/linux when installing packages

- conda insisting on messing with bashrc to run their 'activate' crap

- beware the fool who runs 'sudo conda whatever' on a multiuser system

Re:Python 3.11 by dagw on Monday October 04, 2021 @02:55AM (#28743866)
Curious if I missed some useful case for it.

Conda will package and version things like compilers and C libraries etc in a sane way. I can 'conda install' a package and start using it, but if i 'pip install' the same package I'm still left having to hunt down and install a bunch of additional dependencies. For example 'conda install cython' gives me a fully working and consistent cython on all platforms in a way that 'pip install cython' won't.

There are still several computational science and data science packages where 'pip install X' on windows simply doesn't work (and 'conda install X' does) due to missing dependencies and other weirdness.

Conda can version and manage R as well as Python if you work on projects that use both then you only need one tool.

Conda can also install dev tools like Spyder, VSCode or Jupyter(labs) making it easier to offer a single point of entry for an entire dev environment.

But basically the big one is simply that Conda will install a lot more numeric packages with a lot fewer headaches on win, linux and mac than pip. Although in pip's defense it has gotten a lot better over the past 2-3 years. And I do agree that the dependency resolver can take a ridiculously long time in some situations.

Re:Python 3.11 by verall on Monday October 04, 2021 @08:40PM (#28754207)
I think this is an interesting case where people just want different things, and so the thing that they want is "better".

Some people really just want Python+extras and don't want to worry about getting a fortran compiler. Conda is great for this.

Other people really don't want a big meta-install system that bundles a bunch of dependencies. Maybe they're on Linux, they target a single platform, or they want to use a package not in conda that works with a more recent version of the dependencies that conda bundles.

Re:Python 3.11 by dagw on Tuesday October 05, 2021 @10:25AM (#28759907)
I think this is an interesting case where people just want different things

For some people Python is really more of an end user application. They don't want to develop and distribute and deploy software, they want to write scripts and analyze and transform data. They expect the script a colleague emailed them to just work and expect their colleague to be able to open and run their Jupyter notebook as easily as they can open and run an Excel document. For those people Conda comes much closer to solving their problems.

Re:Python 3.11 by lacker on Tuesday October 05, 2021 @04:02PM (#28764842)
Here's an example, let's say you're developing GPU code that needs to work with different CUDA versions on different machines. Look at the `cupy` install instructions for example:

https://docs.cupy.dev/en/stable/install.html

With conda this installation tends to just work, conda will also install the non-python cudatoolkit for you. With pip you have to either make all your python developers set up their c++ environment the same way as well, to install from source, or set a fixed cuda version that all users have to be on.

Now `cupy` is just one python library that has non-python dependencies. If your project has several dependencies like this, where conda is a one line install and pip means you have to mess around with your c++ environment, conda is probably the right choice for you.

All of the pain you mention with conda is totally correct, though, it's just a question of which sort of pain happens to be worse for the packages you are going to use.

Re:Python 3.11 by anakaine on Monday October 04, 2021 @01:31AM (#28743394)
Except when Conda plays hard to get, like in any corporate environment with connection inspection, custom root CAs, or not quite admin privileges. Then Conda is an absolute dog and hard to work with, yet regular old python is fine.
Re:Python 3.11 by wenc on Sunday October 03, 2021 @10:44PM (#28742463)
I use the Anaconda distribution. I can create environments containing any version of Python, like this:

    conda create -n myEnv python=2.7
    conda activate myEnv
I think the problem is that unless someone already knew Python, they probably wouldn't understand environments, so their first thought would be to somehow install another version of Python and replace the system Python, or to use a switcher to switch between versions. That would be my first intuition too. (and I believe that's how Ruby works, via RVM).

But Python works just a little bit differently in that it advocates for the use of its own environments to isolate dependencies. I'll have to admit it is not super intuitive (I already have a system package manager (apt, brew, etc.) and I have Docker containers -- why do I need another yet another environment?) but over time I've just accepted it for what it is. It's a Python convention.

Re:Python 3.11 by lacker on Monday October 04, 2021 @01:08AM (#28743299)
I mean, conda is installing another version of Python, and it provides a switcher to switch between environments. Conda and rvm are very similar to use.
Re:Python 3.11 by cdrini on Monday October 04, 2021 @12:25AM (#28743047)
Folks have given a number of good options here, but I thought I'd mention some other ones in case they're helpful for your use case.

1) docker! If you only plan on tinkering with something and don't want to install a bunch of random things on your machine, this command will start a python 2 image with access to the current directory: `docker run --rm -it -v "$PWD:/app" python:2.7 bash` (IIRC, on my phone atm!) (Windows users will need to write `"/$PWD://app"` if using mingw/etc). Once inside, you can pip install, etc, and it'll all go away once you exit the terminal! If you want it to stick around, don't use --rm and add a --name to give it a name you can remember for later. It does require learning some docker, but it's a good investment :) I use the same technique to try out/play with other languages, versions, packages, etc. without making complicated mods to my actual computer. And there might even be docker images that come with certain packages/etc pre-installed for certain use cases!

2) Pycharm! A good python IDE, with virtualenv support baked in if you don't feel like playing around with a bunch of commands at all. Although disclaimer, I can't fully remember how hard it was to get things setup (or how easy it is to work with multiple python versions), so YMMV.

Re:Python 3.11 by RheingoldRiver on Monday October 04, 2021 @12:47AM (#28743206)
I don't think Pycharm will install different versions for you, but if you have multiple versions installed, it is indeed super easy to switch between them. Though if you have a ton of packages you'll have to reinstall them all for the right version, and if you're dealing with lots of venvs + system installs, you have to make sure to choose the right thing from the dropdown and you might get somewhat lost and confused if you don't know what you're doing.

The right menu is File -> Settings -> Project: <your project name> -> Project Interpreter, and then you pick whatever you want by Python Interpreter.

In Windows I use Chocolatey to manage Python versions, in Mac idk though.

Re:Python 3.11 by rlayton2 on Monday October 04, 2021 @03:05AM (#28743937)
It does install them too - however I have the pro version, and I'm not sure if that's a pro feature or not.
Re:Python 3.11 by RheingoldRiver on Monday October 04, 2021 @04:50AM (#28744534)
It installs versions of Python or versions of packages? I can't find anything in the docs about installing versions of Python, just packages (which I've done on occasion, when I'm really confused about why my environment isn't working, I also have pro version now but I'm pretty sure I'd done it when I had community version too)
Re:Python 3.11 by rlayton2 on Monday October 04, 2021 @07:24PM (#28753670)
Ah, just checked. I thought it installed python versions as well, but it can create environments (virtualenv, conda, system pythons, pipenv, docker), and can install packages in those environments.

I do not see a way to install a whole new python version (only the ability to add to the list, which requires you to select the interpreter from an open file dialog)

Re:Python 3.11 by fiddlerwoaroof on Sunday October 03, 2021 @09:56PM (#28742221)
Interesting, I don’t use Python much anymore, but my project setup was always something like:

    virtualenv -p interpreter venv 
    source venv/bin/activate
    pip install . . .

These days, I just use nix
Re:Python 3.11 by shakna on Monday October 04, 2021 @01:17AM (#28743334)
Replace the first line with

    python3 -m venv venv
And you have the current state of things.
Re:Python 3.11 by anothernerd2 on Sunday October 03, 2021 @10:05PM (#28742264)
Install miniconda, it’s amazing. Takes roughly 30 seconds to install. After using conda I’ve never had environment issues
Re:Python 3.11 by jnwatson on Sunday October 03, 2021 @10:59PM (#28742535)
Please enough of this. Trying spending 2 minutes googling it. Hint: pyenv
Re:Python 3.11 by em500 on Monday October 04, 2021 @04:37AM (#28744452)
If you spend 2 minutes googling it (or even just reading HN comments here), you'll get various people recommending venv, pyenv, poetry, conda, pyflow and probably a whole bunch of deprecated stuff, where it's totally unclear to outsiders which one to use.
Re:Python 3.11 by NathanOsullivan on Monday October 04, 2021 @05:59PM (#28752614)
Fwiw if you are an outsider, having gone through this exact issue myself recently start with venv: https://docs.python.org/3/library/venv.html

It is a standard library module and serves as the base functionality, most the other things you list are third party tools that build on the venv concept in various ways.

Once you grok venv, you will be in a position to understand if those tools can provide value to your particular situation.

Re:Python 3.11 by DrOctagon on Monday October 04, 2021 @02:24AM (#28743678)
I wanted to install python on a new Mac last night and just couldn’t get up and running. Closest I got was with using anaconda but although I could get the right env in the terminal I couldn’t get either paycharm or vscode to pick up the correct interpreter/packages etc.

I’d almost guarantee there was something simple I was missing but for someone not familiar with the ecosystem getting python set up to do more than just hello world is a shitshow.

Re:Python 3.11 by e3bc54b2 on Monday October 04, 2021 @02:04AM (#28743556)
virtualenv, pyenv, venv.. I'm sure they all work well, but for a newbie, the sheer choice is a killer, especially when they all work almost same, but not quite.

Now compare that with cargo or npm and the canonical way makes newbie upbringing SL much easier.

Re:Python 3.11 by alwillis on Monday October 04, 2021 @12:21AM (#28743014)
Took the words out of my mouth. Let’s not over complicate things.
Re:Python 3.11 by lmm on Sunday October 03, 2021 @11:18PM (#28742642)
1. Python has a low barrier to entry and is a popular first language, so most users don't realise how bad it is.

2. Python was originally popular with old-school sysadmins, Debian types, and a lot of its package management is based around that philosophy of carefully hand-tended servers shared by multiple users.

Re:Python 3.11 by yjftsjthsd-h on Sunday October 03, 2021 @11:29PM (#28742727)
> a lot of its package management is based around that philosophy of carefully hand-tended servers shared by multiple users.

Is it? I'd love for apt to support virtual environments or `apt install --user` like pip does, let alone populating venvs with requirements.txt.

Re:Python 3.11 by lmm on Monday October 04, 2021 @01:46AM (#28743464)
The pile of debootstrap chroot stuff that you get told to use works pretty similarly to virtualenv. It's pretty clunky and bolted-on, but so is the Python version.
Re:Python 3.11 by fragmede on Monday October 04, 2021 @01:48AM (#28743473)
(s)`chroot` and `debootstrap` existed long before docker did for this purpose.
Re:Python 3.11 by iamcreasy on Sunday October 03, 2021 @11:25PM (#28742683)
Care to elaborate on what is bad? How bad are they compared to other languages? (Assuming you are always accepting some tradeoffs when moving from one eco system to another)
Re:Python 3.11 by sergiomattei on Sunday October 03, 2021 @11:57PM (#28742901)
It's painfully archaic compared to languages that have all this sorted out.

Pip is a recipe for disaster, indicated by the huge amount of churn in the Python packaging sphere. It's constantly the worst part of my day whenever I pick a Python project up. Conflicting dependencies, non-deterministic installs, etc.

I used to cope with this crap fest until I tried Elixir and experienced the beauty of modern package management and build tools. One tool, Mix, that handles task running and dependency management with a proper resolver.

I honestly think even Node has a better package management and tooling story.

Also: virtual environments are a hack and a pain. Python is moving forward in this aspect with the recent PEP for the pypackages folder, but we're still a long way from adoption.

All of this stuff is painful for beginners. Virtual environments might seem easy to us, but I've had ridiculous amounts of trouble explaining why they're necessary to beginner developers. Then you have to explain `poetry` or `pip freeze`.

Even I have trouble coming back to older projects of mine and I'm an experienced Pythonista: I usually waste an hour or two trying to sort the pip dependencies out with whatever conflicts the resolver comes up with this time.

Python package management is not okay, we're all just used to coping with it. Other languages put it to shame.

Re:Python 3.11 by cerved on Monday October 04, 2021 @01:46AM (#28743467)
Package management is pretty fubar for in every language I've tried but python is one of the worst
Re:Python 3.11 by infamia on Monday October 04, 2021 @12:31PM (#28749063)
> non-deterministic installs

Things continue to improve. For example, Pip's resolver has been deterministic since around November 2020. Bringing something minimal into Python that provides deterministic builds (e.g. pip-tools) would help packaging a lot.

Re:Python 3.11 by lmm on Monday October 04, 2021 @01:44AM (#28743456)
Off the top of my head:

- What you get when you import a library depends on state that's scattered all over the system: system-managed packages, pip-managed system-global packages, pip-managed per-user packages, which virtualenv is currently active, which directory you're currently in, which directory the program you're running is in, whatever it is that conda does....

- There's no concept of reproducible builds or dependency pinning. There's "pip freeze" but that's a one-time operation that you can't then reverse, so it's only usable for leaf applications. If you're developing a library, you'd better get used to having your transitive dependencies changed on you all the time. And since the whole ecosystem is built that way, even if you use some tool that lets you make stable releases of your library, that doesn't help you develop at all.

- Virtualenvs are stateful and attached to whatever terminal you were in at the time. This interacts hilariously with the previous point: if you accidentally run "cd myproject && pip install -r requirements.txt" in the wrong terminal, you permanently, irreversibly fuck up that virtualenv. All you can do is wipe it out and try to recreate it - but, per the previous point, it probably won't come out the same as before.

- You're supposed to use pip to manage which python version each project is using. But you're supposed to use the installer for it that's distributed with the python runtime. But only certain versions of the python runtime...

- There's only one global repository. If you want to build some libraries and reuse them the same way you'd use a normal library dependency, you have to publish them to the global PyPi. I think there might be an expensive service that works around this, but there's no repository program that you can just spin up on your own servers.

It's really a lot worse than other languages. If you build a real system (like, a couple of libraries and applications) in another language (not, like, C/C++ - but even Perl or TCL will prove the point) and then come back to Python, you'll find yourself hating it all the time.

Re:Python 3.11 by joshuamorton on Monday October 04, 2021 @03:58AM (#28744229)
> There's "pip freeze" but that's a one-time operation that you can't then reverse, so it's only usable for leaf applications.

What do you mean by reverse? You can certainly upgrade all packages locally and then run pip freeze again if you want to set up newer versions, or like manually change versions in your requirements.txt and `pip install --upgrade` to update them. For stronger reproducibility guarantees there's also `--require-hashes`, although admittedly freeze doesn't appear to support easily writing hashes to a requirements.txt.

> per the previous point, it probably won't come out the same as before.

I don't see how this follows. If you have frozen dependencies, it will.

> You're supposed to use pip to manage which python version each project is using. But you're supposed to use the installer for it that's distributed with the python runtime. But only certain versions of the python runtime...

No you use venv for that. Venv which has been available since python 3.3, in 2012, and on pip, ensurepip has been since 3.4, in 2014. If you're using a version of python that's 10 years old, I don't really know what to say.

> There's only one global repository. If you want to build some libraries and reuse them the same way you'd use a normal library dependency, you have to publish them to the global PyPi. I think there might be an expensive service that works around this, but there's no repository program that you can just spin up on your own servers.

I mean you can install from git directly: https://pip.pypa.io/en/stable/topics/vcs-support/#vcs-suppor..., and there is documentation on spinning up a local repository (which for packages, is just files in a known directory structure): https://packaging.python.org/guides/hosting-your-own-index/

Re:Python 3.11 by lmm on Monday October 04, 2021 @04:08AM (#28744285)
> What do you mean by reverse? You can certainly upgrade all packages locally and then run pip freeze again if you want to set up newer versions, or like manually change versions in your requirements.txt and `pip install --upgrade` to update them. For stronger reproducibility guarantees there's also `--require-hashes`, although admittedly freeze doesn't appear to support easily writing hashes to a requirements.txt.

You need to know, and maintain, both what you intended to depend on and what you physically ended up depending on. So in more sensible ecosystems you will have, e.g., Gemfile and Gemfile.lock. pip freeze is, effectively, the way you create Gemfile.lock, but it forces you to destroy Gemfile to do it. And so you can't really use it.

Re:Python 3.11 by dragonwriter on Tuesday October 05, 2021 @09:41AM (#28759333)
> So in more sensible ecosystems you will have, e.g., Gemfile and Gemfile.lock. pip freeze is, effectively, the way you create Gemfile.lock, but it forces you to destroy Gemfile to do it.

No, it doesn't.

  pip freeze -r requirements.txt > requirements.lock.txt
There's plenty of legitimate criticism of python in general and pip in particular, but much of yours send to be criticism of things that are factually untrue.
Re:Python 3.11 by dragonwriter on Tuesday October 05, 2021 @02:06AM (#28755969)
> There's only one global repository. If you want to build some libraries and reuse them the same way you'd use a normal library dependency, you have to publish them to the global PyPi. I think there might be an expensive service that works around this, but there's no repository program that you can just spin up on your own servers.

https://pypi.org/project/pypiserver/

Also, pip will install from a git repository.

Re:Python 3.11 by watermelon0 on Monday October 04, 2021 @02:00AM (#28743539)
> - There's only one global repository. If you want to build some libraries and reuse them the same way you'd use a normal library dependency, you have to publish them to the global PyPi. I think there might be an expensive service that works around this, but there's no repository program that you can just spin up on your own servers.

You can setup proxy such as Nexus, which allows hosting your own librarires: https://help.sonatype.com/repomanager3/formats/pypi-reposito...

Re:Python 3.11 by glau on Monday October 04, 2021 @03:12AM (#28743979)
You should check out poetry. It has greatly simplified almost all of what you have mentioned
Re:Python 3.11 by odonnellryan on Sunday October 03, 2021 @10:04PM (#28742255)
What are you trying to do? It generally is not a problem unless you are using old or obscure packages. Sure some projects need those things, probably a lot of them, but I don't think that is really pythons fault. Not that this couldn't be done better in python. What issues did you encounter?
Re:Python 3.11 by guskel on Sunday October 03, 2021 @09:56PM (#28742220)
If you use pyenv, it shouldn't be that difficult.
Re:Python 3.11 by NikolaeVarius on Sunday October 03, 2021 @10:04PM (#28742257)
I dont know how its actually possible to spend 4 hours getting lyton2 and pip setup at all. The issues deal with managing upgrades, not initial setup
Re:Python 3.11 by rcarmo on Monday October 04, 2021 @03:34AM (#28744109)
This too is a solved problem. First of all, the bundled Python 3 in Big Sur is perfectly OK and works fine (it’s become my default after years of pyenv).

Second, brew and pyenv “just work” if you need any other version. I’ve been developing in Python for decades, and it is one of the cleanest and easier approaches to running multiple runtimes I’ve used in any language.

Re:Python 3.11 by blondin on Sunday October 03, 2021 @10:20PM (#28742334)
i sympathize.

the problem is apple. they are (understandably) refusing to ship an up-to-date global python interpreter with macOS. not only that, they aren't removing the default 2.7 that they ship.

macOS Big Sur ships Python 2.7. ha. ha. ha.

none of the proposed "virtual environments" solutions are going to rescue you when you operate globally at the OS-level and not in a sandbox.

been there.

Re:Python 3.11 by oefrha on Monday October 04, 2021 @01:56AM (#28743514)
1. macOS ships a /usr/bin/python3 that is up-to-date at the time of the feature freeze of a major macOS release, e.g. macOS 11 ships Python 3.8.2 from February 2020.

2. /usr/bin/python being a symlink for python2.7 is entirely consistent with PEP 394 recommendations, especially the version before June 2019: https://raw.githubusercontent.com/python/peps/214736457f6d61...

  * Unix-like software distributions (including systems like Mac OS X and
    Cygwin) should install the ``python2`` command into the default path
    whenever a version of the Python 2 interpreter is installed, and the same
    for ``python3`` and the Python 3 interpreter.
  * When  invoked, ``python2`` should run some version of the Python 2
    interpreter, and ``python3`` should run some version of the Python 3
    interpreter.
  * If the ``python`` command is installed, it should invoke the same version of
    Python as the ``python2`` command (however, note that some distributions
    have already chosen to have ``python`` implement the ``python3``
    command; see the `Rationale`_ and `Migration Notes`_ below).
The 2019 update https://github.com/python/peps/commit/ae932bd6fd2c493d7d64ce... allowed more flexibility, but the old handling is still entirely okay.
Re:Python 3.11 by JimDabell on Sunday October 03, 2021 @11:44PM (#28742843)
> not only that, they aren't removing the default 2.7 that they ship.

Yes they are:

    $ python

    WARNING: Python 2.7 is not recommended. 
    This version is included in macOS for compatibility with legacy software. 
    Future versions of macOS will not include Python 2.7. 
    Instead, it is recommended that you transition to using 'python3' from within Terminal.
    
    Python 2.7.16 (default, Aug 30 2021, 14:43:11) 
    [GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
Re:Python 3.11 by wutbrodo on Sunday October 03, 2021 @11:12PM (#28742606)
> they are (understandably) refusing to ship an up-to-date global python interpreter with macOS

What is the understandable reasoning?

Re:Python 3.11 by mbreese on Monday October 04, 2021 @12:14AM (#28742982)
It's pretty common to have kept `/usr/bin/python` as Python2. This is the most conservative option and won't break anything that's already running. Anyone who is using Python currently will have already installed Python 3 (or knows how to do this), and is probably using `#!/usr/bin/env python3`. As an OS vendor with many (many...) systems in the wild, you don't want to switch Python versions on people unexpectedly. Especially when it's still pretty painless to keep python2 around even if there is an installed python3.

For anyone that's still using python2 (as a nearby comment mentioned), there is now at least a warning to avoid using the default Python 2.7 (/usr/bin/python). For an OS vendor, this transition takes a long time... but at least it's in process.

Re:Python 3.11 by wutbrodo on Tuesday October 05, 2021 @09:20AM (#28759022)
Oh, sure, it's definitely not a good idea to change what the unqualified python binary refers to. But I interpreted "refusing to ship an up-to-date global python interpreter with macOS" as meaning that Python3 isn't shipped at all, with the binary name "python3").

Is that the case? If so, I still don't understand the reasoning.

Re:Python 3.11 by mbreese on Tuesday October 05, 2021 @11:45AM (#28761033)
I don’t think anything in macOS (the base OS) requires Python, does it? If not, then, I don’t see why Apple would want to ship any Python with the OS. Let people install the Python version they want and then the users will have to maintain it.
Re:Python 3.11 by wutbrodo on Tuesday October 05, 2021 @06:38PM (#28766633)
The comment I asked rhe question of said:

> the problem is apple. they are (understandably) refusing to ship an up-to-date global python interpreter with macOS

Ie the claim is that it's causing a problem for users. I don't have an opinion about this point, but it is the premise of my question.

Re:Python 3.11 by BiteCode_dev on Monday October 04, 2021 @03:47AM (#28744170)
Because python 2 has been unsupported for more than a year.
Re:Python 3.11 by ArchD on Sunday October 03, 2021 @09:55PM (#28742210)
No such problems on Linux, which is free and open-source. I think 'open-source' is the key.
Re:Python 3.11 by Godel_unicode on Monday October 04, 2021 @12:39AM (#28743142)
I think you mean you don't have such problems on Linux, there are plenty of people who trip over the fact that the default python on RHEL<= 7 was comically old and unintuitive to update...

https://www.ibm.com/support/pages/work-around-frustrating-py...

https://unix.stackexchange.com/questions/468620/how-to-chang...

Re:Python 3.11 by ArchD on Monday October 04, 2021 @07:33AM (#28745383)
You are comparing apples and oranges, obviously. Perhaps some people are just unconsciously too enamored with apples.

OP's problem was not configuring default Python version as in your second link. Your first link is about some IBM stuff, and IBM is proprietary, so no comments there.

Neither was OP's problem about setting up Python on an old version of the Mac OS.

In any case, on old RHEL, you can just do something like this: https://www.2daygeek.com/install-python-3-on-centos-6/

Installing Python on Linux is much easier than you're trying to say.

For the the love of apples.

Re:Python 3.11 by Godel_unicode on Monday October 04, 2021 @09:30AM (#28746460)
Configuring the default python, also referred to as installing a new Python, is exactly what OP was doing.

The process in the supplied link, which is the same as the process you weirdly called IBM proprietary even though it has nothing to do with IBM, is essentially the same as the process on MacOS. Realize that the OS python is not what you want, enable a non-default package repository with a few shell commands, install Python.

Prejudice about anything to do with Apple aside, glad to see we agree that RHEL and MacOS have similar install processes.

Re:Python 3.11 by forgingahead on Sunday October 03, 2021 @10:13PM (#28742299)
Python dependency management is rubbish, and many python projects have incomplete or missing requirements.txt files. I dislike Python as well (why on earth is whitespace relevant??) but unfortunately if you want to tinker with any of the newest deep-learning projects, you'll need python.

I use Anaconda for package management on Ubuntu, which helps a lot, but it's still not my preferred programming language.

Re:Python 3.11 by saltyfamiliar on Sunday October 03, 2021 @11:17PM (#28742633)
> why on earth is whitespace relevant??

To eliminate the need for braces and semicolons, of course. It's part of what makes python so easy to read and write. Is it really such a problem?

I honestly can't imagine disliking python. It's my goto for anything where performance doesn't matter due to its unmatched ergonomics and vast libs. Golang comes close but for some reason having to implement really common and basic things yourself is part of the language's design philosophy. Plus it's compiled so you can't just drop into the interpreter for a slick one-liner.

What's your preferred quick and dirty scripting/programming langage?

Re:Python 3.11 by forgingahead on Monday October 04, 2021 @12:07AM (#28742947)
I prefer Ruby for quick scripting - in my opinion it beats Python in readability (sugarcoating handlers/hiding guts like not needing self littered everywhere), and seems to have more logical consistency in calls (eg: array.append(element) but len(array) in Python vs. array.append(element) and array.length in Ruby, amongst many other things).

It's definitely a preference, and Python has a lot of library support that the Ruby community doesn't (yet, hopefully), but grandparent's comment about headaches setting up Python with a simple project are pretty common.

Rarely do I encounter a Python project that "just works" - If your setup isn't exactly the same as the repo owner, and often even they don't even know why their setup is the way it is, then there's often a lot of fiddling and package adjustments needed. Not a deal breaker normally, but enough to make it more painful to quickly drop in and start experimenting with.