Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS 12.3 Beta has removed the Python 2 support: spawn /usr/bin/python ENOENT #6606

Closed
pan93412 opened this issue Feb 2, 2022 · 24 comments · Fixed by #6617, #6599, #6657 or #6672
Closed

macOS 12.3 Beta has removed the Python 2 support: spawn /usr/bin/python ENOENT #6606

pan93412 opened this issue Feb 2, 2022 · 24 comments · Fixed by #6617, #6599, #6657 or #6672

Comments

@pan93412
Copy link
Contributor

pan93412 commented Feb 2, 2022

  • Electron-Builder Version: 22.13.1
  • Node Version: v16.13.1
  • Electron Version: 16.0.8
  • Electron Type (current, beta, nightly): current
  • electron-updater Version: 4.6.5
  • Target: macOS (x86, ARM64, universal?)

macOS 12.3 has removed the Python 2 support; thus, /usr/bin/python has been removed. electron-builder tries to call /usr/bin/python and it throws Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT.

Reproducible Step

# Clone the minimum reproducible boilerplate
git clone git@github.com:electron-react-boilerplate/electron-react-boilerplate.git
cd electron-react-boilerplate

# Install dependencies
npm i

# Upgrade to the latest patch version
npm upgrade

# Package (it throws here)
npm run package

Full Log

$ npm run package
> package
> ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never


> build
> concurrently "npm run build:main" "npm run build:renderer"

[1]
[1] > build:renderer
[1] > cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts
[1]
[0]
[0] > build:main
[0] > cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts
[0]
[1] npm run build:renderer exited with code 0
[0] npm run build:main exited with code 0
  • electron-builder  version=22.13.1 os=21.4.0
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=release/build/builder-effective-config.yaml
  • installing production dependencies  platform=darwin arch=arm64 appDir=/Users/pan93412/Projects/electron-react-boilerplate/release/app
  • packaging       platform=darwin arch=arm64 electron=16.0.8 appOutDir=release/build/mac-arm64
  • downloading     url=https://github.com/electron/electron/releases/download/v16.0.8/electron-v16.0.8-darwin-arm64.zip size=88 MB parts=8
  • downloaded      url=https://github.com/electron/electron/releases/download/v16.0.8/electron-v16.0.8-darwin-arm64.zip duration=22.373s
  • skipped macOS application code signing  reason=cannot find valid "Developer ID Application" identity or custom non-Apple code signing certificate, see https://electron.build/code-signing allIdentities=     0 identities found
                                                Valid identities only
     0 valid identities found
Skipping notarizing step. Packaging is not running in CI
  • building        target=macOS zip arch=arm64 file=release/build/ElectronReact-4.5.0-arm64-mac.zip
  • building        target=DMG arch=arm64 file=release/build/ElectronReact-4.5.0-arm64.dmg
  • installing production dependencies  platform=darwin arch=x64 appDir=/Users/pan93412/Projects/electron-react-boilerplate/release/app
  • Detected arm64 process, HFS+ is unavailable. Creating dmg with APFS - supports Mac OSX 10.12+
  • packaging       platform=darwin arch=x64 electron=16.0.8 appOutDir=release/build/mac
  • downloading     url=https://github.com/electron/electron/releases/download/v16.0.8/electron-v16.0.8-darwin-x64.zip size=83 MB parts=8
  • downloaded      url=https://github.com/electron/electron/releases/download/v16.0.8/electron-v16.0.8-darwin-x64.zip duration=19.803s
  • skipped macOS application code signing  reason=cannot find valid "Developer ID Application" identity or custom non-Apple code signing certificate, see https://electron.build/code-signing allIdentities=     0 identities found
                                                Valid identities only
     0 valid identities found
Skipping notarizing step. Packaging is not running in CI
  • building        target=macOS zip arch=x64 file=release/build/ElectronReact-4.5.0-mac.zip
  • building        target=DMG arch=x64 file=release/build/ElectronReact-4.5.0.dmg
  • Detected arm64 process, HFS+ is unavailable. Creating dmg with APFS - supports Mac OSX 10.12+
  ⨯ Exit code: ENOENT. spawn /usr/bin/python ENOENT  failedTask=build stackTrace=Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT
    at /Users/pan93412/Projects/electron-react-boilerplate/node_modules/builder-util/src/util.ts:133:18
    at exithandler (node:child_process:404:5)
    at ChildProcess.errorhandler (node:child_process:416:5)
    at ChildProcess.emit (node:events:390:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
  • Above command failed, retrying 5 more times
  • building block map  blockMapFile=release/build/ElectronReact-4.5.0-arm64-mac.zip.blockmap
  • Above command failed, retrying 4 more times
  • Above command failed, retrying 3 more times
  • Above command failed, retrying 2 more times
  • Above command failed, retrying 1 more times
  • Above command failed, retrying 0 more times
  • building block map  blockMapFile=release/build/ElectronReact-4.5.0-mac.zip.blockmap
@mmaietta
Copy link
Collaborator

mmaietta commented Feb 4, 2022

I'm not sure if the current vendor python scripts are python 3 compatible.
Can you try running electron builder with PYTHON_PATH=<path to python 3> to test it?

await exec(process.env.PYTHON_PATH || "/usr/bin/python", [path.join(getDmgVendorPath(), "dmgbuild/core.py")], {
cwd: getDmgVendorPath(),
env,
})

@pan93412
Copy link
Contributor Author

pan93412 commented Feb 4, 2022

  ⨯ Exit code: 1. Command failed: /usr/bin/python3 /Users/pan93412/Projects/electron-react-boilerplate/node_modules/dmg-builder/vendor/dmgbuild/core.py
Traceback (most recent call last):
  File "/Users/pan93412/Projects/electron-react-boilerplate/node_modules/dmg-builder/vendor/dmgbuild/core.py", line 7, in <module>
    reload(sys)  # Reload is a hack
NameError: name 'reload' is not defined

Traceback (most recent call last):
  File "/Users/pan93412/Projects/electron-react-boilerplate/node_modules/dmg-builder/vendor/dmgbuild/core.py", line 7, in <module>
    reload(sys)  # Reload is a hack
NameError: name 'reload' is not defined
  failedTask=build stackTrace=Error: Exit code: 1. Command failed: /usr/bin/python3 /Users/pan93412/Projects/electron-react-boilerplate/node_modules/dmg-builder/vendor/dmgbuild/core.py
Traceback (most recent call last):
  File "/Users/pan93412/Projects/electron-react-boilerplate/node_modules/dmg-builder/vendor/dmgbuild/core.py", line 7, in <module>
    reload(sys)  # Reload is a hack
NameError: name 'reload' is not defined

Traceback (most recent call last):
  File "/Users/pan93412/Projects/electron-react-boilerplate/node_modules/dmg-builder/vendor/dmgbuild/core.py", line 7, in <module>
    reload(sys)  # Reload is a hack
NameError: name 'reload' is not defined

Seems not compatible. Maybe we need to port it to Python 3 first.

@mmaietta
Copy link
Collaborator

mmaietta commented Feb 4, 2022

Shot in the dark. Can you add from importlib import reload to this file above reload?
node_modules/dmg-builder/vendor/dmgbuild/core.py

@pan93412
Copy link
Contributor Author

pan93412 commented Feb 4, 2022

Shot in the dark. Can you add from imp import reload to this file above reload?
node_modules/dmg-builder/vendor/dmgbuild/core.py

Sure. I will test it later.

@pan93412
Copy link
Contributor Author

pan93412 commented Feb 4, 2022

# -*- coding: utf-8 -*-

from importlib import reload
# from __future__ import unicode_literals

import os
import re
import sys
reload(sys)  # Reload is a hack
# sys.setdefaultencoding('UTF8')

sys.path.append(os.path.normpath(os.path.join(os.path.dirname(__file__), "..")))

try:
  {}.iteritems
  iteritems = lambda x: x.iteritems()
  iterkeys = lambda x: x.iterkeys()
except AttributeError:
  iteritems = lambda x: x.items()
  iterkeys = lambda x: x.keys()
try:
  unicode
except NameError:
  unicode = str

import biplist
from mac_alias import *
from ds_store import *

from colors import parseColor

try:
  from badge import badge
except ImportError:
  badge = None

class DMGError(Exception):
  pass


def build_dmg():
  options = {
    'icon': None,
    'badge_icon': None,
    'sidebar_width': 180,
    'arrange_by': None,
    'grid_offset': (0, 0),
    'grid_spacing': 100.0,
    'scroll_position': (0.0, 0.0),
    'show_icon_preview': False,
    'text_size': os.environ['iconTextSize'],
    'icon_size': os.environ['iconSize'],
    'include_icon_view_settings': 'auto',
    'include_list_view_settings': 'auto',
    'list_icon_size': 16.0,
    'list_text_size': 12.0,
    'list_scroll_position': (0, 0),
    'list_sort_by': 'name',
    'list_columns': ('name', 'date-modified', 'size', 'kind', 'date-added'),
    'list_column_widths': {
      'name': 300,
      'date-modified': 181,
      'date-created': 181,
      'date-added': 181,
      'date-last-opened': 181,
      'size': 97,
      'kind': 115,
      'label': 100,
      'version': 75,
      'comments': 300,
    },
    'list_column_sort_directions': {
      'name': 'ascending',
      'date-modified': 'descending',
      'date-created': 'descending',
      'date-added': 'descending',
      'date-last-opened': 'descending',
      'size': 'descending',
      'kind': 'ascending',
      'label': 'ascending',
      'version': 'ascending',
      'comments': 'ascending',
    }
  }

  # Set up the finder data
  bwsp = {
    'ShowStatusBar': False,
    'ContainerShowSidebar': False,
    'PreviewPaneVisibility': False,
    'SidebarWidth': options['sidebar_width'],
    'ShowTabView': False,
    'ShowToolbar': False,
    'ShowPathbar': False,
    'ShowSidebar': False
  }

  window_x = os.environ.get('windowX')
  if window_x:
    window_y = os.environ['windowY']
    bwsp['WindowBounds'] = '{{%s, %s}, {%s, %s}}' % (window_x,
                                                     window_y,
                                                     os.environ['windowWidth'],
                                                     os.environ['windowHeight'])

  arrange_options = {
    'name': 'name',
    'date-modified': 'dateModified',
    'date-created': 'dateCreated',
    'date-added': 'dateAdded',
    'date-last-opened': 'dateLastOpened',
    'size': 'size',
    'kind': 'kind',
    'label': 'label',
  }

  icvp = {
    'viewOptionsVersion': 1,
    'backgroundType': 0,
    'backgroundColorRed': 1.0,
    'backgroundColorGreen': 1.0,
    'backgroundColorBlue': 1.0,
    'gridOffsetX': float(options['grid_offset'][0]),
    'gridOffsetY': float(options['grid_offset'][1]),
    'gridSpacing': float(options['grid_spacing']),
    'arrangeBy': str(arrange_options.get(options['arrange_by'], 'none')),
    'showIconPreview': options['show_icon_preview'] == True,
    'showItemInfo': False,
    'labelOnBottom': True,
    'textSize': float(options['text_size']),
    'iconSize': float(options['icon_size']),
    'scrollPositionX': float(options['scroll_position'][0]),
    'scrollPositionY': float(options['scroll_position'][1])
  }

  columns = {
    'name': 'name',
    'date-modified': 'dateModified',
    'date-created': 'dateCreated',
    'date-added': 'dateAdded',
    'date-last-opened': 'dateLastOpened',
    'size': 'size',
    'kind': 'kind',
    'label': 'label',
    'version': 'version',
    'comments': 'comments'
  }

  default_widths = {
    'name': 300,
    'date-modified': 181,
    'date-created': 181,
    'date-added': 181,
    'date-last-opened': 181,
    'size': 97,
    'kind': 115,
    'label': 100,
    'version': 75,
    'comments': 300,
  }

  default_sort_directions = {
    'name': 'ascending',
    'date-modified': 'descending',
    'date-created': 'descending',
    'date-added': 'descending',
    'date-last-opened': 'descending',
    'size': 'descending',
    'kind': 'ascending',
    'label': 'ascending',
    'version': 'ascending',
    'comments': 'ascending',
  }

  lsvp = {
    'viewOptionsVersion': 1,
    'sortColumn': columns.get(options['list_sort_by'], 'name'),
    'textSize': float(options['list_text_size']),
    'iconSize': float(options['list_icon_size']),
    'showIconPreview': options['show_icon_preview'],
    'scrollPositionX': options['list_scroll_position'][0],
    'scrollPositionY': options['list_scroll_position'][1],
    'useRelativeDates': True,
    'calculateAllSizes': False,
  }

  lsvp['columns'] = {}
  cndx = {}

  for n, column in enumerate(options['list_columns']):
    cndx[column] = n
    width = options['list_column_widths'].get(column, default_widths[column])
    asc = 'ascending' == options['list_column_sort_directions'].get(column, default_sort_directions[column])

    lsvp['columns'][columns[column]] = {
      'index': n,
      'width': width,
      'identifier': columns[column],
      'visible': True,
      'ascending': asc
    }

  n = len(options['list_columns'])
  for k in iterkeys(columns):
    if cndx.get(k, None) is None:
      cndx[k] = n
      width = default_widths[k]
      asc = 'ascending' == default_sort_directions[k]

    lsvp['columns'][columns[column]] = {
      'index': n,
      'width': width,
      'identifier': columns[column],
      'visible': False,
      'ascending': asc
    }

    n += 1

  default_view = 'icon-view'
  views = {
    'icon-view': b'icnv',
    'column-view': b'clmv',
    'list-view': b'Nlsv',
    'coverflow': b'Flwv'
  }

  icvl = (b'type', views.get(default_view, 'icnv'))

  include_icon_view_settings = default_view == 'icon-view' \
                               or options['include_icon_view_settings'] not in \
                               ('auto', 'no', 0, False, None)
  include_list_view_settings = default_view in ('list-view', 'coverflow') \
                               or options['include_list_view_settings'] not in \
                               ('auto', 'no', 0, False, None)

  try:
    background_bmk = None

    background_color = os.environ.get('backgroundColor')
    background_file = os.environ.get('backgroundFile')

    if background_color:
      c = parseColor(background_color).to_rgb()

      icvp['backgroundType'] = 1
      icvp['backgroundColorRed'] = float(c.r)
      icvp['backgroundColorGreen'] = float(c.g)
      icvp['backgroundColorBlue'] = float(c.b)
    elif background_file:
      alias = Alias.for_file(background_file)
      background_bmk = Bookmark.for_file(background_file)

      icvp['backgroundType'] = 2
      icvp['backgroundImageAlias'] = biplist.Data(alias.to_bytes())

    image_dsstore = os.path.join(os.environ['volumePath'], '.DS_Store')

    f =  "icon_locations = {\n" + os.environ['iconLocations'] + "\n}"
    exec (f, options, options)

    with DSStore.open(image_dsstore, 'w+') as d:
      d['.']['vSrn'] = ('long', 1)
      d['.']['bwsp'] = bwsp
      if include_icon_view_settings:
        d['.']['icvp'] = icvp
        if background_bmk:
          d['.']['pBBk'] = background_bmk
      if include_list_view_settings:
        d['.']['lsvp'] = lsvp
      d['.']['icvl'] = icvl

      d['.background']['Iloc'] = (2560, 170)
      d['.DS_Store']['Iloc'] = (2610, 170)
      d['.fseventsd']['Iloc'] = (2660, 170)
      d['.Trashes']['Iloc'] = (2710, 170)
      d['.VolumeIcon.icns']['Iloc'] = (2760, 170)

      for k, v in iteritems(options['icon_locations']):
        d[k]['Iloc'] = v
  except:
    raise

build_dmg()

I followed the exception instruction from python3 and it seems work now. However, I'm not sure whether it works correct. :/

@mmaietta
Copy link
Collaborator

mmaietta commented Feb 4, 2022

Should be working correctly, the only difference is depending upon which version of python you're using.

=> 3.4 -> importlib
< 3.4 -> imp
< 3 (i.e. Python 2) -> record is built-in function

https://stackoverflow.com/a/33409066

I'll need to figure out a way to support both python 2 and python 3. I'm not sure what the other python scripts in the vendor dir are used for yet.

@mmaietta mmaietta self-assigned this Feb 4, 2022
@mmaietta
Copy link
Collaborator

mmaietta commented Feb 4, 2022

I think this might do the trick:

import sys
if sys.version_info.major == 3:
    try:
        from importlib import reload
    except ImportError:
        from imp import reload

mmaietta pushed a commit that referenced this issue Feb 4, 2022
…3+ which has entirely removed python2 (fixes: #6606)
@pan93412
Copy link
Contributor Author

pan93412 commented Feb 4, 2022

I think this might do the trick:

import sys
if sys.version_info.major == 3:
    try:
        from importlib import reload
    except ImportError:
        from imp import reload

Not only this. I also commented out # from __future__ import unicode_literals and sys.setdefaultencoding('UTF8') as Python 3 has supported Unicode natively.

@mmaietta
Copy link
Collaborator

mmaietta commented Feb 4, 2022

Great point, we can add that as an if-else statement as I think we should continue supporting Python 2 since it seems unnecessary to drop support for it.

@Moebits
Copy link

Moebits commented Feb 17, 2022

Hi, this has not resolved the issue for me, I get same error on electron builder 23.0.0-alpha.4 on latest macOS 12.3 beta.

I cannot build my app I always get:
⨯ Exit code: ENOENT. spawn /usr/bin/python ENOENT failedTask=build stackTrace=Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT

@Moebits
Copy link

Moebits commented Mar 9, 2022

Ok, it's working again in version 23.0.2, thanks.

ravicious added a commit to gravitational/webapps that referenced this issue Apr 26, 2022
ravicious added a commit to gravitational/webapps that referenced this issue Apr 27, 2022
ravicious added a commit to gravitational/webapps that referenced this issue Apr 27, 2022
* Take `localClusterUri` into account in `QuickInput` (#679)

* Display cluster name for each connection

* Automatically try to connect a connection when possible

* Update connection icon

* Always use root cluster URI to obtain `documentsService` in `useServerConnect`

* Don't close the tab on non-zero exit code

* Autocomplete database names for tsh proxy db

* Change placeholder text in `ClusterAdd`

* Show leaf cluster name when possible in Connections list

* Hide kubes and apps

* Force `TopBar` items to take full height

* Change shortcut to open `QuickInput`

* Update electron-builder to 23.0.3

Versions lower than 23.0.2 don't work on newest macOS, see:

* electron-userland/electron-builder#6732
* electron-userland/electron-builder#6606

* remove `Navigator` code (#685)

* Prevent breaking layout on long cluster name (#688)

* Show username when possible in identity list (#687)

* Update command for updating proto files

* Update protobufs for Teleterm (LoginRequest params)

This commit removes a bunch of unused protobufs and also updates some of
those that got updated on the teleterm branch in the teleport repo.

The biggest change from all of them is that LoginRequest now has oneof
on Sso and Local. [1] This is because a login request should have either
Sso or Local params, but not both at the same time.

The previous implementation called both `setSso` and `setLogin` on the same
object. This no longer works with the use of `oneof`, because calling `setLogin`
after `setSso` would clear the `Sso` params. [2]

[1] gravitational/teleport#10286 (comment)
[2] https://developers.google.com/protocol-buffers/docs/proto3#oneof_features

* Render ssh menu item as `NavLink` only when URL is provided

* Use connection dropdown instead of modal for supplying SSH username

* Adjust `Identity` layout, combine `logout` and `clusterRemove` into a single action

* Change command `cluster-remove` to `cluster-logout`

* Apply `Identity` design changes

* Enable `babel-plugin-styled-components` in production and tests (#697)

* Make connections icon bigger

* Properly use `css` prop

Co-authored-by: Grzegorz Zdunek <gzdunek@users.noreply.github.com>
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
@chenjinya
Copy link

chenjinya commented May 24, 2022

  1. download python 2.7 https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg
  2. install it.

@nanslee
Copy link

nanslee commented May 26, 2022

Hi, on MacOS 12.3.1 Chip M1 Pro, I did the following procedures: 1 - Use ASDF to install python v2: asdf install python 2.7.18 2 - Set Python on shell with asdf: asdf shell python 2.7.18 3 - Export PYTHON_PATH environment: export PYTHON_PATH=/Users/YOUR_USER/.asdf/shims/python

Bingo! Now I can create the .DMG again.

Hope this helps someone else who has gone through this too.

export PYTHON_PATH ... Is it to be added to the system level or the user level?

@ok-dok
Copy link

ok-dok commented Jun 29, 2022

thanks a lot, I resolve this problem by this configuration in package.json:

{
  ...
  "devDependencies": {
    ...
     "vue-cli-plugin-electron-builder": "^2.1.1",
  },
  "resolutions": {
    "vue-cli-plugin-electron-builder/electron-builder": "^23.0.6"
  },
  ...
}

It still fails on .6 here as well but I guess it's because this plugin still uses the old lib

 Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT
    at /Users/stan/projects/personal/WeakAuras-Companion/node_modules/vue-cli-plugin-electron-builder/node_modules/builder-util/src/util.ts:133:18
    at exithandler (node:child_process:406:5)

Edit: When I force it via npm override it works:

"overrides": {
    "vue-cli-plugin-electron-builder": {
      "electron-builder": "^23.0.6"
    }
  }

@jitendrawe360
Copy link

I've updated macOS 12.6, I'm using electron-builder version-22.8.1 and facing same problem of missing python on path: /usr/bin/python I've changed the hard coded path of /usr/bin/python to /usr/local/bin/python inside package dmg-builder in file out/dmg.js. now try to build and it worked perfectly.

await (0, _builderUtil().exec)("/usr/local/bin/python", [path.join((0, _dmgUtil().getDmgVendorPath)(), "dmgbuild/core.py")], { cwd: (0, _dmgUtil().getDmgVendorPath)(), env });

@rogeriomq
Copy link

Hello, I have solved this problem on macbook using ASDF, I set the python version in the shell where I am running the build. ex: asdf shell python 2.7.18
Hope this helps!!!

hatched pushed a commit to hatched/teleport-merge that referenced this issue Nov 30, 2022
hatched pushed a commit to gravitational/teleport that referenced this issue Dec 20, 2022
Keith-CY added a commit to nervosnetwork/neuron that referenced this issue Dec 21, 2022
MacOS is specified by version number explicitly because tag
"macos-latest" refers to macos-11 or macos-12 randomly during
GitHub action's transition while macos 12 removed Python 2 which
is required by electron-builder.

Since latest electron-builder has supported python3, this hotfix
will not introduce python2 in host but downgrade it to macos 12

Ref: electron-userland/electron-builder#6606
p10q pushed a commit to p10q/vite-reactts-electron-starter that referenced this issue Jan 16, 2023
and equally importantly upgrade electron-builder to 23.6+

per this bug
electron-userland/electron-builder#6606
alexsupa597 pushed a commit to alexsupa597/neuron that referenced this issue Feb 13, 2023
MacOS is specified by version number explicitly because tag
"macos-latest" refers to macos-11 or macos-12 randomly during
GitHub action's transition while macos 12 removed Python 2 which
is required by electron-builder.

Since latest electron-builder has supported python3, this hotfix
will not introduce python2 in host but downgrade it to macos 12

Ref: electron-userland/electron-builder#6606
alexsupa597 pushed a commit to alexsupa597/neuron that referenced this issue Feb 13, 2023
MacOS is specified by version number explicitly because tag
"macos-latest" refers to macos-11 or macos-12 randomly during
GitHub action's transition while macos 12 removed Python 2 which
is required by electron-builder.

Since latest electron-builder has supported python3, this hotfix
will not introduce python2 in host but downgrade it to macos 12

Ref: electron-userland/electron-builder#6606
@Shawn-Shan
Copy link

You could also just use python3. Change the default python to python3's, for example export PYTHON_PATH=/opt/homebrew/bin/python3. Then it will* have two errors on the python3 compatibility. Simply resolve those two errors through simple stackoverflow search (editing the core.js file that shown in the error report).

alexsupa597 pushed a commit to alexsupa597/neuron that referenced this issue Feb 26, 2023
MacOS is specified by version number explicitly because tag
"macos-latest" refers to macos-11 or macos-12 randomly during
GitHub action's transition while macos 12 removed Python 2 which
is required by electron-builder.

Since latest electron-builder has supported python3, this hotfix
will not introduce python2 in host but downgrade it to macos 12

Ref: electron-userland/electron-builder#6606
alexsupa597 pushed a commit to alexsupa597/neuron that referenced this issue Feb 28, 2023
MacOS is specified by version number explicitly because tag
"macos-latest" refers to macos-11 or macos-12 randomly during
GitHub action's transition while macos 12 removed Python 2 which
is required by electron-builder.

Since latest electron-builder has supported python3, this hotfix
will not introduce python2 in host but downgrade it to macos 12

Ref: electron-userland/electron-builder#6606
undergroundwires added a commit to undergroundwires/privacy.sexy that referenced this issue Jul 31, 2023
The GitHub-hosted runners began experiencing issues while building macOS
desktop distributions, exclusively affecting the macOS environment.
The Ubuntu and Windows environments remained unaffected.

The logs highlighted the absence of Python in the macOS environment, which
resulted in build failure:

```sh
  Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT
```

Since the `electron-builder` package uses Python scripts to create DMG
disk images for macOS distributions, Python is needed for building the
application. However, electron-builder uses Python 2.X meanwhile modern
macOS versions have removed Python 2.X from the operating system on
default installation.

Although this issue was resolved in `electron-builder` version 23,,
`vue-cli-plugin-electron-builder` continues to use version 22. Due to a
lack of maintenance, the package is unlikely to receive updates.

This commit forces `vue-cli-plugin-electron-builder` to use the latest
`electron-builder` which resolves the macOS distribution build failure.

In CI process, GitHub-hosted runners start to fail when building macOS
desktop distributions. It is only observered in the macOS environment
while the application is built successfully in both the Ubuntu and
Windows environments.

The error message in the logs indicated that Python was not found in the
macOS environment:

```sh
Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT
```

`electron-builder` package uses Python scripts for certain operations,
specifically for creating DMG disk images for macOS distributions. As a
result, Python is a necessary dependency when building the application
for macOS.

`electron-builder` has fixed this starting from version 23, but
vue-cli-plugin-electron-builder still refers to version 22 and it is
unmaintained and not likely to get updates.

The solution is to add a step in the GitHub Actions workflow to set up
Python in the macOS environment. `actions/setup-python` sets up the
Python environment in the runner if the OS is macOS.

This change does not impact the Ubuntu and Windows environments as the
setup-python step is conditionally executed only for macOS. The addition
of Python to the macOS environment in CI process has resolved the build
failure issue for the macOS distribution.

See also:

- electron-userland/electron-builder#6606
- electron-userland/electron-builder#6726
- electron-userland/electron-builder#6732
- nklayman/vue-cli-plugin-electron-builder#1691
- nklayman/vue-cli-plugin-electron-builder#1701
LarrMarburger added a commit to LarrMarburger/privacy.sexy that referenced this issue Nov 16, 2023
The GitHub-hosted runners began experiencing issues while building macOS
desktop distributions, exclusively affecting the macOS environment.
The Ubuntu and Windows environments remained unaffected.

The logs highlighted the absence of Python in the macOS environment, which
resulted in build failure:

```sh
  Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT
```

Since the `electron-builder` package uses Python scripts to create DMG
disk images for macOS distributions, Python is needed for building the
application. However, electron-builder uses Python 2.X meanwhile modern
macOS versions have removed Python 2.X from the operating system on
default installation.

Although this issue was resolved in `electron-builder` version 23,,
`vue-cli-plugin-electron-builder` continues to use version 22. Due to a
lack of maintenance, the package is unlikely to receive updates.

This commit forces `vue-cli-plugin-electron-builder` to use the latest
`electron-builder` which resolves the macOS distribution build failure.

In CI process, GitHub-hosted runners start to fail when building macOS
desktop distributions. It is only observered in the macOS environment
while the application is built successfully in both the Ubuntu and
Windows environments.

The error message in the logs indicated that Python was not found in the
macOS environment:

```sh
Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT
```

`electron-builder` package uses Python scripts for certain operations,
specifically for creating DMG disk images for macOS distributions. As a
result, Python is a necessary dependency when building the application
for macOS.

`electron-builder` has fixed this starting from version 23, but
vue-cli-plugin-electron-builder still refers to version 22 and it is
unmaintained and not likely to get updates.

The solution is to add a step in the GitHub Actions workflow to set up
Python in the macOS environment. `actions/setup-python` sets up the
Python environment in the runner if the OS is macOS.

This change does not impact the Ubuntu and Windows environments as the
setup-python step is conditionally executed only for macOS. The addition
of Python to the macOS environment in CI process has resolved the build
failure issue for the macOS distribution.

See also:

- electron-userland/electron-builder#6606
- electron-userland/electron-builder#6726
- electron-userland/electron-builder#6732
- nklayman/vue-cli-plugin-electron-builder#1691
- nklayman/vue-cli-plugin-electron-builder#1701
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment