Installation hell
Thomas Passin
list1 at tompassin.net
Mon Dec 19 12:06:38 EST 2022
On 12/19/2022 11:36 AM, Chris Angelico wrote:
> On Tue, 20 Dec 2022 at 03:05, Thomas Passin <list1 at tompassin.net> 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 at 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 at 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
More information about the Python-list
mailing list