How to upgrade build image/default version

Hi!

I updated the build image in the Netlify UI to Focal.

Previously I used Xenial. After reading this document I removed runtime.txt because I was under the impression that Python 3.8 is supposed to be the default. default implies to me, that I don’t have to override the Python version.

All builds fail if I don’t set PYTHON_VERSION=3.8. Am I missing something?

Looking at the build.log, it doesn’t seem like I’m using focal at all. It would be really nice if you could include a print statement near the top because build-image-tag and build-image-version don’t tell me anything at first glance.

I think this build runs Focal, because if I do PYTHON_VERSION=3.7 the build continues to fail. Only when I set PYTHON_VERSION=3.8 the build completes successfully.

My site’s name is sphinxawesome-theme.

Regards,
Kai

7:56:33 AM: Build ready to start
7:56:36 AM: build-image version: 081db65c3e4ce8423fedb40e7689a87de6f84667
7:56:36 AM: build-image tag: v4.3.1
7:56:36 AM: buildbot version: 407a98ff60139d85f01f4f8453046e19d02bbcfd
7:56:36 AM: Building without cache
7:56:36 AM: Starting to prepare the repo for build
7:56:36 AM: No cached dependencies found. Cloning fresh repo
7:56:36 AM: git clone https://github.com/kai687/sphinxawesome-theme
7:56:38 AM: Preparing Git Reference pull/598/head
7:56:38 AM: Parsing package.json dependencies
7:56:39 AM: Starting build script
7:56:39 AM: Installing dependencies
7:56:39 AM: Python version set to 2.7
7:56:40 AM: Downloading and installing node v10.24.1...
7:56:40 AM: Downloading https://nodejs.org/dist/v10.24.1/node-v10.24.1-linux-x64.tar.xz...
7:56:40 AM: Computing checksum with sha256sum
7:56:40 AM: Checksums matched!
7:56:43 AM: Now using node v10.24.1 (npm v6.14.12)
7:56:43 AM: Started restoring cached build plugins
7:56:43 AM: Finished restoring cached build plugins
7:56:43 AM: Attempting ruby version 2.6.2, read from environment
7:56:44 AM: Required ruby-2.6.2 is not installed - installing.
7:56:45 AM: Searching for binary rubies, this might take some time.
7:56:45 AM: Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/20.04/x86_64/ruby-2.6.2.tar.bz2
7:56:45 AM: Checking requirements for ubuntu.
7:56:45 AM: Requirements installation successful.
7:56:45 AM: ruby-2.6.2 - #configure
7:56:45 AM: ruby-2.6.2 - #download
7:56:46 AM: ruby-2.6.2 - #validate archive
7:56:48 AM: Canceling deploy
7:56:53 AM: ruby-2.6.2 - #extract
7:56:57 AM: ruby-2.6.2 - #validate binary
7:56:58 AM: ruby-2.6.2 - #setup
7:56:58 AM: sh: 0: getcwd() failed: No such file or directory
7:56:58 AM: sh: 0: getcwd() failed: No such file or directory
7:56:59 AM: ruby-2.6.2 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.6.2@global
7:56:59 AM: ruby-2.6.2 - #importing gemset /opt/buildhome/.rvm/gemsets/global.gems........................................
7:56:59 AM: ruby-2.6.2 - #generating global wrappers...............
7:56:59 AM: Error running 'run_gem_wrappers regenerate',
7:56:59 AM: please read /opt/buildhome/.rvm/log/1632203819_ruby-2.6.2/gemset.wrappers.global.log
7:56:59 AM: ruby-2.6.2 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.6.2
7:56:59 AM: ruby-2.6.2 - #importing gemsetfile /opt/buildhome/.rvm/gemsets/default.gems evaluated to empty gem list
7:57:00 AM: ruby-2.6.2 - #generating default wrappers...............
7:57:00 AM: Error running 'run_gem_wrappers regenerate',
7:57:00 AM: please read /opt/buildhome/.rvm/log/1632203819_ruby-2.6.2/gemset.wrappers.default.log
7:57:00 AM: shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
7:57:00 AM: shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
7:57:00 AM: Execution cancelled
7:57:00 AM: Error running command: Command was cancelled
7:57:00 AM: Failing build: Failed to build site
7:57:00 AM: Finished processing build request in 24.337018707s

Hi @kai687,

I believe you might be affected by this:

The solution would be to relink your repo (all your current environment variables will be deleted) or continue using the required environment variable.

EDIT: As confirmed with the team, Python version is not pinned like Ruby. So the above link would not apply to you. However, it would be interesting to see if relinking still changes anything. Do let us know.

Thanks for the explanation. It would be nice to add this to the docs. As a solution for me, it’ll be enough to just keep the PYTHON_VERSION environment variable.

I expect to find such information maybe here: Build configuration overview | Netlify Docs

Can you also consider including what software versions are available in the docs?
I have to click on the right link in your docs to go to GitHub. Then, in the README I have to click the right link again to go to this page: build-image/included_software.md at focal · netlify/build-image · GitHub

It’s a little hard to find. Maybe include a link directly to these files from the docs and make them easily findable when you search for ‘build environment’ or something? And this document can also include the same info you’ve just explained so that people know exactly what they should do.

Hi @kai687,

Thank you for the feedback. I can pass it on to the docs team for discussion on what can be done about this.

About the error, after looking at your deploys logs, I think I figured out the error.

Python is not like Node.js, in the sense, we don’t install any available version of Python upon request like we do with Node.js. In Focal, you need to use either Python 2.7 or Python 3.8. The reason why it was installing fine in Xenial was because Python 3.7 was one of the options in there, which is no longer an option in Focal.

If you remove the environment variable altogether, I think it’d use 3.8 by default as the GitHub repo mentions.

The reason why it was working in Xenial for me was because I had a runtime.txt file for setting the Python version to 3.7.

After selecting Focal as the build image in the Netlify UI, and removing runtime.txt from the repo, the builds failed, so removing the environment variable didn’t work (the build used Python 2.7 instead). I assume, if I start a new site and use Focal from the beginning, or relinking the repository as you suggested might work, but I’m happy with the workaround we’ve found.