как исправить ошибку pika при запуске сервиса websocket от uwsgi в MACOS? - PullRequest
0 голосов
/ 26 марта 2019

step

выполнить затем ниже scirpt ws.py на uwsgi --http :8081 --module ws, затем получить ошибку от pika

# ws.py
import pika

def application(env, sr):
    while True:
        pass

error

Traceback (most recent call last):
  File "./ws.py", line 4, in <module>
    import pika
  File "/Users/john/.local/share/virtualenvs/djangotest-oHfjCwCX/lib/python3.7/site-packages/pika/__init__.py", line 9, in <module>
    from pika.connection import ConnectionParameters
  File "/Users/john/.local/share/virtualenvs/djangotest-oHfjCwCX/lib/python3.7/site-packages/pika/connection.py", line 7, in <module>
    import math
ImportError: dlopen(/Users/john/.local/share/virtualenvs/djangotest-oHfjCwCX/lib/python3.7/lib-dynload/math.cpython-37m-darwin.so, 2): Symbol not found: _PyExc_MemoryError
  Referenced from: /Users/john/.local/share/virtualenvs/djangotest-oHfjCwCX/lib/python3.7/lib-dynload/math.cpython-37m-darwin.so
  Expected in: flat namespace
 in /Users/john/.local/share/virtualenvs/djangotest-oHfjCwCX/lib/python3.7/lib-dynload/math.cpython-37m-darwin.so

environment

эта ошибка обнаружена в macos / python3.7, но ошибка исчезает в centos7 /python3.7

подробности

** Starting uWSGI 2.0.18 (64bit) on [Tue Mar 26 10:20:06 2019] ***
compiled with version: 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.10.44.4) on 25 March 2019 10:00:09
os: Darwin-18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64
nodename: john
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 12
current working directory: /Users/john/work/test/djangotest/reallog
detected binary path: /Users/john/.local/share/virtualenvs/djangotest-oHfjCwCX/bin/uwsgi
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 1418
your memory page size is 4096 bytes
detected max file descriptor number: 4864
lock engine: OSX spinlocks
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :8081 fd 4
spawned uWSGI http 1 (pid: 77034)
uwsgi socket 0 bound to TCP address 127.0.0.1:51126 (port auto-assigned) fd 3
Python version: 3.7.2 (default, Dec 29 2018, 00:00:04)  [Clang 4.0.1 (tags/RELEASE_401/final)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x7f8a8cd02330
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72904 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
Traceback (most recent call last):
  File "./ws.py", line 4, in <module>
    import pika
  File "/Users/john/.local/share/virtualenvs/djangotest-oHfjCwCX/lib/python3.7/site-packages/pika/__init__.py", line 9, in <module>
    from pika.connection import ConnectionParameters
  File "/Users/john/.local/share/virtualenvs/djangotest-oHfjCwCX/lib/python3.7/site-packages/pika/connection.py", line 7, in <module>
    import math
ImportError: dlopen(/Users/john/.local/share/virtualenvs/djangotest-oHfjCwCX/lib/python3.7/lib-dynload/math.cpython-37m-darwin.so, 2): Symbol not found: _PyExc_MemoryError
  Referenced from: /Users/john/.local/share/virtualenvs/djangotest-oHfjCwCX/lib/python3.7/lib-dynload/math.cpython-37m-darwin.so
  Expected in: flat namespace
 in /Users/john/.local/share/virtualenvs/djangotest-oHfjCwCX/lib/python3.7/lib-dynload/math.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 worker 1 (and the only) (pid: 77033, cores: 1)
...