zopefoundation / persistent

automatic persistence for Python objects
https://pypi.org/project/persistent/
Other
46 stars 28 forks source link

macOS: symbol not found in flat namespace '_ffi_prep_closure' #178

Closed jpmckinney closed 2 years ago

jpmckinney commented 2 years ago

BUG/PROBLEM REPORT

What I did:

pyenv virtualenv t
pyenv activate t
pip install --upgrade pip wheel
pip install persistent

What I expect to happen:

Installs persistent

What actually happened:

Collecting persistent
  Using cached persistent-4.9.1.tar.gz (125 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [28 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/cs/3pnj707s581bjnsfv0wndqkh0000gn/T/pip-install-4lbr8ckx/persistent_bce5b90a3bb04f5397a3cdb833ac68b9/setup.py", line 88, in <module>
          setup(name='persistent',
        File "/Users/james/.pyenv/versions/3.8.12/envs/tmp/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/Users/james/.pyenv/versions/3.8.12/lib/python3.8/distutils/core.py", line 108, in setup
          _setup_distribution = dist = klass(attrs)
        File "/Users/james/.pyenv/versions/3.8.12/envs/tmp/lib/python3.8/site-packages/setuptools/dist.py", line 434, in __init__
          _Distribution.__init__(self, {
        File "/Users/james/.pyenv/versions/3.8.12/lib/python3.8/distutils/dist.py", line 292, in __init__
          self.finalize_options()
        File "/Users/james/.pyenv/versions/3.8.12/envs/tmp/lib/python3.8/site-packages/setuptools/dist.py", line 743, in finalize_options
          ep(self)
        File "/Users/james/.pyenv/versions/3.8.12/envs/tmp/lib/python3.8/site-packages/setuptools/dist.py", line 750, in _finalize_setup_keywords
          ep.load()(self, ep.name, value)
        File "/private/var/folders/cs/3pnj707s581bjnsfv0wndqkh0000gn/T/pip-install-4lbr8ckx/persistent_bce5b90a3bb04f5397a3cdb833ac68b9/.eggs/cffi-1.15.1-py3.8-macosx-12.0-arm64.egg/cffi/setuptools_ext.py", line 219, in cffi_modules
          add_cffi_module(dist, cffi_module)
        File "/private/var/folders/cs/3pnj707s581bjnsfv0wndqkh0000gn/T/pip-install-4lbr8ckx/persistent_bce5b90a3bb04f5397a3cdb833ac68b9/.eggs/cffi-1.15.1-py3.8-macosx-12.0-arm64.egg/cffi/setuptools_ext.py", line 49, in add_cffi_module
          execfile(build_file_name, mod_vars)
        File "/private/var/folders/cs/3pnj707s581bjnsfv0wndqkh0000gn/T/pip-install-4lbr8ckx/persistent_bce5b90a3bb04f5397a3cdb833ac68b9/.eggs/cffi-1.15.1-py3.8-macosx-12.0-arm64.egg/cffi/setuptools_ext.py", line 25, in execfile
          exec(code, glob, glob)
        File "src/persistent/_ring_build.py", line 22, in <module>
          ffi = FFI()
        File "/private/var/folders/cs/3pnj707s581bjnsfv0wndqkh0000gn/T/pip-install-4lbr8ckx/persistent_bce5b90a3bb04f5397a3cdb833ac68b9/.eggs/cffi-1.15.1-py3.8-macosx-12.0-arm64.egg/cffi/api.py", line 48, in __init__
          import _cffi_backend as backend
      ImportError: dlopen(/private/var/folders/cs/3pnj707s581bjnsfv0wndqkh0000gn/T/pip-install-4lbr8ckx/persistent_bce5b90a3bb04f5397a3cdb833ac68b9/.eggs/cffi-1.15.1-py3.8-macosx-12.0-arm64.egg/_cffi_backend.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '_ffi_prep_closure'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

What version of Python and Zope/Addons I am using:

davisagli commented 2 years ago

Looks like a bug in cffi; see https://foss.heptapod.net/pypy/cffi/-/issues/518

jpmckinney commented 2 years ago

Aha, thanks, I had tried web search and didn't come across that result.

That ticket notes that there might be a clue in my output above:

Using cached ...

I ran pip cache purge, and now (since I upgraded to Ventura) I'm getting an error related to Command-Line Tools not being installed. I ran xcode-select --install and re-ran pip cache purge... but simply reproduced the above output.

Anyway, since it's not a persistent issue, I'll let you decide whether to close.

Edit: As noted in the linked ticket, temporarily moving mv /usr/local/bin/brew /usr/local/bin/brew_ before creating a virtualenv with pyenv allows pyenv to select the system cffi instead of Homebrew's.