Welcome to CRUX bug tracking.

FS#1339 - Switch to Python3

Attached to Project: CRUX
Opened by Ryan Mullen (rmull) - Wednesday, 31 August 2016, 21:08 GMT
Last edited by Juergen Daubert (jue) - Friday, 16 October 2020, 10:59 GMT
Task Type Feature Request
Category ports → core/opt
Status Closed
Assigned To Juergen Daubert (jue)
Operating System CRUX
Severity Low
Priority Normal
Reported Version 3.2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No


I would like to investigate the move from python2 to python3 as the default CRUX python.

During my tests, I am using 6c37/python3 as my python3 release (

My symlinks:

/usr/bin/python -> /usr/bin/python3 -> /usr/bin/python3.5
/usr/bin/python-config -> /usr/bin/python3-config -> /usr/bin/python3.5m-config

This issue will be a log of my progress. Platform is Intel Core i5 with basic graphical laptop environment (browser, multimedia, not much else).


0. Configure symlinks
1. Get a list of everything I have installed:

prt-get listinst > packages.txt

2. Delete python and python3 from that list. Here is my packages.txt:
3. Walk through the file and rebuild each entry. Break if an error is encountered.

for i in $(cat packages.txt); do
prt-get -fr update $i
if [ $? -ne 0 ]; then

4. If the script exits before the list is exhausted, delete the completed entries from the package list, fix the offending package, and restart the build with the shortened list.


1. A smattering of footprint mismatches, but those don't count as actual changes/breakages IMO
2. contrib/docutils hardcodes python2 paths in the Pkgfile
This task depends upon

Closed by  Juergen Daubert (jue)
Friday, 16 October 2020, 10:59 GMT
Reason for closing:  Implemented
Additional comments about closing:  Python 3.9 is a core-port as of CRUX 3.6
Comment by James Mills (prologic) - Monday, 05 September 2016, 19:15 GMT
Given the state of Python 3 today I see no reason why this can't happen. Python 2.7 is slated to be deprecated and maintenance stopped in 2020.

However *be aware* that this is a significant change and that nearly all ports that build packages of Python 2 libraries/tools will likely fail without having the interpreter they use in their build() functions changed to something like /usr/bin/env python2
Comment by Fredrik Rinnestam (frinnst) - Monday, 05 September 2016, 21:02 GMT
>Python 2.7 is slated to be deprecated and maintenance stopped in 2020.

Good. lots of time then :-)

Reassigning to Juergen since it's his port.
Comment by Ryan Mullen (rmull) - Tuesday, 06 September 2016, 13:28 GMT
James, can you identify some of the ports that may break after the switch to python3? Maybe there is a way we can fix them now (like specifically invoking python2) that will remain valid after switching to python3.
Comment by Ryan Mullen (rmull) - Tuesday, 06 September 2016, 18:02 GMT
contrib/mercurial appears to be one port that is affected by the switch to python3. Here is an updated Pkgfile that will work:

The official statement regarding Python3 support from the Mercurial people is here:
Comment by James Mills (prologic) - Wednesday, 07 September 2016, 02:13 GMT
Yeah any ports that point to /usr/bin/env python or /usr/bin/python will have to change, more importantly if they were not built/designed/maintained with Python 2/3 compatibility in mind.
Comment by Ryan Mullen (rmull) - Wednesday, 07 September 2016, 15:12 GMT
contrib/pip is another that we should look at. A "correct" system should probably have pip2, pip2.7, pip3, pip3.5, and pip in /usr/bin, with pip using the system interpreter.
Comment by Juergen Daubert (jue) - Thursday, 08 September 2016, 11:30 GMT
Sorry, but I don't have the time to look closer into this right now, so I'd say a change to python3 will not happen for CRUX 3.3.
I don't have any general objections to do the switch, if we do not end up with mostly every user has to install both versions. But if I look at Arch's "Required By" list I'm not really optimistic. I see there tools like e.g. samba and lots of others.

But we will see and fortunately we are not in hurry ;)
Comment by Predrag Ivanovic (pedja) - Friday, 16 December 2016, 19:34 GMT
This might be handy if you are wondering if your favorite Python modules work yet

IMHO, this is similar to gtk2/gtk3 or qt4/qt5 situation.
Import Python3/py3-pip/py3-setuptools to opt, but keep Python2 as default, and then, as upstream packages
gradually transition, modify the ports.
So the work, breakage and pain are spread over the period of time :)
When most (for arbitrary value of 'most') core/opt/xorg ports build/work with python3, make it default, and
patch/drop/replace the special snowflakes that remain.
Or gently push users that still need python2 at that point to something like Anaconda/Miniconda[1] :)