Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Current Python Version Selection
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
jagdpanther
l33t
l33t


Joined: 22 Nov 2003
Posts: 763

PostPosted: Wed Oct 23, 2024 1:35 am    Post subject: [solved] Current Python Version Selection Reply with quote

I know that "eselect python" is the old way to select python versions. Also according to https://wiki.gentoo.org/wiki/Python "eslect python" still is a wrapper to /etc/python-exec/python-exec.conf. The only uncommented lines in my /etc/python-exec/python-exec.conf are:
Code:
python3.12
python3.11


So why is my gentoo system reporting that it will remove python-3.11 when I run "emerge --depclean -p" ?

(I want to keep python-3.11 because I have some 3rd party stuff, stable diffusion, that currently uses python-3.11.)

Where is the documentation for the current proper way to tell Portage to keep a specified version of Python?

Thanks.


Last edited by jagdpanther on Wed Oct 23, 2024 2:45 am; edited 1 time in total
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 381

PostPosted: Wed Oct 23, 2024 2:30 am    Post subject: Reply with quote

Either your @world does not mention dev-lang/python or it has no version nor slot specification.
Your entire system can be rebuilt with just python 3.12, so portage is fine with trying to remove python 3.11.
python-exec.conf is not in this equation at all.

What you can do is add python 3.11 to your world set. emerge -u python:3.11 should do the trick.
That way, some version of python 3.11 will remain in your @world set.
Back to top
View user's profile Send private message
jagdpanther
l33t
l33t


Joined: 22 Nov 2003
Posts: 763

PostPosted: Wed Oct 23, 2024 2:44 am    Post subject: Reply with quote

bstaletic:

Thank you. Your suggestion fixed the issue.
(And you were correct, I checked /var/lib/portage/world and there were no dev-lang/python:3.x entries.)
Back to top
View user's profile Send private message
jagdpanther
l33t
l33t


Joined: 22 Nov 2003
Posts: 763

PostPosted: Sun Oct 27, 2024 6:01 pm    Post subject: Reply with quote

Quote:
python-exec.conf is not in this equation at all.


I guess I did not read that statement properly: I commented out the two lines in /etc/python-exec/python-exec.conf from my original post. Everything seemed to work fine. Then python3.13 was pushed out via portage but is not the system python. I then tried to run pithos and received:

Code:
Traceback (most recent call last):
  File "/usr/bin/pithos", line 8, in <module>
    from gi.repository import Gio
ModuleNotFoundError: No module named 'gi'


media-sound/pithos-1.6.2 is a python script launched with
Code:
#!/usr/bin/env python3


With all lines commented out in python-exec.conf I get:
Code:
$ eselect python list
Available Python interpreters, in order of preference:
  [1]   python3.13 (fallback)
  [2]   python3.12 (fallback)
  [3]   python3.11 (fallback)


So I changed python-exec.conf to:
Code:
python3.12
python3.13
python3.11


Which fixes the issue and now have:
Code:
$ eselect python list
Available Python interpreters, in order of preference:
  [1]   python3.12
  [2]   python3.13
  [3]   python3.11


Is modifying /etc/python-exec/python-exec.conf the current Gentoo suggested method of choosing which python3 is run by default?
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2460

PostPosted: Sun Oct 27, 2024 6:16 pm    Post subject: Reply with quote

bstaletic wrote:
emerge -u python:3.11 should do the trick.


emerge --norepalce should have done the trick. There's no need to recompile something that's already there.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum