Upgrade to Theia 1.23.0

Hi,

I tried to upgrade to Theia 1.23 (from 1.22.1), I installed the TypeScript 4.5.5 as in the migration guide, but the build failed on a Python missing error. Once I installed the latest Python 3, the build was succeeded.
Just wanted to make sure if now Python 3 is a prerequisite? If so maybe the migration guide should be updated.

Thanks

@safi thank you for the discussion, do you remember what the error was? Our CI builds have been using Python 3 for over a year now so I’m not sure why you’re having problems migrating from 1.22.1 to 1.23, or what might have changed.

I just had a look at our prerequisites and we don’t mention anything about the recommended Python version.

I figured no one was still using Python 2 as it has been deprecated for some time now.

Hi,
I had Python 2, because it is a prerequisite of some tool I am using. Maybe this was enough for Theia version < 1.23 .
Anyway here is the error I am getting before installing Python 3.10:

yarn install v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.1.3: The platform "win32" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@theia/process > node-pty@0.11.0-beta17" has unmet peer dependency "node-gyp@^8.3.0".
warning "@theia/git > @theia/scm > react-autosize-textarea@7.1.0" has unmet peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0".
warning "@theia/git > @theia/scm > react-autosize-textarea@7.1.0" has unmet peer dependency "react-dom@^0.14.0 || ^15.0.0 || ^16.0.0".
warning "@theia/messages > react-perfect-scrollbar@1.5.8" has unmet peer dependency "react@>=16.3.3".
warning "@theia/messages > react-perfect-scrollbar@1.5.8" has unmet peer dependency "react-dom@>=16.3.3".
warning "@theia/preview > markdown-it-anchor@5.0.2" has unmet peer dependency "markdown-it@^8.4.1".
[4/4] Building fresh packages...
[1/10] ⠐ drivelist
[6/10] ⠐ vscode-ripgrep
[3/10] ⠈ nsfw
[4/10] ⠈ oniguruma
error C:\theia\node_modules\nsfw: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: C:\theia\node_modules\nsfw
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@12.16.2 | win32 | x64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - executable path is "C:\Python27\python.exe"
gyp ERR! find Python - version is "2.7.16"
gyp ERR! find Python - version is 2.7.16 - should be >=3.6.0
gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
gyp ERR! find Python checking if Python is C:\Users\MaorDahan\AppData\Local\Programs\Python\Python39\python.exe
gyp ERR! find Python - "C:\Users\MaorDahan\AppData\Local\Programs\Python\Python39\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe
gyp ERR! find Python - "C:\Program Files\Python39\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\MaorDahan\AppData\Local\Programs\Python\Python39-32\python.exe
gyp ERR! find Python - "C:\Users\MaorDahan\AppData\Local\Programs\Python\Python39-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe
gyp ERR! find Python - "C:\Program Files\Python39-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe
gyp ERR! find Python - "C:\Program Files (x86)\Python39-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\MaorDahan\AppData\Local\Programs\Python\Python38\python.exe
gyp ERR! find Python - "C:\Users\MaorDahan\AppData\Local\Programs\Python\Python38\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe
gyp ERR! find Python - "C:\Program Files\Python38\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\MaorDahan\AppData\Local\Programs\Python\Python38-32\python.exe
gyp ERR! find Python - "C:\Users\MaorDahan\AppData\Local\Programs\Python\Python38-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe
gyp ERR! find Python - "C:\Program Files\Python38-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe
gyp ERR! find Python - "C:\Program Files (x86)\Python38-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\MaorDahan\AppData\Local\Programs\Python\Python37\python.exe
gyp ERR! find Python - "C:\Users\MaorDahan\AppData\Local\Programs\Python\Python37\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python37\python.exe
gyp ERR! find Python - "C:\Program Files\Python37\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\MaorDahan\AppData\Local\Programs\Python\Python37-32\python.exe
gyp ERR! find Python - "C:\Users\MaorDahan\AppData\Local\Programs\Python\Python37-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python37-32\python.exe
gyp ERR! find Python - "C:\Program Files\Python37-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python37-32\python.exe
gyp ERR! find Python - "C:\Program Files (x86)\Python37-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\MaorDahan\AppData\Local\Programs\Python\Python36\python.exe
gyp ERR! find Python - "C:\Users\MaorDahan\AppData\Local\Programs\Python\Python36\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python36\python.exe
gyp ERR! find Python - "C:\Program Files\Python36\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Users\MaorDahan\AppData\Local\Programs\Python\Python36-32\python.exe
gyp ERR! find Python - "C:\Users\MaorDahan\AppData\Local\Programs\Python\Python36-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python36-32\python.exe
gyp ERR! find Python - "C:\Program Files\Python36-32\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python36-32\python.exe
gyp ERR! find Python - "C:\Program Files (x86)\Python36-32\python.exe" could not be run
gyp ERR! find Python checking if the py launcher can be used to find Python 3
gyp ERR! find Python - "py.exe" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python npm config set python "C:\Path\To\python.exe"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack at PythonFinder.fail (C:\theia\node_modules\node-gyp\lib\find-python.js:330:47)
gyp ERR! stack at PythonFinder.runChecks (C:\theia\node_modules\node-gyp\lib\find-python.js:159:21)
gyp ERR! stack at PythonFinder.<anonymous> (C:\theia\node_modules\node-gyp\lib\find-python.js:228:18)
gyp ERR! stack at PythonFinder.execFileCallback (C:\theia\node_modules\node-gyp\lib\find-python.js:294:16)
gyp ERR! stack at exithandler (child_process.js:310:5)
gyp ERR! stack at ChildProcess.errorhandler (child_process.js:322:5)
gyp ERR! stack at ChildProcess.emit (events.js:310:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
gyp ERR! stack at onErrorNT (internal/child_process.js:469:16)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:84:21)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\theia\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\theia\node_modules\nsfw

Thanks

You need Python 3 to build, but your tools should still be able to use Python 2.

You could install Python 2 as your main installation, and then on the side have Python 3 and point node-gyp to use the latter following the instructions from the error message:

gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python npm config set python "C:\Path\To\python.exe"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************

Hi,
Yes, it worked for me, I have both Pythons and everything is good now. The only thing that now Python 3 is a must when before it was not.
Thanks

@safi thank you for bringing up the point, node-gyp was updated due to electron-rebuild which officially dropped support for Python2 which is end-of-life.

The prerequisites and migration guide were updated to reflect the updates.