gpujs / gpujs/gpu.js

Installation instructions are wrong

Open
#821 1 comment 9 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
15.5k
Forks
663
PR merge metrics
No merged PRs in 30d

Description

## *What* is wrong?
As per the [installation instructions](https://github.com/gpujs/gpu.js#installation):

> On Linux, ensure you have the correct header files installed: sudo apt install mesa-common-dev libxi-dev (adjust for your distribution)
> (...)
> npm install gpu.js --save

**On Ubuntu 22.04, this is insufficient to actually install gpu.js.** It produces a long error message, at the core of which is `npm ERR! /bin/sh: 1: python: not found`.

Complete error output:
```
npm ERR! code 1
npm ERR! path /++snip++/node_modules/gl
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! prebuild-install warn install No prebuilt binaries found (target=19.9.0 runtime=node arch=x64 libc= platform=linux)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@19.9.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.6 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/++snip++/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/++snip++/node_modules/gl/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/++snip++/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/++snip++/.cache/node-gyp/19.9.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/++snip++/.cache/node-gyp/19.9.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/++snip++/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/++snip++/.cache/node-gyp/19.9.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/++snip++/node_modules/gl',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! /bin/sh: 1: python: not found
npm ERR! gyp: Call to 'python commit_id.py check ..' returned exit status 127 while in angle/src/angle.gyp. while loading dependencies of binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/++snip++/node_modules/node-gyp/lib/configure.js:325:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 5.19.0-45-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/++snip++/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /++snip++/node_modules/gl
npm ERR! gyp ERR! node -v v19.9.0
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok
```

## *Where* does it happen?
When trying to `npm install` on Ubuntu 22.04.2 LTS, NodeJS 19.9.

## *How* do we replicate the issue?
`npm install gpu.js`

## *How* important is this (1-5)?
5

## Expected behavior (i.e. solution)
Following the installation instructions should install gpu.js.

## Other Comments

The issue is, at heart, the same as #814: gpu.js requires Python 2.7 to install, but this is not mentioned anywhere in the install instructions.

In addition, even after installing Python 2.7, the `python` command will be unrecognized on Ubuntu 22.04. I seem to remember reading that this is a system design decision, Canonical wanting developers to explicitly state the required version (i.e., `python2` instead of `python`) to avoid version ambiguity, but can't find the source anymore. Either way, gpu.js doesn't adhere to that, so you need to manually symlink the `python` command to Python 2.

```
sudo apt install python2
sudo ln -s /bin/python2.7 /usr/bin/python
```

## Proposed solution:

Short term fix: Update the docs, so that following the install instructions is actually sufficient to install gpu.js.
Long term fix: Update so that gpu.js can be installed using Python 3. Python 2 was sunset over three years ago, coupled with a strong recommendation to migrate to Python 3.

On a related note, it would be great if there was some way to install precompiled versions of gpu.js. This would remove the dependency on Python when shipping software, plus greatly speed up the process.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.