Unified installer SandboxViolation buildout error on macOS Catalina 10.15.7

Continuing the discussion from Plone 5.2.3 soft released:

I've been running into this weird SandboxViolation issue with buildout being unable to install buildout.sanitycheck. My search-fu isn't working today...

$ bin/buildout
Getting distribution for 'buildout.sanitycheck==1.0.2'.
WARNING: The easy_install command is deprecated and will be removed in a future version.
error: Setup script exited with error: SandboxViolation: mkdir('/Users/kimadmin/Library/Caches/com.apple.python/private/var/folders/lx/6chcd57j7w16ycjwnn_x9xg00000gx/T/easy_install-agu5gl4a', 511) {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.

An error occurred when trying to install /Users/kimadmin/Plone/buildout-cache/downloads/dist/buildout.sanitycheck-1.0.2.zip. Look above this message for any errors that were output by easy_install.
While:
  Installing.
  Loading extensions.
  Getting distribution for 'buildout.sanitycheck==1.0.2'.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/Users/kimadmin/Plone/zinstance/lib/python3.8/site-packages/zc/buildout/buildout.py", line 2174, in main
    getattr(buildout, command)(args)
  File "/Users/kimadmin/Plone/zinstance/lib/python3.8/site-packages/zc/buildout/buildout.py", line 658, in install
    self._load_extensions()
  File "/Users/kimadmin/Plone/zinstance/lib/python3.8/site-packages/zc/buildout/buildout.py", line 1182, in _load_extensions
    zc.buildout.easy_install.install(
  File "/Users/kimadmin/Plone/zinstance/lib/python3.8/site-packages/zc/buildout/easy_install.py", line 957, in install
    return installer.install(specs, working_set)
  File "/Users/kimadmin/Plone/zinstance/lib/python3.8/site-packages/zc/buildout/easy_install.py", line 682, in install
    for dist in self._get_dist(requirement, ws):
  File "/Users/kimadmin/Plone/zinstance/lib/python3.8/site-packages/zc/buildout/easy_install.py", line 574, in _get_dist
    dists = [_move_to_eggs_dir_and_compile(dist, self._dest)]
  File "/Users/kimadmin/Plone/zinstance/lib/python3.8/site-packages/zc/buildout/easy_install.py", line 1745, in _move_to_eggs_dir_and_compile
    [tmp_loc] = glob.glob(os.path.join(tmp_dest, '*'))
ValueError: not enough values to unpack (expected 1, got 0)

This was reported on Windows about a year ago https://github.com/plone/simple-plone-buildout/issues/12 but clearly it's not platform specific. I will try this out on Ubuntu next.

This answer was a little discouraging! https://stackoverflow.com/questions/59601673/error-setup-script-exited-with-error-sandboxviolation#59601728 "Please inform the package's author and the EasyInstall maintainers to find out if a fix or workaround is available."

On Ubuntu 20.04 LTS, the unified installer fails, trying to find buildout.sanitycheck:

$ ./install.sh --with-python=`which !$` standalone
./install.sh --with-python=`which python3` standalone

Testing /usr/bin/python3 for Zope/Plone requirements....
/usr/bin/python3 looks OK. We will use it.

Rootless install method chosen. Will install for use by system user ubuntu


Detailed installation log being written to /home/ubuntu/Plone-5.2.3-UnifiedInstaller/install.log
Installing Plone 5.2.3 at /home/ubuntu/Plone

Creating Python virtual environment.
Using base prefix '/usr'
New python executable in /home/ubuntu/Plone/zinstance/bin/python3
Also creating executable in /home/ubuntu/Plone/zinstance/bin/python
Installing setuptools, pip, wheel...
done.
Installing Python requirements in virtual environment.
Unpacking buildout cache to /home/ubuntu/Plone/buildout-cache
Copying Plone-docs
Copying buildout skeleton
Building Zope/Plone; this takes a while...
Buildout returned an error code: 1; Aborting.
Buildout failed. Unable to continue

Installation has failed.
See the detailed installation log at /home/ubuntu/Plone-5.2.3-UnifiedInstaller/install.log
to determine the cause.

The install.log:

Detailed installation log
Starting at Wed Nov 18 17:18:17 UTC 2020
Ignoring pywin32: markers 'platform_system == "Windows"' don't match your environment
Ignoring ntfsutils: markers 'platform_system == "Windows" and python_version < "3.0"' don't match your environment
Collecting setuptools==42.0.2
  Downloading setuptools-42.0.2-py2.py3-none-any.whl (583 kB)
Collecting zc.buildout==2.13.3
  Downloading zc.buildout-2.13.3-py2.py3-none-any.whl (153 kB)
Requirement already satisfied: wheel in /home/ubuntu/Plone/zinstance/lib/python3.8/site-packages (from -r /home/ubuntu/Plone/tmp/base_skeleton/requirements.txt (line 3)) (0.35.1)
Installing collected packages: setuptools, zc.buildout
  Attempting uninstall: setuptools
    Found existing installation: setuptools 50.3.2
    Uninstalling setuptools-50.3.2:
      Successfully uninstalled setuptools-50.3.2
Successfully installed setuptools-42.0.2 zc.buildout-2.13.3
Not found: /home/ubuntu/Plone/buildout-cache/downloads/dist/buildout.sanitycheck/
Not found: /home/ubuntu/Plone/buildout-cache/downloads/dist/buildout.sanitycheck/
Couldn't find index page for 'buildout.sanitycheck' (maybe misspelled?)
Getting distribution for 'buildout.sanitycheck==1.0.2'.
Not found: /home/ubuntu/Plone/buildout-cache/downloads/dist/buildout.sanitycheck/
Not found: /home/ubuntu/Plone/buildout-cache/downloads/dist/buildout.sanitycheck/
Couldn't find index page for 'buildout.sanitycheck' (maybe misspelled?)
While:
  Installing.
  Loading extensions.
  Getting distribution for 'buildout.sanitycheck==1.0.2'.
Error: Couldn't find a distribution for 'buildout.sanitycheck==1.0.2'.

But when I go to the ~/Plone/zinstance directory and run bin/buildout it seems to work ok:

$ bin/buildout
Getting distribution for 'buildout.sanitycheck==1.0.2'.
WARNING: The easy_install command is deprecated and will be removed in a future version.
Got buildout.sanitycheck 1.0.2.
Creating directory '/home/ubuntu/Plone/zinstance/parts'.
Creating directory '/home/ubuntu/Plone/zinstance/develop-eggs'.
Getting distribution for 'plone.recipe.zope2instance==6.8.1'.
Got plone.recipe.zope2instance 6.8.1.
Getting distribution for 'zc.recipe.egg==2.0.7'.
WARNING: The easy_install command is deprecated and will be removed in a future version.
Got zc.recipe.egg 2.0.7.
Getting distribution for 'waitress==1.4.4'.
Got waitress 1.4.4.
Getting distribution for 'six==1.15.0'.
Got six 1.15.0.
Getting distribution for 'Zope==4.5.3'.
Got Zope 4.5.3.
...

It's looking more and more to me like the unified installer does not run on Windows nor on macOS.

I am out of my depth figuring this out!

You may want to have a look at my PR here https://github.com/plone/Installers-UnifiedInstaller/pull/110
Happy to discuss it, if you want we can have a call?

I too get this error running latest plone docker image in Macbook Pro M1. Looks like the image is not updated with the fix?

easy_install --version
setuptools 41.0.1 from /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (Python 2.7)

Maybe the setuptools should be from python3.

Hi @tkimnguyen , For solving the error, did you do anything apart from setting the python path?
This is my output of which python3 : /opt/homebrew/opt/python@3.8/bin/python3
I'm getting this error on Macbook M1 (Big Sur 11.4).

Also I'm using the buildout not unified installer.