• Re: Installation hell

    From Weatherby,Gerard@21:1/5 to All on Mon Dec 19 14:59:20 2022
    Personally, I don�t use Windows and avoid it like the plague. Python is easy to install on Linux and Mac.

    I�d start here: https://learn.microsoft.com/en-us/visualstudio/python/overview-of-python-tools-for-visual-studio?view=vs-2022

    From: Python-list <python-list-bounces+gweatherby=[email protected]> on behalf of Jim Lewis <[email protected]>
    Date: Sunday, December 18, 2022 at 12:56 PM
    To: [email protected] <[email protected]>
    Subject: Fwd: Installation hell
    *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

    I'm an occasional user of Python and have a degree in computer science.
    Almost every freaking time I use Python, I go through PSH (Python Setup
    Hell). Sometimes a wrong version is installed. Sometimes it's a path issue.
    Or exe naming confusion: python, python3, phthon311, etc. Or library compatibility issues - took an hour to find out that pygame does not work
    with the current version of python. Then the kludgy PIP app and using a DOS
    box under Windows with command prompts which is ridiculous. God only knows
    how many novice users of the language (or even intermediate users) were
    lost in the setup process. Why not clean the infrastructure up and make a modern environment or IDE or something better than it is now. Or at least
    good error messages that explain exactly what to do. Even getting this
    email to the list took numerous steps.

    -- A frustrated user
    -- https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!gdOs-oC1JZcmvMXy1G4irRpzHCUmF565UXVdCjzSWNGZKpmZ04I_llDX4WUeob3asBCjLe6TIthAAhmwFgbph9u1m9A$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/
    python-list__;!!Cn_UX_p3!gdOs-oC1JZcmvMXy1G4irRpzHCUmF565UXVdCjzSWNGZKpmZ04I_llDX4WUeob3asBCjLe6TIthAAhmwFgbph9u1m9A$>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas Passin@21:1/5 to Gerard on Mon Dec 19 10:55:52 2022
    On 12/19/2022 9:59 AM, Weatherby,Gerard wrote:
    Personally, I don’t use Windows and avoid it like the plague. Python is easy to install on Linux and Mac.

    That's not been my experience. Windows installers for Python have
    worked well for me over many generations of Python releases. It's Linux
    where I've found difficulties. For example, if your distro's Python
    install didn't include tkinter (or even pip), how do you get it? It's different for different Linux distros. I generally have to use internet searches to find out.

    For another example, when you use pip to install a package, it sometimes suggests that you install a newer version of pip itself. Should you do
    that? On Linux, probably not, because the distro will have modified pip
    so it puts things in distro-specific places. Yet there is no newer
    version of pip available through the distro's package manager. Will
    anything bad happen if you don't update pip? Who knows?

    I have a Linux VM that has several versions of Python3 on it. Python3.8
    came installed with the distro, but for some programs I need Python
    3.9+. If I forget which versions I have, how can I find out? People
    say to use which, but that doesn't work - it only reports "python3".
    This does work, but it's not all that easy to remember (the grep "site"
    part is just to filter out uninformative result lines):

    ~$ find 2>/dev/null ~ -name python -type d |grep "site" /home/tom/.local/lib/python3.9/site-packages/PyQt5/Qt5/qsci/api/python /home/tom/.local/lib/python3.8/site-packages/pandas/_libs/src/ujson/python /home/tom/.local/lib/python3.10/site-packages/PyQt5/Qt5/qsci/api/python

    Not that this task is much easier to remember on Windows, but it's not
    harder. One way: the "py" launcher will tell you:

    py --list
    -V:3.10 * Python 3.10 (64-bit)
    -V:3.9 Python 3.9 (64-bit)
    -V:3.7 Python 3.7 (64-bit)
    -V:2.7

    This is not Linux-bashing, but there's no need for Windows-bashing either.

    I’d start here: https://learn.microsoft.com/en-us/visualstudio/python/overview-of-python-tools-for-visual-studio?view=vs-2022

    From: Python-list <python-list-bounces+gweatherby=[email protected]> on behalf of Jim Lewis <[email protected]>
    Date: Sunday, December 18, 2022 at 12:56 PM
    To: [email protected] <[email protected]>
    Subject: Fwd: Installation hell
    *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

    I'm an occasional user of Python and have a degree in computer science. Almost every freaking time I use Python, I go through PSH (Python Setup Hell). Sometimes a wrong version is installed. Sometimes it's a path issue. Or exe naming confusion: python, python3, phthon311, etc. Or library compatibility issues - took an hour to find out that pygame does not work with the current version of python. Then the kludgy PIP app and using a DOS box under Windows with command prompts which is ridiculous. God only knows how many novice users of the language (or even intermediate users) were
    lost in the setup process. Why not clean the infrastructure up and make a modern environment or IDE or something better than it is now. Or at least good error messages that explain exactly what to do. Even getting this
    email to the list took numerous steps.

    -- A frustrated user
    -- https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!gdOs-oC1JZcmvMXy1G4irRpzHCUmF565UXVdCjzSWNGZKpmZ04I_llDX4WUeob3asBCjLe6TIthAAhmwFgbph9u1m9A$<https://urldefense.com/v3/__https:/mail.python.org/mailman/
    listinfo/python-list__;!!Cn_UX_p3!gdOs-oC1JZcmvMXy1G4irRpzHCUmF565UXVdCjzSWNGZKpmZ04I_llDX4WUeob3asBCjLe6TIthAAhmwFgbph9u1m9A$>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Angelico@21:1/5 to Thomas Passin on Tue Dec 20 03:36:55 2022
    On Tue, 20 Dec 2022 at 03:05, Thomas Passin <[email protected]> wrote:

    That's not been my experience. Windows installers for Python have
    worked well for me over many generations of Python releases. It's Linux where I've found difficulties. For example, if your distro's Python
    install didn't include tkinter (or even pip), how do you get it? It's different for different Linux distros. I generally have to use internet searches to find out.

    If you want to use your distro's Python and add more stuff to it
    globally, then yes, it depends on your distro. This is not really a
    surprise.

    For another example, when you use pip to install a package, it sometimes suggests that you install a newer version of pip itself. Should you do
    that? On Linux, probably not, because the distro will have modified pip
    so it puts things in distro-specific places. Yet there is no newer
    version of pip available through the distro's package manager. Will
    anything bad happen if you don't update pip? Who knows?

    Virtual environments work the same way regardless of distro, including
    allowing you to install an upgraded pip. As long as your distro
    provides the venv package (on Debian, that's in python3-venv), you can
    just:

    $ python3 -m venv env
    $ source env/bin/activate
    $ pip install -U pip
    $ pip install -r requirements.txt
    $ pip install some-package-name
    $ etc etc etc etc etc

    This is also a recommended way to do things on Windows, so you don't
    even need to do things differently.

    I have a Linux VM that has several versions of Python3 on it. Python3.8
    came installed with the distro, but for some programs I need Python
    3.9+. If I forget which versions I have, how can I find out? People
    say to use which, but that doesn't work - it only reports "python3".
    This does work, but it's not all that easy to remember (the grep "site"
    part is just to filter out uninformative result lines):

    Use what your shell already offers you! If you have multiple Pythons
    installed, type "python3" and hit tab twice. You should get a list of
    options. The exact shell you're using will affect how they're shown,
    but I'm pretty sure most shells (at least, the ones designed to be
    interactive - /bin/dash might not) will give you some facility like
    this.

    rosuav@sikorsky:~$ python3
    python3 python3.5-dbg-config python3.8-config
    python3.10 python3.5dm python3.8m
    python3.10-config python3.5dm-config python3.8m-config
    python3.11 python3.5m python3.9
    python3.11-config python3.5m-config python3.9-config
    python3.12 python3.6 python3.9d
    python3.12-config python3.6-config python3.9-dbg
    python3.4 python3.6m python3.9-dbg-config python3.4-config python3.6m-config python3.9d-config
    python3.4m python3.7 python3-config
    python3.4m-config python3.7-config python3d
    python3.5 python3.7m python3-dbg
    python3.5-config python3.7m-config python3-dbg-config
    python3.5-dbg python3.8 python3d-config
    rosuav@sikorsky:~$ python3

    Yes, this is a bit noisy in that it has the -config and -dbg-config
    tools listed as well, but you can easily see all the variants that are installed.

    ~$ find 2>/dev/null ~ -name python -type d |grep "site" /home/tom/.local/lib/python3.9/site-packages/PyQt5/Qt5/qsci/api/python /home/tom/.local/lib/python3.8/site-packages/pandas/_libs/src/ujson/python /home/tom/.local/lib/python3.10/site-packages/PyQt5/Qt5/qsci/api/python

    Ugh, that's a horribly inefficient way to do it. All you need to do is
    search $PATH. If tab completion isn't suitable, you could probably use
    "whereis python3", though it's probably a bit noisy.

    Not that this task is much easier to remember on Windows, but it's not harder. One way: the "py" launcher will tell you:

    py --list
    -V:3.10 * Python 3.10 (64-bit)
    -V:3.9 Python 3.9 (64-bit)
    -V:3.7 Python 3.7 (64-bit)
    -V:2.7

    This is not Linux-bashing, but there's no need for Windows-bashing either.

    There's no need for Linux-bashing when Linux isn't the problem. :)

    And Windows wasn't the OP's problem. Nor was Python. The OP moaned
    about a lack of IDEs, when pretty much every IDE and text editor out
    there has Python support.

    We're not here to bash anything. Well, except maybe the popular Unix
    shell. I'll /bin/bash that every day of the week... ahem. Anyhow.
    We're here to share tips and help everyone be more productive.

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Peter J. Holzer@21:1/5 to Thomas Passin on Mon Dec 19 17:54:51 2022
    On 2022-12-19 10:55:52 -0500, Thomas Passin wrote:
    On 12/19/2022 9:59 AM, Weatherby,Gerard wrote:
    Personally, I don’t use Windows and avoid it like the plague.
    Python is easy to install on Linux and Mac.

    That's not been my experience. Windows installers for Python have worked well for me over many generations of Python releases.

    I haven't had any problem either despite being only an occasional
    Windows user.

    It is however, quite noticable that almost everyone who asks a question
    about their Python installation on this list is using Windows. I don't
    think this is just because there are more Windows users than Linux or
    Mac Users.

    It's Linux where I've found difficulties. For example, if your
    distro's Python install didn't include tkinter (or even pip), how do
    you get it? It's different for different Linux distros.

    Yes, but most Linux users don't use a dozen different distributions. And
    if you've used one for a while you generaLLy know their general naming conventions. So just guessing (with a little help from your shell's
    expansion mechanism) the name will take you a long way.

    So as a long-time Debian and Ubuntu user I just know that a Python
    package foo will be packaged as python3-foo while a Perl package of the
    same name would be packaged as libfoo-perl. Not exactly consistent, but
    you get used to it. On RedHat (which I've also used for a long time) the
    naming conventions are a bit different but also easy to find out.

    For another example, when you use pip to install a package, it sometimes suggests that you install a newer version of pip itself. Should you do that? On Linux, probably not, because the distro will have modified pip so it puts things in distro-specific places. Yet there is no newer version of pip available through the distro's package manager. Will anything bad happen if you don't update pip? Who knows?

    If I use pip on Linux I almost always install into a virtual environment
    (rule 1: Don't mess with the package manager). So year, I can install a
    new version of pip into that virtual environment without affecting
    anything else.


    I have a Linux VM that has several versions of Python3 on it. Python3.8
    came installed with the distro, but for some programs I need Python 3.9+.
    If I forget which versions I have, how can I find out?

    I type python and then ctrl-D. The shell will then show me all commands starting with "python" in my path (your shell may have a different key combination for that, maybe tab-tab).

    People say to use which, but that doesn't work - it only reports
    "python3".

    More specifically it will report *where* the exact command you named is installed. So "which python3" might report /usr/bin/python3 or /usr/local/bin/python3 or maybe /opt/python3.9.2/bin/python3 but it will
    never report the presence of any executable not named "python3" and even
    if you have several it will only give you one of them.

    ~$ find 2>/dev/null ~ -name python -type d |grep "site" /home/tom/.local/lib/python3.9/site-packages/PyQt5/Qt5/qsci/api/python /home/tom/.local/lib/python3.8/site-packages/pandas/_libs/src/ujson/python /home/tom/.local/lib/python3.10/site-packages/PyQt5/Qt5/qsci/api/python

    Not that this task is much easier to remember on Windows, but it's not harder. One way: the "py" launcher will tell you:

    py --list
    -V:3.10 * Python 3.10 (64-bit)
    -V:3.9 Python 3.9 (64-bit)
    -V:3.7 Python 3.7 (64-bit)
    -V:2.7

    But that works only for Python. Shell expansion works for any command.
    If you use Linux, learn how to use your shell (and maybe learn different
    shells - I personally prefer zsh, but I can also use bash, ksh, tcsh and
    if necessary even sh).

    hp

    --
    _ | Peter J. Holzer | Story must make more sense than reality.
    |_|_) | |
    | | | [email protected] | -- Charles Stross, "Creative writing
    __/ | http://www.hjp.at/ | challenge!"

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmOgl1YACgkQ8g5IURL+ KF1rPg/+MMM6SMD1D9jHp3f0OeCpg2R1rF/M65X0/Re78aMSvR0FQllF/Arhw3ci dDVvOWg8+r/HvXh7XpPiIukdF0otJfoChQiJeLw4jNWEYFJTzcqcKk5dJiHVc4R6 lXqRF9bWlgYyckxDV9bt0Ridehj2PoaIziSo/tKpbQjfpk91/ZpkRa8pylfD16TL 0ezU7nyBQYKj/haZ6d+X53UnWu6/8ppZcbGuyzxrOXphLSpSTMt1BECwup3X1ah0 VARABaM0aK8Hlhw/XwwJ1ZUly6wxOJxuQORQdnc+ZGerB7xaa8VC30lqsWWvxUHp S6F2JYHUhnoX5pH9HXQhWIsbgk5gV9LeMS9YR6gns6WTFg7SWn2ZaDNb52OiRudd MNZDDkCV2APueTyM7krP9A6weutcW9CoAv0UKbCJh2vjb8AVtcM+LATkjPGZhFoZ 2Ke4arJUtKD9dGuLgLvYIewjLjoK1AfqpD9B855R58Iar9x+jK0cgZU0xpEmIhCG /e+2yV5r2XChdV88xJvCwc5An+8i5Mi1uD42jkeCddwf7zDNnMwT8WaAD983cjtJ I4nZemj4jMOZwRUF3ZFPhJTuamBEYFJ0p2MiPyHWZ5GGeQffo3NpeLHrzYZhVpBj aS0hzUcDSDXyOTrpWektlp2qN6RyK7GFm4Zio3K
  • From Thomas Passin@21:1/5 to Chris Angelico on Mon Dec 19 12:06:38 2022
    On 12/19/2022 11:36 AM, Chris Angelico wrote:
    On Tue, 20 Dec 2022 at 03:05, Thomas Passin <[email protected]> wrote:

    That's not been my experience. Windows installers for Python have
    worked well for me over many generations of Python releases. It's Linux
    where I've found difficulties. For example, if your distro's Python
    install didn't include tkinter (or even pip), how do you get it? It's
    different for different Linux distros. I generally have to use internet
    searches to find out.

    If you want to use your distro's Python and add more stuff to it
    globally, then yes, it depends on your distro. This is not really a
    surprise.

    For another example, when you use pip to install a package, it sometimes
    suggests that you install a newer version of pip itself. Should you do
    that? On Linux, probably not, because the distro will have modified pip
    so it puts things in distro-specific places. Yet there is no newer
    version of pip available through the distro's package manager. Will
    anything bad happen if you don't update pip? Who knows?

    Virtual environments work the same way regardless of distro, including allowing you to install an upgraded pip.

    I have always disliked working with venvs and avoid it whenever
    possible. But I suppose that's just me.

    As long as your distro
    provides the venv package (on Debian, that's in python3-venv), you can
    just:

    $ python3 -m venv env
    $ source env/bin/activate
    $ pip install -U pip
    $ pip install -r requirements.txt
    $ pip install some-package-name
    $ etc etc etc etc etc

    This is also a recommended way to do things on Windows, so you don't
    even need to do things differently.

    I have a Linux VM that has several versions of Python3 on it. Python3.8
    came installed with the distro, but for some programs I need Python
    3.9+. If I forget which versions I have, how can I find out? People
    say to use which, but that doesn't work - it only reports "python3".
    This does work, but it's not all that easy to remember (the grep "site"
    part is just to filter out uninformative result lines):

    Use what your shell already offers you! If you have multiple Pythons installed, type "python3" and hit tab twice. You should get a list of options. The exact shell you're using will affect how they're shown,
    but I'm pretty sure most shells (at least, the ones designed to be interactive - /bin/dash might not) will give you some facility like
    this.

    Ah, that's nice. Though it didn't report python3.10 on the VM I
    mentioned earlier.


    rosuav@sikorsky:~$ python3
    python3 python3.5-dbg-config python3.8-config
    python3.10 python3.5dm python3.8m
    python3.10-config python3.5dm-config python3.8m-config
    python3.11 python3.5m python3.9
    python3.11-config python3.5m-config python3.9-config
    python3.12 python3.6 python3.9d
    python3.12-config python3.6-config python3.9-dbg
    python3.4 python3.6m python3.9-dbg-config python3.4-config python3.6m-config python3.9d-config
    python3.4m python3.7 python3-config
    python3.4m-config python3.7-config python3d
    python3.5 python3.7m python3-dbg
    python3.5-config python3.7m-config python3-dbg-config
    python3.5-dbg python3.8 python3d-config rosuav@sikorsky:~$ python3

    Yes, this is a bit noisy in that it has the -config and -dbg-config
    tools listed as well, but you can easily see all the variants that are installed.

    ~$ find 2>/dev/null ~ -name python -type d |grep "site"
    /home/tom/.local/lib/python3.9/site-packages/PyQt5/Qt5/qsci/api/python
    /home/tom/.local/lib/python3.8/site-packages/pandas/_libs/src/ujson/python >> /home/tom/.local/lib/python3.10/site-packages/PyQt5/Qt5/qsci/api/python

    Ugh, that's a horribly inefficient way to do it. All you need to do is
    search $PATH. If tab completion isn't suitable, you could probably use "whereis python3", though it's probably a bit noisy.

    Sure is!

    Not that this task is much easier to remember on Windows, but it's not
    harder. One way: the "py" launcher will tell you:

    py --list
    -V:3.10 * Python 3.10 (64-bit)
    -V:3.9 Python 3.9 (64-bit)
    -V:3.7 Python 3.7 (64-bit)
    -V:2.7

    This is not Linux-bashing, but there's no need for Windows-bashing either.

    There's no need for Linux-bashing when Linux isn't the problem. :)

    And Windows wasn't the OP's problem. Nor was Python. The OP moaned
    about a lack of IDEs, when pretty much every IDE and text editor out
    there has Python support.

    Yes, the OP's rant didn't make much sense to me, especially since it
    didn't line up with my experience at all.

    We're not here to bash anything. Well, except maybe the popular Unix
    shell. I'll /bin/bash that every day of the week... ahem. Anyhow.
    We're here to share tips and help everyone be more productive.

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Angelico@21:1/5 to Thomas Passin on Tue Dec 20 04:24:46 2022
    On Tue, 20 Dec 2022 at 04:14, Thomas Passin <[email protected]> wrote:

    On 12/19/2022 11:36 AM, Chris Angelico wrote:
    On Tue, 20 Dec 2022 at 03:05, Thomas Passin <[email protected]> wrote:

    That's not been my experience. Windows installers for Python have
    worked well for me over many generations of Python releases. It's Linux >> where I've found difficulties. For example, if your distro's Python
    install didn't include tkinter (or even pip), how do you get it? It's
    different for different Linux distros. I generally have to use internet >> searches to find out.

    If you want to use your distro's Python and add more stuff to it
    globally, then yes, it depends on your distro. This is not really a surprise.

    For another example, when you use pip to install a package, it sometimes >> suggests that you install a newer version of pip itself. Should you do
    that? On Linux, probably not, because the distro will have modified pip >> so it puts things in distro-specific places. Yet there is no newer
    version of pip available through the distro's package manager. Will
    anything bad happen if you don't update pip? Who knows?

    Virtual environments work the same way regardless of distro, including allowing you to install an upgraded pip.

    I have always disliked working with venvs and avoid it whenever
    possible. But I suppose that's just me.


    That's fine. You don't HAVE to use venvs - and in fact, I only use
    them for a relatively small number of projects (eg those that get
    deployed to Heroku - make a venv, match Python version to Heroku's
    offering, and install packages into it, for maximum consistency).
    There are a few ways to manage things:

    1) Always use your package manager. Don't use pip at all.
    2) Install pip from your package manager, but then do user
    installations (~/.local).
    3) Install venv from your package manager, use virtual environments everywhere. 4) Build Python from source, parallel to your system Python.
    5) Some combination of the above.

    As you saw from my tab-tab demo, I have a LOT of Pythons installed,
    many of them alphas and betas. Right now, my 'python3' command is
    3.12, but /usr/bin/python3 is the system Python (3.9.2) and has
    packages managed by apt/dpkg. So when a system-installed script tries
    to run, it finds the Python and packages that were curated by the
    Debian folks; but if I, at the command line, type "python3
    somescript.py", I get a newer Python with packages managed by pip.
    Sometimes I'll install those with "sudo python3 -m pip install X", but
    mostly without sudo, and they land in ~/.local. (Installing as root is
    useful when I need other users to be able to run the script - it's a
    pain to try to install something into the correct low-privilege user.)

    You have options. There's nothing wrong with picking and choosing
    according to what's convenient for you.

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Angelico@21:1/5 to Peter J. Holzer on Tue Dec 20 04:15:07 2022
    On Tue, 20 Dec 2022 at 03:56, Peter J. Holzer <[email protected]> wrote:

    It is however, quite noticable that almost everyone who asks a question
    about their Python installation on this list is using Windows. I don't
    think this is just because there are more Windows users than Linux or
    Mac Users.

    Yes. I think there are a few reasons for that. One is that there are
    many many lazy people in the world, and those people are likely to (a)
    use the OS that came with their computers - usually Windows or Mac OS;
    and (b) ask a question on a mailing list rather than spend some extra
    minutes figuring things out with some web searches. An unrelated cause
    might be a large number of student and/or novice programmers, who
    simply don't have the groundwork knowledge to figure these things out;
    and, again, they'll be using whatever OS their systems come with. Why
    don't we see more Mac questions, then? No idea, and I'm not a Mac
    person so I can't judge, but I would guess it's just a matter of
    numbers - Windows outnumbers Mac OS (not counting iOS, which people
    don't tend to be installing Python on) by a fairly significant factor.

    I have a Linux VM that has several versions of Python3 on it. Python3.8 came installed with the distro, but for some programs I need Python 3.9+. If I forget which versions I have, how can I find out?

    I type python and then ctrl-D. The shell will then show me all commands starting with "python" in my path (your shell may have a different key combination for that, maybe tab-tab).

    Ah, interesting. When I mentioned tab-tab I was aware that there are
    others, but I'm not familiar with Ctrl-D. Normally that means "send
    the command as it is", so I assume your shell is set up to take an
    unfinished command and tab-complete it. Which shell is that?

    (Also - what happens if you Ctrl-D in the middle of a line? Does that work?)

    But that works only for Python. Shell expansion works for any command.
    If you use Linux, learn how to use your shell (and maybe learn different shells - I personally prefer zsh, but I can also use bash, ksh, tcsh and
    if necessary even sh).

    I agree, although I wouldn't recommend trying to get too much out of
    sh as an interactive shell. It's best aimed at low-overhead script
    running, and configured accordingly. Though it's sometimes good to
    have some familiarity with a low-powered shell and the most basic of
    input methods, just in case you're ever thrust into a situation where
    a hard drive has crashed, /bin/bash is corrupted, you don't have
    convenient access to external boot media, and you just want to get the
    network interface up so you can do some basic fixes or data
    recovery...

    (Never been in precisely that situation, but I have had other key
    programs unavailable for various reasons, and it's handy to know
    alternatives!)

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Peter J. Holzer@21:1/5 to Chris Angelico on Mon Dec 19 19:14:47 2022
    On 2022-12-20 04:15:07 +1100, Chris Angelico wrote:
    On Tue, 20 Dec 2022 at 03:56, Peter J. Holzer <[email protected]> wrote:
    It is however, quite noticable that almost everyone who asks a question about their Python installation on this list is using Windows. I don't think this is just because there are more Windows users than Linux or
    Mac Users.

    Yes. I think there are a few reasons for that. One is that there are
    many many lazy people in the world, and those people are likely to (a)
    use the OS that came with their computers - usually Windows or Mac OS;

    Yeah. But also on Linux you never have to set up Python. It's just
    there, ready for use (a few years ago, when Python2 way still the
    default, you might have had to "apt install python3"[1] but that's it).
    So the lazy Linux users never run into these problems.

    I have a Linux VM that has several versions of Python3 on it. Python3.8 came installed with the distro, but for some programs I need Python 3.9+. If I forget which versions I have, how can I find out?

    I type python and then ctrl-D. The shell will then show me all commands starting with "python" in my path (your shell may have a different key combination for that, maybe tab-tab).

    Ah, interesting. When I mentioned tab-tab I was aware that there are
    others, but I'm not familiar with Ctrl-D. Normally that means "send
    the command as it is",

    It means that only in cooked mode. Since an interactive shell has to
    switch the terminal into cbreak or even raw mode anyway, it can mean
    whatever the the shell wants it to mean.

    so I assume your shell is set up to take an unfinished command and tab-complete it. Which shell is that?

    zsh (with vi keybindings, although I think ctrl-D works the same with
    emacs keybindings).

    (Also - what happens if you Ctrl-D in the middle of a line? Does that work?)

    Yes. For example if I type "ls foo", dann move the cursor back after
    "ls" and type " --co^D", I get:

    % ls --co foo
    --color -- control use of color
    --context -- print any security context of each file

    If I then type tab, it cycles through the options. If I select --color=
    and type ^D again, I get

    % ls --color= foo
    always auto never

    Etc.

    Debian/Ubuntu contains a ton of predefined expansions for zsh. Many of
    them are very context specific and invoke other commands to figure out
    the actual options (I guess that it actually invokes ls --help to find
    the options of help, and for psql it definitely checks which users or
    databases a local postgres installation has to provide you with sensible options at the appropriate position in the command line. There's also
    remote filename expansion for scp and rsync, etc.)


    But that works only for Python. Shell expansion works for any command.
    If you use Linux, learn how to use your shell (and maybe learn different shells - I personally prefer zsh, but I can also use bash, ksh, tcsh and
    if necessary even sh).

    I agree, although I wouldn't recommend trying to get too much out of
    sh as an interactive shell.

    Yeah. If I happen to login to an account which has /bin/sh as the login
    shell I'll invoke a different shell if I have to type more than 3 or 4
    commands (and there is an alernative installed on the machine, which
    these days is usually the case). But when I started to use Unix, the
    Bourne shell was all there was. If you were lucky, there might have been
    a csh, too, but that didn't use cursor keys either. At least it had a
    history and you could use ! escapes to access it (I still use those in
    zsh and bash).

    hp

    [1] Or use yum or zypper or whatever, or your GUI package manager if
    that's your thing.

    --
    _ | Peter J. Holzer | Story must make more sense than reality.
    |_|_) | |
    | | | [email protected] | -- Charles Stross, "Creative writing
    __/ | http://www.hjp.at/ | challenge!"

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmOgqhIACgkQ8g5IURL+ KF2/xxAAqXtxIjdPiYb3yXWSy5wgN01bmLGtotvpyYaLZCAd2PqjkI7he3l5Zpfb /dOgMtErzq9loywHdU04xPbe65/G1IgHzhniW5f8W8CEo39cAVXWQKwoaEuTQZ2H VgvkbVkIfQbzojNUaH7FVwm5ExSwx0PNz45sLesTVyb8aqJXpXymzXiyF/xGJCR0 xQxfUHlaSEzXh5TOE+Ntt5dQFyCoEHnFuSuYnV76eApRT8WxXGie8txDhPrvjuxA hUQJ6pk+Ya2QaKS9lxDxoxT4VCBThUVojo4zRQRH1IhXihoZN3dl/OQIqX3mTU5G ewmLsZJ+jDZKnwB6jLi6zCivpYQ72bypsuERGSonMQ7aiKCSkcO7NZfYf8SPtaAJ 0QWXjS2j7u+9xb2DuPXGSyfXZ4tsBx/CaTvh5cPAu5Fa9XnNmiK8K1Gurq8fXP3S HG8DuL4Jm0uiJMkUelTUFrV4XeaWOFObPP1Mlp+tzE8TLFyQEJCqJRfmWUhRqVyj U7rdTFwsfaw4fz3pl/g2+ubYK73/U0fZVQeOwgCCLTTJaiCaTAbSywrUFWAFr0tV G4RC83okLwkhRhaKkGB4frJO4d5WE1BWyCyaJdKuWnyKhQeP+nlFZbiB2qyyoM+g NTAy70Bqd2knDyFsPWQyH1S/Made1OKorptaK4C
  • From Weatherby,Gerard@21:1/5 to Gerard on Mon Dec 19 20:51:10 2022
    I was suggesting a possible resource while making it clear I am not Windows savvy. My avoidance of Windows has nothing to do with Python, so there is no need to discuss it here.

    If I don�t care which Python I�m using, I�ll type python3. If I want3.9, python3.9. python3 -V tells me the default on that system. (It varies across our servers).

    If a Python package isn�t available in the mainline Ubuntu repository (python3-whatever), I�m creating a virtual environment. It just saves trouble in the long run. I have this in ~/bin to create an environment. I�m slowly moving projects to the
    pyproject.toml because pip is complaining about the setup.py installs.


    #!/bin/bash
    VERS=3.8 #default version
    VENV=venv #default environment name
    if [ $# -gt 0 ]; then
    VERS=$1
    fi
    if [ $# -gt 1 ]; then
    VENV=$2
    fi
    PYTHON=python$VERS
    echo $PYTHON
    $PYTHON -m venv $VENV
    ./$VENV/bin/pip install -U pip ipython
    if [ -e requirements.txt ]; then
    ./$VENV/bin/pip install -r requirements.txt
    fi
    if [ -e setup.py ]; then
    ./$VENV/bin/python setup.py install
    fi
    if [ -e pyproject.toml ]; then
    ./$VENV/bin/pip install -e .
    fi

    From: Python-list <python-list-bounces+gweatherby=[email protected]> on behalf of Thomas Passin <[email protected]>
    Date: Monday, December 19, 2022 at 11:05 AM
    To: [email protected] <[email protected]>
    Subject: Re: Installation hell
    *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

    On 12/19/2022 9:59 AM, Weatherby,Gerard wrote:
    Personally, I don�t use Windows and avoid it like the plague. Python is easy to install on Linux and Mac.

    That's not been my experience. Windows installers for Python have
    worked well for me over many generations of Python releases. It's Linux
    where I've found difficulties. For example, if your distro's Python
    install didn't include tkinter (or even pip), how do you get it? It's different for different Linux distros. I generally have to use internet searches to find out.

    For another example, when you use pip to install a package, it sometimes suggests that you install a newer version of pip itself. Should you do
    that? On Linux, probably not, because the distro will have modified pip
    so it puts things in distro-specific places. Yet there is no newer
    version of pip available through the distro's package manager. Will
    anything bad happen if you don't update pip? Who knows?

    I have a Linux VM that has several versions of Python3 on it. Python3.8
    came installed with the distro, but for some programs I need Python
    3.9+. If I forget which versions I have, how can I find out? People
    say to use which, but that doesn't work - it only reports "python3".
    This does work, but it's not all that easy to remember (the grep "site"
    part is just to filter out uninformative result lines):

    ~$ find 2>/dev/null ~ -name python -type d |grep "site" /home/tom/.local/lib/python3.9/site-packages/PyQt5/Qt5/qsci/api/python /home/tom/.local/lib/python3.8/site-packages/pandas/_libs/src/ujson/python /home/tom/.local/lib/python3.10/site-packages/PyQt5/Qt5/qsci/api/python

    Not that this task is much easier to remember on Windows, but it's not
    harder. One way: the "py" launcher will tell you:

    py --list
    -V:3.10 * Python 3.10 (64-bit)
    -V:3.9 Python 3.9 (64-bit)
    -V:3.7 Python 3.7 (64-bit)
    -V:2.7

    This is not Linux-bashing, but there's no need for Windows-bashing either.

    I�d start here: https://learn.microsoft.com/en-us/visualstudio/python/overview-of-python-tools-for-visual-studio?view=vs-2022

    From: Python-list <python-list-bounces+gweatherby=[email protected]> on behalf of Jim Lewis <[email protected]>
    Date: Sunday, December 18, 2022 at 12:56 PM
    To: [email protected] <[email protected]>
    Subject: Fwd: Installation hell
    *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

    I'm an occasional user of Python and have a degree in computer science. Almost every freaking time I use Python, I go through PSH (Python Setup Hell). Sometimes a wrong version is installed. Sometimes it's a path issue. Or exe naming confusion: python, python3, phthon311, etc. Or library compatibility issues - took an hour to find out that pygame does not work with the current version of python. Then the kludgy PIP app and using a DOS box under Windows with command prompts which is ridiculous. God only knows how many novice users of the language (or even intermediate users) were
    lost in the setup process. Why not clean the infrastructure up and make a modern environment or IDE or something better than it is now. Or at least good error messages that explain exactly what to do. Even getting this
    email to the list took numerous steps.

    -- A frustrated user
    -- https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!gdOs-oC1JZcmvMXy1G4irRpzHCUmF565UXVdCjzSWNGZKpmZ04I_llDX4WUeob3asBCjLe6TIthAAhmwFgbph9u1m9A$<https://urldefense.com/v3/__https:/mail.python.org/mailman/
    listinfo/python-list__;!!Cn_UX_p3!gdOs-oC1JZcmvMXy1G4irRpzHCUmF565UXVdCjzSWNGZKpmZ04I_llDX4WUeob3asBCjLe6TIthAAhmwFgbph9u1m9A$><https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!gdOs-
    oC1JZcmvMXy1G4irRpzHCUmF565UXVdCjzSWNGZKpmZ04I_llDX4WUeob3asBCjLe6TIthAAhmwFgbph9u1m9A$%3chttps:/urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!gdOs-oC1JZcmvMXy1G4irRpzHCUmF565UXVdCjzSWNGZKpmZ04I_
    llDX4WUeob3asBCjLe6TIthAAhmwFgbph9u1m9A$%3e>

    -- https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!jE6AjIj87dxZUxuKQ6JNejqfM89fMIn9dCawvy3MAsC1Y9K1LVekL9Vxn1dNntu2VNPzdvehOKAEpOjyhEQ$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-
    list__;!!Cn_UX_p3!jE6AjIj87dxZUxuKQ6JNejqfM89fMIn9dCawvy3MAsC1Y9K1LVekL9Vxn1dNntu2VNPzdvehOKAEpOjyhEQ$>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eryk Sun@21:1/5 to Jim Lewis on Mon Dec 19 15:47:30 2022
    On 12/18/22, Jim Lewis <[email protected]> wrote:

    Sometimes it's a path issue.

    For whatever reason, Python installations on Windows lack versioned
    executable names (except for the Microsoft Store distribution). Thus
    adding multiple installations to PATH doesn't help unless "python.exe"
    is manually linked or copied to versioned names, e.g. "python3.11.exe"
    "python.exe" and "python3.exe" -> "python.exe". In this case, the
    first installation in PATH is the default for running "python" and
    "python3".

    Using the "py.exe" launcher is the more general and preferred
    solution. It allows running any registered Python installation. It's
    also the installed handler for the ".py" file type, and it supports
    Unix-style shebangs.

    Or exe naming confusion: python, python3, phthon311, etc.

    I don't understand what's supposedly confusing here. Here are some
    commands to help discover what "py" or "python" commands and
    installations are available.

    * CMD: where py*.exe
    * PowerShell: get-command py*.exe
    * Python launcher: py --list-paths

    Or library compatibility issues - took an hour to find out that
    pygame does not work with the current version of python.

    It should be a trivial task to discover that wheel packages for pygame
    aren't currently available for Python 3.11. It is not unreasonable to
    expect Python developers to familiarize themselves with pip and PyPI.

    If you search a bit deeper, you'll find a site with unofficial Windows
    builds of many packages, including pygame for Python 3.11:

    https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

    Otherwise, while building some packages from source can be quite
    involved and difficult, I'd expect anyone with a degree in computer
    science to be able to build pygame if necessary. They even provide a
    simple guide:

    https://www.pygame.org/wiki/CompileWindows

    Then the kludgy PIP app and using a DOS box under Windows with
    command prompts which is ridiculous.

    How is pip "kludgy" (i.e. sloppy, hasty, shoddy, or inelegant)? How is
    using a command-line interface "ridiculous"? Many programmers and
    system administrators actually prefer using command-line interfaces
    and text user interfaces (TUI) for many if not most development and administration tasks. It's a matter of opinion.

    ---

    Nerdy operating system discussion...

    using a DOS box under Windows

    The term "DOS box" refers to a virtual machine running 16-bit MS-DOS
    in virtual 8086 (v86) mode under Windows 3.1 or Windows 9x, with the
    MS-DOS keyboard and display drivers hooked to redirect I/O to a
    desktop window. There is no "DOS box" in Windows NT systems. Windows
    client systems switched to NT starting with Windows XP. Thus the term
    "DOS box" is about two decades out of date.

    Also, "DOS" is not synonymous with a command-line interface shell
    (e.g. the 16-bit MS-DOS shell, "COMMAND.COM"). A "Disk Operating
    System" is one that supports disk drives and filesystems, which
    includes most operating systems from the late 1960s onward (e.g.
    DOS/360 from 1966). There were several DOS systems for personal
    computers in the 1980s, such as Apple ProDOS, Atari DOS, Tandy TRSDOS, Commodore DOS, and Microsoft MS-DOS. A DOS system can use a graphical
    shell, such as running Windows 1.0 (1985) on MS-DOS.

    The "python.exe" exec
  • From Mats Wichmann@21:1/5 to Eryk Sun on Mon Dec 19 15:28:12 2022
    On 12/19/22 14:47, Eryk Sun wrote:

    If you search a bit deeper, you'll find a site with unofficial Windows
    builds of many packages, including pygame for Python 3.11:

    https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
    Semi-OT: that's been a superb resource, but apparently it's no longer maintained - internet scuttlebutt suggests the project which let it
    exist has lost funding. The link above is a mirror, marked "Archived",
    and I can't see there's been any addition since July 1. (sadly... I
    happen to need an lxml build for experimenting with 3.12 alphas, and
    that's an absolute bear to build for WIndows - I've never cracked it)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [email protected]@21:1/5 to Chris Angelico on Thu Dec 22 10:02:41 2022
    On 2022-12-19, Chris Angelico <[email protected]> wrote:

    There are a few ways to manage things:

    1) Always use your package manager. Don't use pip at all.

    If doing Linux work but your boss only knows Windows
    and tells you to use pip that's a human problem rather
    than a computer problem.

    Delete his email without replying about the Christmas party
    and if anyone asks refer to him as "Roger who?".

    Using the package manager should take care of updates.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)