CircleCI-Public / cimg-ruby

The CircleCI Ruby Docker Convenience Image.
https://circleci.com/developer/images/image/cimg/ruby
MIT License
33 stars 39 forks source link

cimg/ruby:2.7.5-browsers - Error: Can't find Python executable "python" #86

Closed LaithAzer closed 2 years ago

LaithAzer commented 2 years ago

I am trying to update my app to use Ruby 2.7.5. Using the new cimg/ruby:2.7.5-browsers image gives me the following error when running in circleci and trying to yarn install:

[4/4] Building fresh packages...
error /home/circleci/project/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /home/circleci/project/node_modules/node-sass
Output:
Building: /usr/local/bin/node /home/circleci/project/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/usr/local/bin/node',
gyp verb cli   '/home/circleci/project/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@16.13.0 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/home/circleci/project/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/home/circleci/project/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/home/circleci/project/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /home/circleci/project/node_modules/which/which.js:89:16
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/home/circleci/project/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/home/circleci/project/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/home/circleci/project/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /home/circleci/project/node_modules/which/which.js:89:16
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (/home/circleci/project/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/home/circleci/project/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/home/circleci/project/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /home/circleci/project/node_modules/which/which.js:89:16
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
gyp verb `which` failed  python Error: not found: python
gyp verb `which` failed     at getNotFoundError (/home/circleci/project/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/home/circleci/project/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/home/circleci/project/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /home/circleci/project/node_modules/which/which.js:89:16
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/home/circleci/project/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/home/circleci/project/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/home/circleci/project/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/home/circleci/project/node_modules/which/which.js:80:29)
gyp ERR! stack     at /home/circleci/project/node_modules/which/which.js:89:16
gyp ERR! stack     at /home/circleci/project/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /home/circleci/project/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:198:21)
gyp ERR! System Linux 5.11.0-1022-aws
gyp ERR! command "/usr/local/bin/node" "/home/circleci/project/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/circleci/project/node_modules/node-sass
gyp ERR! node -v v16.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Exited with code exit status 1
CircleCI received exit code 1

cimg/ruby:2.7.5-node also fails with the same error. This works with cimg/ruby:2.7.4-browsers. Can 2.7.5 be fixed?

Thank you.

LaithAzer commented 2 years ago

Not sure how this closed (I linked to it in a PR in a private repo, somehow github thought that fixed it), but it is still an issue.

FelicianoTech commented 2 years ago

Hi. Python 2 is not installed in the image. I see three possible solutions here:

  1. Install Python 2 on your own. This can be done with sudo apt-get update && sudo apt-get install -y python2.
  2. Use Python 3 instead. This is already installed in the image.
  3. Use a different dependency that doesn't rely on Python.

I hope that helps.