Python executable "/usr/bin/python3" is v3.8.10, which is not supported by gyp
whatwewant opened this issue · comments
Environment
OS: ubuntu 20.04
Python version: 3 (No python2)
cnpm@7.1.1
npm@6.14.16
npminstall@5.5.0
linux x64 5.4.0-100-generic
registry=https://registry.npmmirror.com
Repreduce
PYTHON=$(which python3) cnpm i raw-socket
Logs
gyp ERR! stack Error: Python executable "/usr/bin/python3" is v3.8.10, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack at PythonFinder.failPythonVersion (/home/whatwewant/.nvm/versions/node/v16.5.0/lib/node_modules/cnpm/node_modules/_node-gyp@4.0.0@node-gyp/lib/configure.js:493:19)
gyp ERR! stack at PythonFinder.<anonymous> (/home/whatwewant/.nvm/versions/node/v16.5.0/lib/node_modules/cnpm/node_modules/_node-gyp@4.0.0@node-gyp/lib/configure.js:475:14)
gyp ERR! stack at ChildProcess.exithandler (node:child_process:388:7)
gyp ERR! stack at ChildProcess.emit (node:events:394:28)
gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
gyp ERR! System Linux 5.4.0-100-generic
gyp ERR! command "/home/whatwewant/.nvm/versions/node/v16.5.0/bin/node" "/home/whatwewant/.nvm/versions/node/v16.5.0/lib/node_modules/cnpm/node_modules/_npminstall@5.5.0@npminstall/node-gyp-bin/node-gyp.js" "rebuild"
node-gyp@^4.0.0 won't be compatible with python3, but node-gyp already support python3.
and after testing, it was found that as long as the upgrade node-gyp@9.0.0 is ok
How to reproduce ?
- OS: ubuntu 20.04
- Python version: 3 (No python2)
- Cmd:
cnpm i -g raw-socket
More:
$ cnpm i -g raw-socket
> gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
$ PYTHON=$(which python3) cnpm i raw-socket
> gyp ERR! stack Error: Python executable "/usr/bin/python3" is v3.8.10, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
Worked now
PYTHON=$(which python3) cnpm i raw-socket
⠋ [0/1] Installing nan@2.14.*[npminstall:runscript] raw-socket@latest found binding.gyp file, auto run "node-gyp rebuild", root: "/private/tmp/foo/node_modules/_raw-socket@1.7.0@raw-socket"
⠼ [0/1] Installing nan@2.14.* CXX(target) Release/obj.target/raw/src/raw.o
⠋ [0/1] Installing nan@2.14.* SOLINK_MODULE(target) Release/raw.node
✔ Installed 1 packages
✔ Linked 2 latest versions
✔ Run 0 scripts
✔ All packages installed (2 packages installed from npm registry, used 6s(network 6s), speed 3.24KB/s, json 1(3.62KB), tarball 15.73KB, manifests cache hit 1, etag hit 1 / miss 0)