Put python3 from the system before python3 from dev-utils/bin in the PATH
Needs ReviewPublic

Authored by albertvaka on Mar 7 2019, 10:06 AM.


Group Reviewers

For me, when craft tries to update python, it fails because the binary is
in use by craft itself. This patch aims to fix that, by using the python3
binary specified in CraftSettings.ini

Diff Detail

R138 Craft
No Linters Available
No Unit Test Coverage
Build Status
Buildable 12003
Build 12021: arc lint + arc unit
albertvaka requested review of this revision.Mar 7 2019, 10:06 AM
albertvaka created this revision.

I'm not sure this is the good solution, or if something is broken in my setup and I'm the only one experiencing this problem.

kfunk added a subscriber: kfunk.Mar 7 2019, 10:23 AM

FTR: I think I experienced the same or a similar issue.

I had it too.
Your issue is on Windows? Actually craft should use the one from the settings directly and not python from the path.

Yes, the issue happens on Windows. And I think it always happens, because the line before the one I added reads: "prefix the path with dev-utils/bin"... and Craft's python3.exe is installed right there.

Any update on this? Is it good to merge?

Sorry, forgot about it.
Which package is actually broken? python?
When was your craft install?

Which package is actually broken? python?

I'm not sure if the python bundled in craft (craft\blueprints\dev-utils\python3) or the one from the craft-kde repo (etc\blueprints\locations\craft-kde\binary\_win\python), but one of them (or both?) is being put in the PATH earlier than the python defined in the settings INI file. So it can't be upgraded by craft because it is in use.

On a side not, we probably don't need to install python3 twice, but regardless of that I think my patch is correct.

I tried to reproduce your issue and failed with the latest version of craft.

The python in CraftRoot/python is only meant to be used for for applications that need to ship python.
In your case I'd recommend to manually set $env:CRAFT_PYTHON to the system python and then force an update of the python3 wrapper.
Also make sure that Paths/Python in etc/CraftSettings.ini points to the system python.
If recrafting python3 fails, try to invoke the system python directly with craft/bin/craft.py.