3

When following the quickstart UWSGI guide and attempting to start the server, the following error occurs:

ImportError: dlopen(/Users/xxxxxxxx/anaconda3/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so, 2): Symbol not found: _PyByteArray_Type
  Referenced from: /Users/xxxxxxxx/anaconda3/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so
  Expected in: flat namespace

Some things I've tried:

  • Reinstalling UWSGI - pip install --upgrade --force-reinstall --no-binary :all: --no-cache-dir uWSGI==2.0.17
  • Reinstalling anaconda

Clues:

  • The application will will run properly using the werkzeug development sever w/ no errors.
  • Running from struct import pack, unpack in the ~/anaconda3/bin/python interpreter does not cause an error
  • Both '~/anaconda3/bin/python3' and '/Users/xxxxxxxx/anaconda3/bin/uwsgi' contain the symbol (nm /Users/xxxxxxxx/anaconda3/bin/uwsgi | grep _PyByteArray_Type)

How can I fix this problem? If this is a novel issue, where should I report it? Is it a problem with how Conda compiled Python? UWSGI?

System:

  • OS: OSX 10.15.2
  • Conda: 4.7.12
  • UWSGI: 2.0.18
  • Architecture: x86_64

Full stack trace:

*** Starting uWSGI 2.0.18 (64bit) on [Wed Dec 18 19:46:58 2019] ***
compiled with version: 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4) on 17 December 2019 08:16:44
os: Darwin-19.2.0 Darwin Kernel Version 19.2.0: Sat Nov  9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64
nodename: base2010-6.local
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /private/tmp/mvp
detected binary path: /Users/xxxxxxxx/anaconda3/bin/uwsgi
your processes number limit is 2784
your memory page size is 4096 bytes
detected max file descriptor number: 256
lock engine: OSX spinlocks
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:3031 fd 3
Python version: 3.7.1 (default, Dec 14 2018, 13:28:58)  [Clang 4.0.1 (tags/RELEASE_401/final)]
Python main interpreter initialized at 0x7fcbd6c04a60
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 416560 bytes (406 KB) for 8 cores
*** Operational MODE: preforking+threaded ***
Traceback (most recent call last):
  File "myflaskapp.py", line 1, in <module>
    from flask import Flask
  File "/Users/xxxxxxxx/anaconda3/lib/python3.7/site-packages/flask/__init__.py", line 14, in <module>
    from jinja2 import escape
  File "/Users/xxxxxxxx/anaconda3/lib/python3.7/site-packages/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/Users/xxxxxxxx/anaconda3/lib/python3.7/site-packages/jinja2/environment.py", line 15, in <module>
    from jinja2 import nodes
  File "/Users/xxxxxxxx/anaconda3/lib/python3.7/site-packages/jinja2/nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "/Users/xxxxxxxx/anaconda3/lib/python3.7/site-packages/jinja2/utils.py", line 16, in <module>
    from jinja2._compat import text_type, string_types, implements_iterator, \
  File "/Users/xxxxxxxx/anaconda3/lib/python3.7/site-packages/jinja2/_compat.py", line 31, in <module>
    import pickle
  File "/Users/xxxxxxxx/anaconda3/lib/python3.7/pickle.py", line 33, in <module>
    from struct import pack, unpack
  File "/Users/xxxxxxxx/anaconda3/lib/python3.7/struct.py", line 13, in <module>
    from _struct import *
ImportError: dlopen(/Users/xxxxxxxx/anaconda3/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so, 2): Symbol not found: _PyByteArray_Type
  Referenced from: /Users/xxxxxxxx/anaconda3/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so
  Expected in: flat namespace
 in /Users/xxxxxxxx/anaconda3/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 9746)
spawned uWSGI worker 1 (pid: 9747, cores: 2)
spawned uWSGI worker 2 (pid: 9748, cores: 2)
spawned uWSGI worker 3 (pid: 9749, cores: 2)
spawned uWSGI worker 4 (pid: 9750, cores: 2)
*** Stats server enabled on 127.0.0.1:9191 fd: 16 ***
Genono
  • 41
  • 3
  • hello, do you happen to get a solution to this? beside completely uninstalling anaconda since my projects depends on it – Teguh Hidayat Mar 04 '20 at 07:28

1 Answers1

1

I had same problem and solved it with fully remove Anaconda python and install python through homebrew (brew install python).

FedOK
  • 11
  • 1