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

Uses cassandra-driver from /usr/share/cassandra/lib on systems with Cassandra installed #39

Open
mgmartian opened this issue May 13, 2024 · 1 comment

Comments

@mgmartian
Copy link

In cqlsh/cqlsh.py, there's this bit:

if platform.system() == 'Linux':
    ZIPLIB_DIRS.append('/usr/share/cassandra/lib')

On systems that have Cassandra installed, this causes cqlsh to use the cassandra-driver that was installed with the cassandra RPM in preference to the one included in the venv.

In our case, this causes a failure because the cassandra-driver included with Cassandra 3.11.15 in /usr/share/cassandra/lib is not compatible with Python 3.10.

$ cqlsh
Traceback (most recent call last):
  File "/some/venv/bin/cqlsh", line 5, in <module>
    from cqlsh.__main__ import main
  File "/some/venv/lib/python3.10/site-packages/cqlsh/__main__.py", line 3, in <module>
    from cqlsh.cqlsh import main as cqlsh_main
  File "/some/venv/lib/python3.10/site-packages/cqlsh/cqlsh.py", line 134, in <module>
    from cassandra.cluster import Cluster
  File "/usr/share/cassandra/lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/cluster.py", line 22, in <module>
ImportError: cannot import name 'Mapping' from 'collections' (python3.10.13-cp310-cp310-manylinux2014_x86_64/squashfs-root/opt/python3.10/lib/python3.10/collections/__init__.py)
$ 

To get around this, we set CQLSH_NO_BUNDLED=1 which disables this behavior... but it seems like when repackaging cqlsh, you should comment out these two lines instead.

@mgmartian
Copy link
Author

BTW: Thanks for repackaging cqlsh - we really appreciate this project!

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

1 participant