[Python-ideas] Looking for input to help with the pip situation

Ivan Pozdeev vano at mail.mipt.ru
Mon Nov 6 09:06:08 EST 2017


On 06.11.2017 9:47, Michel Desmoulin wrote:
> Hello,
>
> Today I'm going to give a training in Python again.
>
> And again it will go the same way.
>
> On Mac I will have to make people install python, then tell them to use
> pip3.
>
> On Windows, I will have to warn them about checking the "add python
> executable to system path" (that one of them will ALWAYS miss anyway).
> Then tell them to use py -3.x -m pip because some of them will have
> several versions of Python installed.
>
> Then on linux, I will tell them to install python-pip and python-venv
> and use python3 -m pip.
>
> I'll talk about --user, but commands won't be usable on some machine
> where the Scripts or bin dir is not in the system path.
>
> Then I will make them create a virtualenv so that they can avoid messing
> with their system python and finally can just use "pip install" like in
> most tutorials on the Web.
>
> And eventually I'll talk about pipenv and conda. The first one so they
> don't have to think about activating the virtualenv everytime, or pip
> freeze, or create the venv, or add it to gitignore, etc. The second
> because anaconda is very popular on windows.
>
> There is no way a beginner is going to get any that by themselves
> without a lot of time and pain. They will read some tutorial on the web
> and struggle to make sens of what pip is and why "pip install" doesn't
> work and why "python sucks".
I don't see anything particularly bogging here.
It's always like this when you have multiple versions of the same 
software on the system. There's only one PATH, after all.

Heck, *the mere fact that Python allows to work like this is already a 
huge leap forward.* **Doing this cross-platform with exactly the same 
steps is something few could believe was even possible a couple of years 
ago!**

With most other software packages, it's either not possible at all (and 
an installer for a different version of a package requires uninstalling 
the existing version first), or you need to compile everything from 
source with custom --prefix or something -- and deal with dependency 
hell looming over your head when they unexpectedly override some system 
components, or have to specify paths all the time.

This is why system package managers in Linux distributions are such a 
huge help -- as long as you're using the same repository (or a 
closely-knitted group thereof), you're supposed to have a sane 
environment whatever packages you install, with nothing overriding 
anything else.


To simplify things with Python, i do the following:
* use the system's Python whenever possible
* if using something else, only install the one version/environment that 
I'm using day-to-day and add it to PATH (system's if safe & convenient, 
personal otherwise)
* prefer the system's/environment's package manager to pip to install 
3rd-party modules, too, if there is one.

For personal day-to-day use, it's very rarely critical to use precisely 
specific versions of Python and packages.
For commerical use, I'll either mainly use one environment still (the 
one my production or my client has), or have to deal with multiple 
environments anyway, or set a up a dedicated CI server/environment and 
leave its scripts to deal with them.

> I think Python is offering an incredible experience for first timer.
> However, the whole "where is walpip" shenanigans is not one of them.
>
> I really want some people from this list to discuss here so we can find
> a way to either unify a bit the way we install and use pip, or find a
> way to express a tutorial that always works for people on the most
> popular platforms and spread the word so that any doc uses it.
>
> Michel
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

-- 
Regards,
Ivan



More information about the Python-ideas mailing list