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

SandboxViolation #101

Closed
nrcharles opened this issue Dec 24, 2020 · 34 comments
Closed

SandboxViolation #101

nrcharles opened this issue Dec 24, 2020 · 34 comments

Comments

@nrcharles
Copy link

On Big Sur:

Darwin Mac-mini.local 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:10 PDT 2020; root:xnu-7195.50.7~2/RELEASE_ARM64_T8101 arm64

Hit the following error.

Processing /usr/local/src/kiwi
ERROR: Command errored out with exit status 1:
command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/v7/p9qpjc0x773clsj_15lm34ch0000gn/T/pip-req-build-9u3hos4b/setup.py'"'"'; file='"'"'/private/var/folders/v7/p9qpjc0x773clsj_15lm34ch0000gn/T/pip-req-build-9u3hos4b/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/v7/p9qpjc0x773clsj_15lm34ch0000gn/T/pip-pip-egg-info-_w5wpn5d
cwd: /private/var/folders/v7/p9qpjc0x773clsj_15lm34ch0000gn/T/pip-req-build-9u3hos4b/
Complete output (166 lines):
warning: no files found matching '*.png' under directory 'docs/source'
no previously-included directories found matching '.git'
no previously-included directories found matching 'dist'
no previously-included directories found matching 'build'
no previously-included directories found matching 'docs/build'
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 172, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command
self.run_command(cmdname)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/install_lib.py", line 15, in run
self.byte_compile(outfiles)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/command/install_lib.py", line 132, in byte_compile
byte_compile(files, optimize=0,
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/util.py", line 466, in byte_compile
compile(file, cfile, dfile)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/py_compile.py", line 157, in compile
os.makedirs(dirname)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/os.py", line 213, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/os.py", line 213, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/os.py", line 213, in makedirs
makedirs(head, exist_ok=exist_ok)
[Previous line repeated 2 more times]
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/os.py", line 223, in makedirs
mkdir(name, mode)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/sandbox.py", line 310, in wrap
path = self._remap_input(name, path, *args, **kw)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/sandbox.py", line 452, in _remap_input
self._violation(operation, os.path.realpath(path), *args, **kw)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/sandbox.py", line 407, in _violation
raise SandboxViolation(operation, args, kw)
setuptools.sandbox.SandboxViolation: SandboxViolation: mkdir('/Users/Nathan/Library/Caches/com.apple.python/private/var/folders/v7/p9qpjc0x773clsj_15lm34ch0000gn/T/easy_install-gw_yrbny', 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.
@MatthieuDartiailh
Copy link
Member

Could you indicate what command led to this error? Am I right in thinking you are running on M1?

@nrcharles
Copy link
Author

I am running on M1.

python3 -m pip install kiwisolver.

I was able to install to venv and copy files over. The issue seems to be specific to the native python 3.8.

@RoyPrather
Copy link

Hi, I Just got this M1 Mac and am having the same issue installing kiwisolver. My unix chops could use some help, is there a post detailing the above workaround? Or is there any information I could provide to help resolve this issue?

@tyc85
Copy link

tyc85 commented Jan 10, 2021

Hi all, I have the same problem with Apple M1, and the workaround for me is downgrade to version 1.1, via (under venv)

pip install kiwisolver==1.1

Hope it's helpful. I am guessing it's a change of build method from 1.1 to 1.2 + Apple M1 change of some system package privileges.

@MatthieuDartiailh
Copy link
Member

Thanks @tyc85 for the update regarding the absence of issue in 1.1. I will try to have a look at what may have caused it. Once we can build wheels on M1 hopefully things will get better.

@darakian
Copy link

Seeing this issue on an intel mac with big sur as well for what it's worth.

@MatthieuDartiailh
Copy link
Member

Looking at the changelog the difference between 1.1 and 1.2, the key differences:

  • in 1.2 we need cppy to build which is installed using setup_requires
  • in 1.2 we explicitly link against libc++ rather than the old standard c++ library.

Could anybody able to reproduce the issue see if any of the following change anything ?

@MatthieuDartiailh
Copy link
Member

Also @darakian do you see this for the system Python or a different interpreter ?

@darakian
Copy link

darakian commented Feb 17, 2021

I've tried 3.8 and 3.9 out of brew and both show this issue. Have not tried the system default python.

Never mind. I thought I was using brew, but it looks like it is the system python
/Library/Developer/CommandLineTools/usr/bin/python3 with Python 3.8.2 as the output of -V

@MatthieuDartiailh
Copy link
Member

Let me know if you see the same with brew, @nrcharles believe it is only on the system Python and I would like to get a cross check.

@darakian
Copy link

Made a new venv with the brew python 3.9 and I'm still seeing it.

Slightly sanitized output follows

 • Installing kiwisolver (1.3.1): Failed

  EnvCommandError

  Command ['/Users/user/org/gits/project/venv/bin/pip', 'install', '--no-deps', '/Users/user/Library/Caches/pypoetry/artifacts/6a/82/86/fd39a938dea4c59d7aac6c812b2f6ee54590a88dff8a8a87a970630915/kiwisolver-1.3.1.tar.gz'] errored with the following return code 1, and output:
  Processing /Users/user/Library/Caches/pypoetry/artifacts/6a/82/86/fd39a938dea4c59d7aac6c812b2f6ee54590a88dff8a8a87a970630915/kiwisolver-1.3.1.tar.gz
      ERROR: Command errored out with exit status 1:
       command: /Users/user/org/gits/project/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3g/fpzgglls03vbzcvbwvgw0r540000gn/T/pip-req-build-sqxrm596/setup.py'"'"'; __file__='"'"'/private/var/folders/3g/fpzgglls03vbzcvbwvgw0r540000gn/T/pip-req-build-sqxrm596/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/3g/fpzgglls03vbzcvbwvgw0r540000gn/T/pip-pip-egg-info-v3jzu4of
           cwd: /private/var/folders/3g/fpzgglls03vbzcvbwvgw0r540000gn/T/pip-req-build-sqxrm596/
      Complete output (44 lines):
      WARNING: The wheel package is not available.
        ERROR: Command errored out with exit status 1:
         command: /Users/user/org/gits/project/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3g/fpzgglls03vbzcvbwvgw0r540000gn/T/pip-wheel-2ot7ntp6/cppy_e354f398e3a74de48d9cea59f602146b/setup.py'"'"'; __file__='"'"'/private/var/folders/3g/fpzgglls03vbzcvbwvgw0r540000gn/T/pip-wheel-2ot7ntp6/cppy_e354f398e3a74de48d9cea59f602146b/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/3g/fpzgglls03vbzcvbwvgw0r540000gn/T/pip-wheel-4_t8qnrn
             cwd: /private/var/folders/3g/fpzgglls03vbzcvbwvgw0r540000gn/T/pip-wheel-2ot7ntp6/cppy_e354f398e3a74de48d9cea59f602146b/
        Complete output (6 lines):
        usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
           or: setup.py --help [cmd1 cmd2 ...]
           or: setup.py --help-commands
           or: setup.py cmd --help

        error: invalid command 'bdist_wheel'
        ----------------------------------------
        ERROR: Failed building wheel for cppy
      ERROR: Failed to build one or more wheels
      Traceback (most recent call last):
        File "/Users/user/org/gits/project/venv/lib/python3.9/site-packages/setuptools/installer.py", line 75, in fetch_build_egg
          subprocess.check_call(cmd)
        File "/usr/local/Cellar/[email protected]/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/Users/user/org/gits/project/venv/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/3g/fpzgglls03vbzcvbwvgw0r540000gn/T/tmp_ya3opz3', '--quiet', 'cppy>=1.1.0']' returned non-zero exit status 1.

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/private/var/folders/3g/fpzgglls03vbzcvbwvgw0r540000gn/T/pip-req-build-sqxrm596/setup.py", line 69, in <module>
          setup(
        File "/Users/user/org/gits/project/venv/lib/python3.9/site-packages/setuptools/__init__.py", line 152, in setup
          _install_setup_requires(attrs)
        File "/Users/user/org/gits/project/venv/lib/python3.9/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
          dist.fetch_build_eggs(dist.setup_requires)
        File "/Users/user/org/gits/project/venv/lib/python3.9/site-packages/setuptools/dist.py", line 686, in fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/Users/user/org/gits/project/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 766, in resolve
          dist = best[req.key] = env.best_match(
        File "/Users/user/org/gits/project/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1051, in best_match
          return self.obtain(req, installer)
        File "/Users/user/org/gits/project/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1063, in obtain
          return installer(requirement)
        File "/Users/user/org/gits/project/venv/lib/python3.9/site-packages/setuptools/dist.py", line 745, in fetch_build_egg
          return fetch_build_egg(self, req)
        File "/Users/user/org/gits/project/venv/lib/python3.9/site-packages/setuptools/installer.py", line 77, in fetch_build_egg
          raise DistutilsError(str(e)) from e
      distutils.errors.DistutilsError: Command '['/Users/user/org/gits/project/venv/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/3g/fpzgglls03vbzcvbwvgw0r540000gn/T/tmp_ya3opz3', '--quiet', 'cppy>=1.1.0']' returned non-zero exit status 1.
      ----------------------------------------
  WARNING: Discarding file:///Users/user/Library/Caches/pypoetry/artifacts/6a/82/86/fd39a938dea4c59d7aac6c812b2f6ee54590a88dff8a8a87a970630915/kiwisolver-1.3.1.tar.gz. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.


  at /usr/local/lib/python3.9/site-packages/poetry/utils/env.py:1074 in _run
      1070│                 output = subprocess.check_output(
      1071│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1072│                 )
      1073│         except CalledProcessError as e:
    → 1074│             raise EnvCommandError(e, input=input_)
      1075│
      1076│         return decode(output)
      1077│
      1078│     def execute(self, bin, *args, **kwargs):

  • Installing kombu (4.6.11)

@MatthieuDartiailh
Copy link
Member

That's different from the originally reported error. Do you see the same after installing wheel ? I may have to be more specific in the setup_requires but it is annoying that setuptools try to use wheel but does not ensure it is present.

@darakian
Copy link

darakian commented Feb 17, 2021

You're right. So, my main project uses poetry to resolve dependencies and as far as I can tell the issue is poetry specific. Still investigating. I'll post again if I can get a minimal example going.

Edit:
To be explicit. Making a venv with brew python 3.9 and installing kiwisolver via pip in there works fine.

Edit the second:
With the following pyproject.toml

[tool.poetry]
name = "foo"
version = "1"
description = ""
authors = [""]

[tool.poetry.dependencies]
python = "^3.6"
kiwisolver = "=1.3.1"

In a fresh venv with brew python 3.9.1 a call to poetry install fails with the error above.

@MatthieuDartiailh
Copy link
Member

At this point I feel like blaming poetry for not providing wheels to a project using setuptools. May be worth asking over there.

@darakian
Copy link

At this point I feel like blaming poetry for not providing wheels to a project using setuptools. May be worth asking over there.

Will do. Thanks :)

@jmrnilsson
Copy link

jmrnilsson commented Mar 27, 2021

Getting sandbox violation in virtualenv, python 3.8 and Big Sur 11.2.3 with version >= 1.2.0. Downgrading to 1.1.0 circumvents this issue. Package is required by matplotlib.

    setuptools.sandbox.SandboxViolation: SandboxViolation: mkdir('/Users/someuser/Library/Caches/com.apple.python/private/var/folders/3y/pkwnc9195872xxbbb6srlgg40000gn/T/easy_install-9mmic8gj', 511) {}

Let me know if more information is needed.

@MatthieuDartiailh
Copy link
Member

MatthieuDartiailh commented Mar 27, 2021

Do you install from source or using a wheel ? Related questions, are you on Apple M1, and is this for the system Python ? Just want to know how similar it is to earlier reports.

@jmrnilsson
Copy link

Oh, right. MacBook Pro 16” 2019 so Intel and wheel.

I’ve been getting this for issue for another package. Can’t recall which right now. However there it was hinted the python needs be reinstalled. Could it be that python installation has been corrupted somehow?

@MatthieuDartiailh
Copy link
Member

Thanks. This is all quite confusing to me and since I do not have access to a Mac. Could you post the traceback you get ?

@jmrnilsson
Copy link

jmrnilsson commented Apr 3, 2021

I had to run with the --no-cache option since it seems kiwi 1.1.0, which I previously rolled back to, probably satisfied any requirements by Matplotlib or perhaps in turn numpy. That part considered the error looks the same to me.

Here are the relevant parts of requirements.txt:

lxml==4.6.2
flake8==3.9.0
luigi==3.0.2
numpy==1.20.1
# kiwisolver==1.1.0
matplotlib==3.4.0

Here goes:

Collecting kiwisolver>=1.0.1 (from matplotlib==3.4.0->-r requirements.txt (line 7))
  Downloading https://files.pythonhosted.org/packages/90/55/399ab9f2e171047d28933ae4b686d9382d17e6c09a01bead4a6f6b5038f4/kiwisolver-1.3.1.tar.gz (53kB)
     |████████████████████████████████| 61kB 518kB/s 
    ERROR: Command errored out with exit status 1:
     command: /Users/someuser/somerepo/.venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3y/pkwnc9195872xxbbb6srlgg40000gn/T/pip-install-nuazn_cn/kiwisolver/setup.py'"'"'; __file__='"'"'/private/var/folders/3y/pkwnc9195872xxbbb6srlgg40000gn/T/pip-install-nuazn_cn/kiwisolver/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: /private/var/folders/3y/pkwnc9195872xxbbb6srlgg40000gn/T/pip-install-nuazn_cn/kiwisolver/
    Complete output (166 lines):
    warning: no files found matching '*.png' under directory 'docs/source'
    no previously-included directories found matching '.git'
    no previously-included directories found matching 'dist'
    no previously-included directories found matching 'build'
    no previously-included directories found matching 'docs/build'
    Traceback (most recent call last):
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 172, in run
        cmd = self.call_command('install_lib', warn_dir=0)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command
        self.run_command(cmdname)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/command/install_lib.py", line 15, in run
        self.byte_compile(outfiles)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/command/install_lib.py", line 132, in byte_compile
        byte_compile(files, optimize=0,
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/util.py", line 466, in byte_compile
        compile(file, cfile, dfile)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/py_compile.py", line 157, in compile
        os.makedirs(dirname)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/os.py", line 213, in makedirs
        makedirs(head, exist_ok=exist_ok)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/os.py", line 213, in makedirs
        makedirs(head, exist_ok=exist_ok)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/os.py", line 213, in makedirs
        makedirs(head, exist_ok=exist_ok)
      [Previous line repeated 2 more times]
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/os.py", line 223, in makedirs
        mkdir(name, mode)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 310, in wrap
        path = self._remap_input(name, path, *args, **kw)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 452, in _remap_input
        self._violation(operation, os.path.realpath(path), *args, **kw)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 407, in _violation
        raise SandboxViolation(operation, args, kw)
    setuptools.sandbox.SandboxViolation: SandboxViolation: mkdir('/Users/someuser§/Library/Caches/com.apple.python/private/var/folders/3y/pkwnc9195872xxbbb6srlgg40000gn/T/easy_install-jknc96sz', 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.
    
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 154, in save_modules
        yield saved
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/var/folders/3y/pkwnc9195872xxbbb6srlgg40000gn/T/easy_install-jknc96sz/cppy-1.1.0/setup.py", line 15, in <module>
        # - py/kiwisolver.cpp
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 163, in setup
        raise SystemExit("error: " + str(msg))
    SystemExit: error: SandboxViolation: mkdir('/Users/someuser/Library/Caches/com.apple.python/private/var/folders/3y/pkwnc9195872xxbbb6srlgg40000gn/T/easy_install-jknc96sz', 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.
    
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 1144, in run_setup
        run_setup(setup_script, args)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 253, in run_setup
        raise
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/contextlib.py", line 131, in __exit__
        self.gen.throw(type, value, traceback)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/contextlib.py", line 131, in __exit__
        self.gen.throw(type, value, traceback)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 166, in save_modules
        saved_exc.resume()
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 141, in resume
        six.reraise(type, exc, self._tb)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/_vendor/six.py", line 685, in reraise
        raise value.with_traceback(tb)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 154, in save_modules
        yield saved
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/var/folders/3y/pkwnc9195872xxbbb6srlgg40000gn/T/easy_install-jknc96sz/cppy-1.1.0/setup.py", line 15, in <module>
        # - py/kiwisolver.cpp
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 163, in setup
        raise SystemExit("error: " + str(msg))
    SystemExit: error: SandboxViolation: mkdir('/Users/someuser/Library/Caches/com.apple.python/private/var/folders/3y/pkwnc9195872xxbbb6srlgg40000gn/T/easy_install-jknc96sz', 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.
    
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/3y/pkwnc9195872xxbbb6srlgg40000gn/T/pip-install-nuazn_cn/kiwisolver/setup.py", line 69, in <module>
        setup(
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/dist.py", line 716, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 780, in resolve
        dist = best[req.key] = env.best_match(
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1077, in obtain
        return installer(requirement)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/dist.py", line 786, in fetch_build_egg
        return cmd.easy_install(req)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 679, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 705, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 890, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 1158, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/Users/someuser/somerepo/.venv/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 1146, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: SandboxViolation: mkdir('/Users/someuser/Library/Caches/com.apple.python/private/var/folders/3y/pkwnc9195872xxbbb6srlgg40000gn/T/easy_install-jknc96sz', 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.
    
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

-Best of luck!

@MatthieuDartiailh
Copy link
Member

What MacOS X version are you running ? This is quite confusing since the wheel for MacOS for Python 3.8 is available at https://pypi.org/project/kiwisolver/1.3.1/#files so I really don't get why your system is trying to build from source.

Also could you try to clone the repo and manually build a wheel ? If you get the same error try to install cppy using pip (a bunch of c++ headers needed only at build time) first, maybe macOS dislike setup_requires. I would like to see the name of the produced wheel to get an idea of why the one on PyPI is not picked up.

@jmrnilsson
Copy link

jmrnilsson commented Apr 3, 2021

Big Sur 11.2.3. So it’s a later major version. Maybe that plays a part. Moreover, the distro probably also supports the M1 chip, although I’m running Intel.

Yeah, I could give it a try. But in a few days, I’m a little busy over the holidays.

@MatthieuDartiailh
Copy link
Member

MatthieuDartiailh commented Apr 3, 2021

From this issue (pypa/pip#9138), it appears that updating pip should fix the issue by accepting the wheels built for MacOS 10.9 on Big Sur (that is 11.x). Hopefully that is the only step you need to take to solve the issue.

@jmrnilsson
Copy link

Ok, i’ll start with that then.

@jmrnilsson
Copy link

Sorry, I cannot upgrade pip since I unfortunately depend on Python 2.7 support. But I can confirm there are a lot of things building on my OS. Especially, numpy breaks while building similar to the issue reported for pip.

@MatthieuDartiailh
Copy link
Member

I am not sure to follow why you cannot upgrade the pip used by your Python 3.8 install. It should not affect what pip is used by Python 2.7 (except if MacOS is doing something funky here).

@jmrnilsson
Copy link

Ok, maybe I’ll give a go then, in a few days time. Unfortunately busy at the moment.

@weakcamel
Copy link

weakcamel commented Aug 24, 2021

I can reproduce it on:

% uname -prsv
Darwin 20.5.0 Darwin Kernel Version 20.5.0: Sat May  8 05:10:31 PDT 2021; root:xnu-7195.121.3~9/RELEASE_ARM64_T8101 arm

% pip --version
pip 21.2.4 from /Users/foobar/venv/lib/python3.8/site-packages/pip (python 3.8)

% python --version # venv made with system-wide Python installation
Python 3.8.2

% 

So using latest pip doesn't help, however this is M1-specific. No such problems on an Intel Mac (which uses a prebuilt wheel).

@MatthieuDartiailh
Copy link
Member

@weakcamel Could you test the M1 wheel (see #102 (comment)) and see if it fixes the issue ? If they work I will upload them to PyPI.

@weakcamel
Copy link

weakcamel commented Aug 24, 2021

@MatthieuDartiailh yep, it installs just fine:

% pip3 install -i https://pypi.anaconda.org/multibuild-wheels-staging/simple kiwisolver
Looking in indexes: https://pypi.anaconda.org/multibuild-wheels-staging/simple
Collecting kiwisolver
  Downloading https://pypi.anaconda.org/multibuild-wheels-staging/simple/kiwisolver/1.3.1/kiwisolver-1.3.1-cp39-cp39-macosx_11_0_arm64.whl (59 kB)
     |████████████████████████████████| 59 kB 350 kB/s
Installing collected packages: kiwisolver
Successfully installed kiwisolver-1.3.1
% pip3 freeze | grep kiwi
kiwisolver==1.3.1

Not sure how to test it more TBH, I use kiwisolver as a dependency of a dependency.

@MatthieuDartiailh
Copy link
Member

You can clone the repo and run the test suite using pytest from inside the repositroy: pytest py/tests. Alternatively just use your code (I assume something involving matplotlib, so in that case specify constrained_layout=True when creating the figure).

Thanks for testing.

@weakcamel
Copy link

Ah, hang on - the Homebrew Python slipped in during the previous test.

All clear with latest pip and Python3.8 anyway:

% pip install -i https://pypi.anaconda.org/multibuild-wheels-staging/simple kiwisolver
Looking in indexes: https://pypi.anaconda.org/multibuild-wheels-staging/simple
Collecting kiwisolver
  Downloading https://pypi.anaconda.org/multibuild-wheels-staging/simple/kiwisolver/1.3.1/kiwisolver-1.3.1-cp38-cp38-macosx_11_0_arm64.whl (59 kB)
     |████████████████████████████████| 59 kB 351 kB/s
Installing collected packages: kiwisolver
Successfully installed kiwisolver-1.3.1

(.venv) % pytest py/tests
========================================================================================== test session starts ===========================================================================================
platform darwin -- Python 3.8.2, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/foouser/kiwi
collected 49 items

py/tests/test_constraint.py ........                                                                                                                                                               [ 16%]
py/tests/test_expression.py ............                                                                                                                                                           [ 40%]
py/tests/test_solver.py ........                                                                                                                                                                   [ 57%]
py/tests/test_strength.py ..                                                                                                                                                                       [ 61%]
py/tests/test_term.py ............                                                                                                                                                                 [ 85%]
py/tests/test_variable.py .......                                                                                                                                                                  [100%]

=========================================================================================== 49 passed in 0.21s ===========================================================================================
'Objective\n---------\n + 2 * e2 + 1 * s8 + -2 * s10\n\nTableau\n-------\nv1 |  + 1 * s10\ne3 |  + 1 * e2 + -1 * s10\nv4 |  + -1 * d5 + -1 * s10\ns6 |  + -1 * s10\ne9 |  + 1 * s8 + -1 * s10\n\nInfeasible\n----------\ne3\ne9\n\nVariables\n---------\nbar = v1\nfoo = v4\n\nEdit Variables\n--------------\nbar\n\nConstraints\n-----------\n1 * bar + -0 >= 0  | strength = 1\n1 * bar + 0 == 0  | strength = 1\n1 * bar + 1 <= 0  | strength = 1.001e+09\n1 * bar + 1 * foo + 0 == 0  | strength = 1.001e+09\n\n\n'%
(.venv) kiwi %

Thank you! Both for the wheel and the blazingly fast response :-)

@MatthieuDartiailh
Copy link
Member

Happy to help. I will do my best to push the M1 wheel on PyPI in the coming days.

@MatthieuDartiailh
Copy link
Member

The M1 wheels are now live ! @weakcamel since you reported that you did not observe the issue on Intel Mac and that the wheels are fine on M1 I will close this since I have no idea how to workaround the limitation Mac set up with respect to the OS interpreter when it comes to compilation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants