build-tools
build-tools copied to clipboard
Python error when running "e init"
Operating system: OSX 10.14.6
When following the README and I run the following command,
e init --root=~/electron --bootstrap testing
I get the following error (error truncated to most relevant parts),
[0:00:02] fetch +refs/tags/*:refs/tags/* took 0.0 minutes
[0:00:02] Fetching +refs/branch-heads/*:refs/branch-heads/*
[0:00:02] running "git fetch -v --progress --prune origin +refs/branch-heads/*:refs/branch-heads/*" in "/Users/macbook/.git_cache/github.com-electron-electron"
[0:00:02] fetch +refs/branch-heads/*:refs/branch-heads/* took 0.0 minutes
Traceback (most recent call last):
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient_scm.py", line 1044, in _Clone
print_stdout=print_stdout, filter_fn=filter_fn)
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient_scm.py", line 1400, in _Run
if self._IsRunningUnderRosetta():
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient_scm.py", line 1383, in _IsRunningUnderRosetta
libSystem = ctypes.CDLL("libSystem.dylib")
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(libSystem.dylib, 6): image not found
----------------------------------------
Traceback (most recent call last):
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/metrics.py", line 267, in print_notice_and_exit
yield
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient.py", line 3195, in <module>
sys.exit(main(sys.argv[1:]))
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient.py", line 3181, in main
return dispatcher.execute(OptionParser(), argv)
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/subcommand.py", line 252, in execute
return command(parser, args[1:])
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient.py", line 2737, in CMDsync
ret = client.RunOnDeps('update', args)
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient.py", line 1780, in RunOnDeps
patch_refs=patch_refs, target_branches=target_branches)
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient_utils.py", line 947, in flush
reraise(e[0], e[1], e[2])
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient_utils.py", line 1024, in run
self.item.run(*self.args, **self.kwargs)
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient.py", line 926, in run
file_list)
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient_scm.py", line 132, in RunCommand
return getattr(self, command)(options, args, file_list)
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient_scm.py", line 546, in update
self._Clone(revision, url, options)
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient_scm.py", line 1044, in _Clone
print_stdout=print_stdout, filter_fn=filter_fn)
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient_scm.py", line 1400, in _Run
if self._IsRunningUnderRosetta():
File "/Users/macbook/.electron_build_tools/third_party/depot_tools/gclient_scm.py", line 1383, in _IsRunningUnderRosetta
libSystem = ctypes.CDLL("libSystem.dylib")
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(libSystem.dylib, 6): image not found
ERROR Error: Command failed: python /Users/macbook/.electron_build_tools/third_party/depot_tools/gclient.py sync --with_branch_heads --with_tags -vv -v --ignore_locks
at checkExecSyncError (child_process.js:621:11)
at Object.execFileSync (child_process.js:639:15)
at Object.depotExecFileSync [as execFileSync] (/Users/macbook/.electron_build_tools/src/utils/depot-tools.js:97:16)
at runGClientSync (/Users/macbook/.electron_build_tools/src/e-sync.js:37:9)
at Object.<anonymous> (/Users/macbook/.electron_build_tools/src/e-sync.js:50:3)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
ERROR Error: Command failed: /Users/macbook/.nvm/versions/node/v12.14.1/bin/node /Users/macbook/.electron_build_tools/src/e sync -v --ignore_locks
at checkExecSyncError (child_process.js:621:11)
at Object.execFileSync (child_process.js:639:15)
at Object.<anonymous> (/Users/macbook/.electron_build_tools/src/e-init.js:184:18)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11
I was able to get around this error by disabling SIP protection - not an approach I plan to keep for the longterm.
Has anyone encountered this and how did you go about getting e init to work without having to disable SIP?
@SimplyAhmazing Personally I'm on Catalina so can't test Mojave but it was definitely working on that OS back when we first wrote this. I always install python through brew though so I'd suggest doing that as this might be a problem specific to the system installed version of python.
I am also having this error on Mojave. I have Python 2.7 and this error persists.
Confirmed that updating to Catalina resolves this issue.
As a side-note regarding MacOS setup build instructions.
brew install python@2 && brew link python@2 --force
Homebrew provided a python@2 formula until the end of 2019, at which point it was removed due to the Python 2 deprecation.
Closing in agreement with above - python version correction should address this issue.