cqlsh connection error: 'ref() does not take keyword arguments' - python

I've tried all the measures from this post and Cassandra doc.
I've tried running all the versions of Cassandra including the latest release 3.7 from tarball and Debian package, but I keep getting errors when I execute cqlsh.
Error:
Connection error: ('Unable to connect to any servers', {'127.0.0.1': TypeError('ref() does not take keyword arguments',)})
I had no problem running Cassandra before I upgraded my Linux Mint from 17.3 to 18.
I believe I installed all the necessary packages such as java 8 and python 2.7.12.
I think the problem exists in cassandra.yaml file since the default setting isn't working, but I'm not sure how to configure properly to get it running.
Any suggestions appreciated.

You are running into CASSANDRA-11850, where cqlsh breaks with Python 2.7.11+. This ticket has been marked as "Resolved" and a patch has been applied to Cassandra 3.9 which has not been released yet.
I believe I installed all the necessary packages such as java 8 and python 2.7.12.
In the interim (until 3.9 is released) you can roll back to Python 2.7.10, and cqlsh should work (not trivial). Otherwise, DataStax DevCenter should work with Cassandra 3.7.
Edit 20161020
Cassandra 3.9 was released a few weeks ago, and can now be downloaded.

refer https://issues.apache.org/jira/browse/CASSANDRA-11850
After setting environment variable
CQLSH_NO_BUNDLED=TRUE
it resolved.
I use windows 7, python 2.7.12, cassandra 3.7

Need to add following command
sudo apt install python-pip
pip install cassandra-driver
export CQLSH_NO_BUNDLED=true

This works for Ubuntu 16.04 in Amazon EC2:
sudo apt-get --no-install-recommends install python-cassandra python3-cassandra
CQLSH_NO_BUNDLED=TRUE cqlsh "$(ec2metadata --local-ipv4)"

Even if after rolling back to python 2.7.10, the issue persists. It means the python 2.7.10 is not set as the default python version.
Go to /usr/bin directory and check the different python versions available, say python2.7 corresponds to version 2.7.10 ( you can check it by running command python2.7 in your terminal and the python version will be mentioned in the first line of the Interpreter,try the same with all other python versions available in the folder to find the one which corresponds to version 2.7.10).
Now, use the following commands to make correct python version (python2.7 in my case) as default choice
update-alternatives --install /usr/bin/python python /usr/bin/python2.7

It may be possible as you have not installed cassandra-driver.
As I also faced the same problem and I solved using following such steps.
Try installing python pip then install cassandra-driver.
1.sudo apt install python-pip
2.pip install cassandra-driver

Related

Problem In Installing MySql Connector for Python

Hi I have just started learning sql language in MySql and have completed basic level of the language.
Now I want to access mysql databases from python. I got to know that we need to install MYSQL_Connector for Python to achieve this goal.
But, When i tried to install python-connector for mysql it gives an error that python version not found/
I tried to install it but it failed even though i have python 3.11.0 installed on my pc.
I tried to Reinstall both python and mYsql but it Doesn't worked.
Please help me with this problem
With the error that you've described, it seems that you're using the Windows MSI installer. But there's an issue in the Connector/Python 8.0.31 installer for Python 3.11, that will be fixed in the upcoming release, see https://bugs.mysql.com/bug.php?id=108911
Meanwhile, the solution is performing the installation using the wheel package, actually it's the recommended way of installing Connector/Python.
As described by Oscar in the bug report above, you can run:
Console (CMD or PowerShell)
--------------------------------
> pip install mysql-connector-python
or
> python -m pip install mysql-connector-python

How do I resolve "failed to create interpreter" in pycharm pro in linux(ubuntu)

I recently ported into the linux os , any time I try to create a new flask project or any other project it doesn't install the package but it shows 'failed to create interpreter' .
Although I can manually set the interpreter up,but I would like a smoother workflow. My guess is that the problem should not be from pycharm but rather how ubuntu is configured.
The version of the pycharm pro is pycharm-2022.1.2
Python version is 3.10.2.
Ubuntu version is 22.04 LTS .
sudo apt install python3-distutils fixed it.
This problem can be caused by a bad installation of Pycharm or an absence of the Java package. If you are using the version of Pycharm provided on the JetBrains website, this behavior is normal and I advise you to install Pycharm via snap. To do so, execute the following command in your terminal:
sudo snap install pycharm-professional --classic
If you have installed Pycharm this way, this error may come from your Java version. At this moment type this command in your terminal:
sudo apt install default-jre
If none of this worked, uninstall Pycharm: sudo snap remove pycharm-professional. Then reinstall it.

Change python version in google colab which is connected with google cloud

I am using python 3.7 in google colab, but for some reason when I am connected with a linux server in google cloud the python becomes 2.7. How can I change it? Note that python 3.7 is already installled in the server.
I tried these things but weren't helpful.
apt update
sudo apt install python3-pip
alias pip='pip3'
I checked also these sites https://cloud.google.com/python/docs/setup#linux_2, How do I install Python 3.7 in google cloud shell but didn't solve my problem.
Edit
By doing Runtime --> Change runtime I can see only this, which the options are 'non', 'gpu', 'tpu'.
You can check your Python version at the command line by running python --version. In Colab, we can enforce the Python version by clicking Runtime -> Change Runtime Type and selecting python3.
Python 2.7 is expected to be removed in Debian "testing", the basis of gLinux. This is expected to happen shortly after the next major version, Debian Bullseye, is released.
You need to migrate Python 2.7 code to Python 3 and remove python-is-python2 packages you might have installed.
When Python 2.7 is removed from gLinux, python-is-python2 will be uninstalled.
If you have software that requires /usr/bin/python to work, but can be used with Python 3, you should install python-is-python3.
You can change Python version by running the following commands in terminal:
pip install virtualenv
virtualenv venv --python=python3
This only works if you have Python2.7 installed at the system level (e.g. /usr/bin/python2.7).
You can find the path to your Python installation with
which python3
virtualenv venv --python=/usr/local/bin/python3
And check the version using python3 –version.
So actually the answer of my question comes from this post How to completely uninstall python 2.7.13 on Ubuntu 16.04.
Everyone who have a similar problem the first thing that he/she should do is to unistall python 2.7 by using either
sudo apt install --reinstall python python-apt python2.7-minimal
or
sudo apt purge python2.x-minimal
and then install python 3.7, by using
sudo ln -s /usr/bin/python3 /usr/bin/python
sudo apt install -y python3-pip
sudo ln -s /usr/bin/pip3 /usr/bin/pip
# Confirm the new version of Python: 3
python --version

Using Python3 with Pymongo in Eclipse Pydev on Ubuntu

I am currently trying to run Pydev with Pymongo on an Python3.3 Interpreter.
My problem is, I am not able to get it working :-/
First of all I installed Eclipse with Pydev.
Afterwards I tried installing pip to download my Pymongo-Module.
Problem is: it always installs pip for the default 2.7 Version.
I read that you shouldn't change the default system Interpreter (running on Lubuntu 13.04 32-Bit) so I tried to install a second Python3.3 and run it in an virtual environement, but I can't find any detailed Information on how to use everything on my specific problem.
Maybe there is someone out there, that uses a similar configuration and can help me out to get everything running (in a simple way) ?
Thanks in advance,
Eric
You can install packages for a specific version of Python, all you need to do is specify the version of Python you want use from the command-line; e.g. Python2.7 or Python3.
Examples
Python3 pip your_package
Python3 easy_install your_package.

python binary version doesnt match rpm version

I have installed manually python (2.7.3). Whoc do I update the rpm version
usr/bin/python -V:
Python 2.7.3
rpm -qf /usr/bin/python:
python-2.6.5-3.el6.x86_64
any suggestions?
linux version: RH6.3
You installed it incorrectly. Instead of make install you should run make altinstall. This will install the new version of Python parallel to existing versions, and create a new executable in $PREFIX/bin with the name of python followed by the minor version of Python installed, e.g. python2.7.
Create a symlink in /usr/bin/ called python2.7, point to to where you have installed the new Python and use that.
Do not attempt to upgrade or force the default python on a redhat box, because a lot of other tools will stop working.

Categories