PythonPath / sys.path

Chris Angelico rosuav at gmail.com
Mon May 15 03:28:46 EDT 2023


On Mon, 15 May 2023 at 14:38, Thomas Passin <list1 at tompassin.net> wrote:
>
> On 5/14/2023 11:08 PM, Chris Angelico wrote:
> > On Mon, 15 May 2023 at 12:07, Thomas Passin <list1 at tompassin.net> wrote:
> >> Well, no, why would you assume that?  I started to use Linux - in VMs -
> >> because I had to make sure that my cross-platform java/jython Tomcat
> >> program would work right on Linux.  Why, for example, would I think to
> >> install Idle from the package manager when it, or things like that, were
> >> always in my experience installed with pip? For that matter, "sudo
> >> apt-get install pip" won't install pip.  You need to use a different
> >> name, and it may or may not be different for different distros.
> >
> > If you EVER had to install something other than a Python package, you
> > would have had to make use of the system package manager. You're
> > right, there are multiple obvious ways to install Idle, but that
> > doesn't mean that the package manager isn't one of them.
>
> Yes, after a while I came to realize that missing Python pieces might be
> available from the package manager.  That doesn't mean it's obvious, or
> easy to discover just what names to use.

Define "obvious". Nothing is completely intuitive, and at some point,
you HAVE to learn things. With any modern GUI desktop system, I am
going to assume that "click on the thing" counts as obvious, even
though it, like everything else, has to be learned. Once it's been the
exact same UI for everything so far, wouldn't it count as obvious?

Use your package manager.

> And sometimes one has to add a
> new external repository.

Why? When do you need to? Use the system package manager and the core
repositories.

> Personally, I don't find it easy to scroll
> through hundreds of lines in the synaptics search results looking for
> something whose name I can only partly guess at.

I don't use Synaptic, so I have no idea what the problem is here, but
there are really only a couple of plausible package names:

1) idle
2) python-idle

It's possible you'll need to install idle3 or python3-idle to get the
latest, but if so, one of the above names would have installed Idle
from Python 2.7.

This is a matter of learning patterns, which most humans are good at.
But even if you haven't yet, your absolute worst case is a
straight-forward search ("apt-cache search idle", "apt search idle",
or using a GUI tool to search). Assuming you haven't added every
repository you can find, in a wild attempt to worsen your computer's
stability and security, this should produce roughly a hundred results
(I got 123 on my search), many of which are clearly not what you want.
This is really not that many to skim over.

> If I know the command
> line equivalent for a search, I could do a grep and that would probably
> be more focused.

Did you try searching the web for "apt search for package" or anything
like that? The command is "apt search" or "apt-cache search" (they're
slightly different in output but they'll give broadly the same info)
and this information is easily found on the internet.

> But trying to work with a dozen different distros
> because various clients might use them - it's hard to keep details straight.

Okay, that's fair. You should only have to work with a small number of
package managers, but the more different the distros are, the less
effective you'll be at intuitively guessing the package names. But you
should still be able to search.

> Anyway, there's no point in trying to convince me that I could have
> understood everything at the start that I may have learned later.  I'm
> just interested in passing on things I've learned along that way that a
> newcomer to Python in Linux may not realize.

I'm not saying you should have understood everything at the start; but
I am saying that all the answers are out there if you look for them.
Making blanket statements like:

> Ubuntu, like many other Linux distros,
> does not come with pip and Tk (needed for Idle) installed, and it's not
> so obvious how to install them.

are *EXTREMELY* unfair, since you are naming a single distro and then
blaming "many other" distros by association, giving the highly false
impression that Linux is nearly impossible to use.

It is, in fact, very easy to install these things on many Linux
distros. You just have to be willing to get to know your own system
(since most people are only running one distro).

ChrisA


More information about the Python-list mailing list