cluster.cpython-34m.so: undefined symbol: PyExcept

2019-09-04 05:56发布

问题:

This question already has an answer here:

  • Datastax Python cassandra driver build fails on Ubuntu 2 answers

I am running a simple python(3.4.3) flask app on amazon linux, which uses datastax cassandra-driver(3.6). My application is failing to import the module.

Traceback (most recent call last):
  File "application.py", line 12, in <module>
    from cassandra.cluster import Cluster
ImportError: /opt/python/run/venv/local/lib64/python3.4/site-packages/cassandra/cluster.cpython-34m.so: undefined symbol: PyException_Check
(venv)[ec2-user@ip-1-1-1-1 app]$ uname -a
Linux ip-1-1-1-1 4.4.15-25.57.amzn1.x86_64 #1 SMP Wed Jul 27 22:37:49 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Other Packages installed:
$ pip freeze
cassandra-driver==3.6.0
click==6.6
Flask==0.11
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
six==1.10.0
Werkzeug==0.11.11
xmltodict==0.10.2

回答1:

Latest version of Cython (0.25) released today broke cassandra-driver.

Workaround for this issue it to install Cython==0.24.1 before installing cassandra-driver.

(env) $ pip install Cython==0.24.1 (env) $ pip install cassandra-driver

You may need to remove existing cassandra-driver package first from site-packages:

rm -r $WHERE_PYTHON_IS_INSTALLED/lib/python2.7/site-packages/cassandra*

See https://datastax-oss.atlassian.net/browse/PYTHON-656 for more information