multiple python versions

multiple python versions

Yedidyah Bar David linux-il at didi.bardavid.org
Mon Jul 26 10:47:09 IDT 2021


On Thu, Jul 22, 2021 at 8:31 PM Shlomo Solomon <shlomo.solomon at gmail.com> wrote:
>
> OK - to sum up:
> 1 - thanks to Omer and Dan
> 2 - it seems that I did understand the concept of virtual environments
> - as I wrote in my original post:
> > I know I can use venv to set up virtual environments for different
> > versions, but although I haven't tried it, I don't see how that would
> > solve the problem.
> 3 - based on the answers you both wrote, there's no solution to the
> "problem" of having to re-install modules.
> 4 - and it's probably not a good idea to try :-)

That's the main point, not that there is no solution. If you want to
try to enforce use of modules from the other version, you can use
PYTHONPATH and/or sys.path, or even play with importlib. But it
remains a bad idea, unless you have very specific needs - not a
mere "trying to save time".

Best regards,

> 5 - based on all of the above, I'll probably pass on the idea of using
> 2 versions and wait for Kubuntu to move to 3.9, which will probably not
> be too far in the future.
>
> Again - thanks
>
>
>
> On Thu, 22 Jul 2021 20:07:20 +0300
> Omer Zak <w1 at zak.co.il> wrote:
>
> > FALSE ECONOMICS ALERT!
> > FALSE ECONOMICS ALERT!
> > FALSE ECONOMICS ALERT!
> >
> > You say that "most modules DO work when moving to a newer version of
> > Python".
> > However when they do not work, it is a lot of work diagnosing the
> > problem and finding which module needs to have both versions installed
> > in parallel.
> >
> > It is better to spend the (relatively short and predictable) time
> > maintaining a full virtualenv for each project. And if you are short
> > on disk space, then today's disks are big and inexpensive - much less
> > expensive than the time you spend trying to save few megabytes by not
> > installing parallel versions.
> >
> >
> >
> >
> > On Thu, 2021-07-22 at 20:02 +0300, Shlomo Solomon wrote:
> > > On Thu, 22 Jul 2021 19:50:46 +0300
> > > Omer Zak <w1 at zak.co.il> wrote:
> > >
> > > > Why do you want to avoid having to re-install modules for each
> > > > version/environment?
> > > >
> > > The short answer: too much work
> > >
> > > The slightly longer answer: Although there are certainly changes
> > > between versions of Python and/or modules, most modules DO work when
> > > moving to a newer version of Python. I don't remember re-installing
> > > everything when upgrading to a newer version of Python.
> > >
> > > But here, my problem is not upgrading, but keeping both versions.
> > >
> > >
> > >
> > >
> > > > In the general case, a module version is compatible only with a
> > > > subset
> > > > of Python versions, due to API changes from Python version to
> > > > Python
> > > > version.
> > > >
> > > > You also want to let each project decide with which module version
> > > > it
> > > > wants to work, due to potential incompatibilities between module
> > > > versions (it is no accident that pip freeze preserves installed
> > > > module
> > > > versions).
> > > >
> > > >
> > > > On Thu, 2021-07-22 at 19:37 +0300, Shlomo Solomon wrote:
> > > > > Omer Zak <w1 at zak.co.il> wrote:
> > > > > > The answer to your prayers is pyenv.
> > > > > > It allows you to install multiple Python versions in parallel,
> > > > > > and
> > > > > > for
> > > > > > each version you can maintain several virtualenvs.
> > > > >
> > > > > Dan Yasny <dyasny at gmail.com> wrote:
> > > > > > How about using virtualenv for alternative versions?
> > > > >
> > > > > Yes, I know about pyenv and virtualenv, but wouldn't I have to
> > > > > re-install modules for each version/environment? That's what I'm
> > > > > trying
> > > > > to avoid.
> > >
> > >
>
>
>
> --
> Shlomo Solomon
> http://the-solomons.net
> Claws Mail 3.17.5 - KDE Plasma 5.18.5 - Kubuntu 20.04
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il



More information about the Linux-il mailing list