stackgl / headless-gl

🎃 Windowless WebGL for node.js
1.73k stars 166 forks source link

Which python should be used when compiling on windows? #275

Closed xeoshow closed 4 months ago

xeoshow commented 4 months ago

I got below error when using python-2.7.18.amd64.msi on windows, but it is said that node-gyp should be run with python 2.7.X ? Any help is highly appreciated!

PS D:\gitrepository\yy-software\build> pnpm install
 WARN  1 deprecated subdependencies found: @npmcli/move-file@2.0.1
Packages: +352
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 371, reused 368, downloaded 0, added 0, done
node_modules/.pnpm/canvas@2.11.2/node_modules/canvas: Running install script, failed in 20.8s
.../canvas@2.11.2/node_modules/canvas install$ node-pre-gyp install --fallback-to-build --update-binary
│ node-pre-gyp info it worked if it ends with ok
│ node-pre-gyp info using node-pre-gyp@1.0.11
│ node-pre-gyp info using node@16.19.1 | win32 | x64
│ node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v93-win32-unknown-x64.tar.gz
│ node-pre-gyp ERR! install request to https://objects.githubusercontent.com/github-production-release-asset-2e65be/948957/2d4c6d46-a127-446c-a6f6-8a56ab2600c9?X-Amz-Alg…
│ node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@16.19.1 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
│ node-pre-gyp WARN Hit error request to https://objects.githubusercontent.com/github-production-release-asset-2e65be/948957/2d4c6d46-a127-446c-a6f6-8a56ab2600c9?X-Amz-A…
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@9.4.1
│ gyp info using node@16.19.1 | win32 | x64
│ gyp info ok
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@9.4.1
│ gyp info using node@16.19.1 | win32 | x64
│ gyp ERR! find Python
│ gyp ERR! find Python Python is not set from command line or npm configuration
│ gyp ERR! find Python checking Python explicitly set from environment variable PYTHON
│ gyp ERR! find Python - process.env.PYTHON is "C:\Python27"
│ gyp ERR! find Python - "C:\Python27" is not in PATH or produced an error
│ 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.18"
│ gyp ERR! find Python - version is 2.7.18 - 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\thinkpad\AppData\Local\Programs\Python\Python39\python.exe
│ gyp ERR! find Python - "C:\Users\thinkpad\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\thinkpad\AppData\Local\Programs\Python\Python39-32\python.exe
│ gyp ERR! find Python - "C:\Users\thinkpad\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\thinkpad\AppData\Local\Programs\Python\Python38\python.exe
│ gyp ERR! find Python - "C:\Users\thinkpad\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\thinkpad\AppData\Local\Programs\Python\Python38-32\python.exe
│ gyp ERR! find Python - "C:\Users\thinkpad\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\thinkpad\AppData\Local\Programs\Python\Python37\python.exe
│ gyp ERR! find Python - "C:\Users\thinkpad\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\thinkpad\AppData\Local\Programs\Python\Python37-32\python.exe
│ gyp ERR! find Python - "C:\Users\thinkpad\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\thinkpad\AppData\Local\Programs\Python\Python36\python.exe
│ gyp ERR! find Python - "C:\Users\thinkpad\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\thinkpad\AppData\Local\Programs\Python\Python36-32\python.exe
│ gyp ERR! find Python - "C:\Users\thinkpad\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:\Users\thinkpad\AppData\Roaming\npm\node_modules\pnpm\dist\node_modules\node-gyp\lib\find-python.js:330:47)
│ gyp ERR! stack     at PythonFinder.runChecks (C:\Users\thinkpad\AppData\Roaming\npm\node_modules\pnpm\dist\node_modules\node-gyp\lib\find-python.js:159:21)
│ gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\thinkpad\AppData\Roaming\npm\node_modules\pnpm\dist\node_modules\node-gyp\lib\find-python.js:228:18)
│ gyp ERR! stack     at PythonFinder.execFileCallback (C:\Users\thinkpad\AppData\Roaming\npm\node_modules\pnpm\dist\node_modules\node-gyp\lib\find-python.js:294:16)
│ gyp ERR! stack     at ChildProcess.exithandler (node:child_process:410:5)
│ gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
│ gyp ERR! stack     at maybeClose (node:internal/child_process:1100:16)
│ gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
│ gyp ERR! System Windows_NT 10.0.19045
│ gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\thinkpad\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\node_modules\\node-gyp\\bin\\node-gyp.js"…
│ gyp ERR! cwd D:\gitrepository\yy-software\build\node_modules\.pnpm\canvas@2.11.2\node_modules\canvas
│ gyp ERR! node -v v16.19.1
│ gyp ERR! node-gyp -v v9.4.1
│ gyp ERR! not ok
│ node-pre-gyp ERR! build error
│ node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\thinkpad\AppData\Roaming\npm\node_modules\pnpm\dist\node_modules\node-gyp\b…
│ node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\gitrepository\yy-software\build\node_modules\.pnpm\@mapbox+node-pre-gyp@1.0.11\node_modules\@mapbox\n…
│ node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
│ node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1100:16)
│ node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
│ node-pre-gyp ERR! System Windows_NT 10.0.19045
│ node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\gitrepository\\yy-software\\build\\node_modules\\.pnpm\\@mapbox+node-pre-gyp@1.0.11\\node_mo…
│ Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\thinkpad\AppData\Roaming\npm\node_modules\pnpm\dist\node_modules\node-gyp\bin\node-gyp.js configure --fall…
│ node-pre-gyp ERR! cwd D:\gitrepository\yy-software\build\node_modules\.pnpm\canvas@2.11.2\node_modules\canvas
│ node-pre-gyp ERR! node -v v16.19.1
│ node-pre-gyp ERR! node-pre-gyp -v v1.0.11
│ node-pre-gyp ERR! not ok
└─ Failed in 20.8s at D:\gitrepository\yy-software\build\node_modules\.pnpm\canvas@2.11.2\node_modules\canvas
 ELIFECYCLE  Command failed with exit code 1.
xeoshow commented 4 months ago

After changing the version of python from 2.7.18 to 3.12.2 on windows 10 64bit, still failed with below:

PS D:\gitrepository\yy-software\build> pnpm install gl --save
 WARN  1 deprecated subdependencies found: @npmcli/move-file@2.0.1
Packages: +11
+++++++++++
Progress: resolved 383, reused 368, downloaded 0, added 0, done
node_modules/.pnpm/gl@6.0.2/node_modules/gl: Running install script, failed in 18.8s
.../.pnpm/gl@6.0.2/node_modules/gl install$ prebuild-install || node-gyp rebuild
│ prebuild-install warn install No prebuilt binaries found (target=20.11.1 runtime=node arch=x64 libc= platform=win32)
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@9.4.1
│ gyp info using node@20.11.1 | win32 | x64
│ gyp info find Python using Python version 3.12.2 found at "C:\Python312\python.exe"
│ gyp http GET https://nodejs.org/download/release/v20.11.1/node-v20.11.1-headers.tar.gz
│ gyp http 200 https://nodejs.org/download/release/v20.11.1/node-v20.11.1-headers.tar.gz
│ gyp http GET https://nodejs.org/download/release/v20.11.1/SHASUMS256.txt
│ gyp http GET https://nodejs.org/download/release/v20.11.1/win-x64/node.lib
│ gyp http 200 https://nodejs.org/download/release/v20.11.1/SHASUMS256.txt
│ gyp http 200 https://nodejs.org/download/release/v20.11.1/win-x64/node.lib
│ gyp info find VS using VS2019 (16.11.34601.136) found at:
│ gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
│ gyp info find VS run with --verbose for detailed information
│ gyp info spawn C:\Python312\python.exe
│ gyp info spawn args [
│ gyp info spawn args   'D:\\gitrepository\\yy-software\\build\\node_modules\\.pnpm\\node-gyp@9.4.1\\node_modul…
│ gyp info spawn args   'binding.gyp',
│ gyp info spawn args   '-f',
│ gyp info spawn args   'msvs',
│ gyp info spawn args   '-I',
│ gyp info spawn args   'D:\\gitrepository\\yy-software\\build\\node_modules\\.pnpm\\gl@6.0.2\\node_modules\\gl…
│ gyp info spawn args   '-I',
│ gyp info spawn args   'D:\\gitrepository\\yy-software\\build\\node_modules\\.pnpm\\node-gyp@9.4.1\\node_modul…
│ gyp info spawn args   '-I',
│ gyp info spawn args   'C:\\Users\\thinkpad\\AppData\\Local\\node-gyp\\Cache\\20.11.1\\include\\node\\common.gypi',
│ gyp info spawn args   '-Dlibrary=shared_library',
│ gyp info spawn args   '-Dvisibility=default',
│ gyp info spawn args   '-Dnode_root_dir=C:\\Users\\thinkpad\\AppData\\Local\\node-gyp\\Cache\\20.11.1',
│ gyp info spawn args   '-Dnode_gyp_dir=D:\\gitrepository\\yy-software\\build\\node_modules\\.pnpm\\node-gyp@9.…
│ gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\thinkpad\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\20.11.1\…
│ gyp info spawn args   '-Dmodule_root_dir=D:\\gitrepository\\yy-software\\build\\node_modules\\.pnpm\\gl@6.0.2…
│ gyp info spawn args   '-Dnode_engine=v8',
│ gyp info spawn args   '--depth=.',
│ gyp info spawn args   '--no-parallel',
│ gyp info spawn args   '--generator-output',
│ gyp info spawn args   'D:\\gitrepository\\yy-software\\build\\node_modules\\.pnpm\\gl@6.0.2\\node_modules\\gl…
│ gyp info spawn args   '-Goutput_dir=.'
│ gyp info spawn args ]
│ Traceback (most recent call last):
│   File "D:\gitrepository\yy-software\build\node_modules\.pnpm\node-gyp@9.4.1\node_modules\node-gyp\gyp\gyp_ma…
│     import gyp  # noqa: E402
│     ^^^^^^^^^^
│   File "D:\gitrepository\yy-software\build\node_modules\.pnpm\node-gyp@9.4.1\node_modules\node-gyp\gyp\pylib\…
│     import gyp.input
│   File "D:\gitrepository\yy-software\build\node_modules\.pnpm\node-gyp@9.4.1\node_modules\node-gyp\gyp\pylib\…
│     from distutils.version import StrictVersion
│ ModuleNotFoundError: No module named 'distutils'
│ gyp ERR! configure error
│ gyp ERR! stack Error: `gyp` failed with exit code: 1
│ gyp ERR! stack     at ChildProcess.onCpExit (D:\gitrepository\yy-software\build\node_modules\.pnpm\node-gyp@9…
│ gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
│ gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
│ gyp ERR! System Windows_NT 10.0.19045
│ gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\gitrepository\\yy-software\\build\\node_modules\\…
│ gyp ERR! cwd D:\gitrepository\yy-software\build\node_modules\.pnpm\gl@6.0.2\node_modules\gl
│ gyp ERR! node -v v20.11.1
│ gyp ERR! node-gyp -v v9.4.1
│ gyp ERR! not ok
└─ Failed in 18.8s at D:\gitrepository\yy-software\build\node_modules\.pnpm\gl@6.0.2\node_modules\gl
 ELIFECYCLE  Command failed with exit code 1.
PS D:\gitrepository\yy-software\build>