Build error on focal image: "Warning: Python ^3.8 was not found on your system"

Hello,

The error is: “Warning: Python ^3.8 was not found on your system” on Netlify’s focal image
I did a quick search and asked the AI Bot, which unfortunately was even less helpful.
It’s response was:

Netlify’s build environment does support Python and it’s set to version 3.8 by default during the build process. This is evident from the logs provided in the knowledge sources where it states Python version set to 3.8 during the build process.

I’ve been sporadically running in to this odd issue such that it appears only on some GH Pull Requests consistently (on every build), but does not occur for every pull request.
Examples of passing:

Examples of failures:

Each PR has a Netlify chatbot commenting with a link to the deploy preview and deploy log.
Build log excerpt from one of the failures: Netlify

12:16:23 PM: build-image version: ecdc8b770f4a0193fd3f258c1bc6029e681813a4 (focal)
12:16:23 PM: buildbot version: 5ff1f297aa225d2ec877d89104672fd74916351d
12:16:23 PM: Fetching cached dependencies
12:16:23 PM: Failed to fetch cache, continuing with build
12:16:24 PM: Starting to prepare the repo for build
12:16:24 PM: No cached dependencies found. Cloning fresh repo
12:16:24 PM: git clone --filter=blob:none https://github.com/electron-userland/electron-builder
12:16:25 PM: Preparing Git Reference pull/8540/head
12:16:27 PM: Starting to install dependencies
12:16:27 PM: Found Pipfile restoring Pipenv virtualenv
12:16:27 PM: Started restoring cached python virtualenv
12:16:27 PM: Finished restoring cached python virtualenv
12:16:27 PM: Installing dependencies from Pipfile
12:16:28 PM: Failed during stage 'Install dependencies': dependency_installation script returned non-zero exit code: 1
**12:16:28 PM: Warning: Python ^3.8 was not found on your system...**
**12:16:28 PM: Neither 'pyenv' nor 'asdf' could be found to install Python.**
12:16:28 PM: You can specify specific versions of Python with:
12:16:28 PM: $ pipenv --python path/to/python
12:16:28 PM: Error installing Pipenv dependencies
12:16:28 PM: Please see https://github.com/netlify/build-image/blob/focal/included_software.md for current versions
12:16:28 PM: Failing build: Failed to install dependencies

I can confirm that python_version is set in the Pipefile electron-builder/Pipfile at 097eeced3c82a3f19d7b80f2a23f1f7749b8af92 · electron-userland/electron-builder · GitHub
Note: I’ve also tried python_version = "3.8" with no success either.

Would anyone mind assisting in resolving this flakiness?

We’re in the middle of upgrading/changing Python versions right now. Once that’s done, we’ll revisit this to see if it’s still an issue.

Thanks for the update!

Now I’m receiving "pipenv" couldn't exec process: No such file or directory on all my builds though. Is this issue known?

Likely related:

Maybe you’re already unblocked?

Now I’m receiving this as of today:

9:46:29 AM: mise ERROR python is not a mise bin. Perhaps you need to install it first.
9:46:29 AM: mise ERROR Run with --verbose or MISE_VERBOSE=1 for more information

I have explicitly set python to version 3.8, but getting same issue here

The fix for this should be coming in the upcoming week.

1 Like

Now I’ve been receiving:

1:22:37 AM: Installing dependencies from Pipfile.lock (f5ccc9)...
1:22:37 AM: All dependencies are now up-to-date!
1:22:38 AM: Error running command: $ /opt/build/repo/.venv/bin/python 
1:22:38 AM: /opt/buildhome/.local/share/mise/installs/python/3.8.20/lib/python3.8/site-packages/pipenv/vendor/pipdeptree -l --reverse --json-tree
1:22:38 AM: STDERR: Traceback (most recent call last):
1:22:38 AM:   File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
1:22:38 AM:     return _run_code(code, main_globals, None,
1:22:38 AM:   File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
1:22:38 AM:     exec(code, run_globals)
1:22:38 AM:   File
1:22:38 AM: "/opt/buildhome/.local/share/mise/installs/python/3.8.20/lib/python3.8/site-packages/pipenv/vendor/pipdeptree/__main__.py", line 15, in <module>
    from pipenv.vendor.pipdeptree._cli import get_options
1:22:38 AM: ModuleNotFoundError: No module named 'pipenv.vendor.pipdeptree._cli'

When can we expect the default build images to stabilize? This has been broken for my documentation site’s CI/CD pipeline for quite some time

Not sure whichh deploy gave that error, at least your current latest deploy seems to be failing with mkdocs command not found: Deploy details | Deploys | car-park-attendant-cleat-11576 | Netlify, which is same as: Poetry/mkdocs build & deploy failing. Build script returned non-zero exit code: 2. mkdocs: command not found

I am now getting error

6:09:40 AM: /opt/build-bin/run-build-functions.sh: line 524: /opt/buildhome/.mise/installs/python/3.13/bin/pipenv: No such file or directory

My deploys have been failing since Oct. 22nd

@vdan, do you have a link to the deploy?

@hrishikesh , I could fix it by adding to netlify.toml

  command = "pip install pipenv"

Tx!