cqlsh not able to locate cassandra running on localhost [duplicate] - cassandra

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

Python3 reporting wrong version

I have a Raspberry Pi 4 running Raspbian 10. I've been trying to update the version of Python 3 that is installed so I can run Home Assistant which required 3.9.0, but it's all gone a bit pear shaped. The Pi runs a couple of other things so I'm doing a manual install instead of using the bundled Home Assistant OS.
I did have Python 3.7.3 installed. I then installed 3.9.0 apparently successfully. However running python3 --version
was still reporting 3.7.3. After a bit of Googling I managed to get the
python --version
command to show 3.9.0. But python3 stubbornly continues to report 3.7.3. How do I get
python3 --version
to report 3.9.0 instead of 3.7.3?
I've also tried installing Python 3.9.13, but that errors out so I've abandoned that for now.
I have run sudo apt update and sudo apt upgrade, so everything is as up to date as it can be.
BTW, I know very little about Linux, so I know I could have easily screwed things up.

python 3.7 venv broken after upgrade to Ubuntu 20.04

I've just upgraded to Ubuntu 20.04. I was working with a python 3.7 project using Django inside a virtual environment, so I was confident even with the upgraded distro (which involved the installation of python 3.8) my venv would still worked. Unfortunately, that's not the case: when I activate my venv, the interpreter of python is still the 3.8 version, and nothing works. python 3.7 is completely missing. What can I do to restore my project?
Same problem for me. This is my solution if you do not want to upgrade everything (perhaps not all package are upgradable).
Install python 3.7 which is gone with upgrade to ubuntu 20
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.7
in your virtualenv dir (e.g env/) edit last line in pyenv.cfg
version = 3.7
set back soft link of python3 in env/bin linking back to 3.7
ln -s /usr/bin/python3.7 python3
You may need to delete old symlik before creating new one
Now, should work: it does for me!
In my case, it was solved just by deleting and recreating the virtual env, and reinstalling Django, of course. After that, just reloaded Apache and everything worked again.

which python3 returns nothing after Ubuntu 20.04 upgrade

After I installed the new Ubuntu 20.04 (update form 19.10), Python seems to have major path problems, and also Jupyter notebooks are not working anymore.
which python3 returns nothing (no response)
If I try to install a new Python version with sudo apt install python3.8 I get the answer
python3.8 is already the newest version (3.8.2-1ubuntu1).
Trying export PYTHONPATH="/my/former/working/python/path" also changes
nothing (still no response to which python)
Did you check if you have Python in /usr/bin/python3?
If you do
sudo apt list | grep python
Do you see the Python package?
I think the best bet for you would be to remove python3 and install it again. I know 19.10 had Python 3.7 and 20.04 has Python 3.8 and that might be causing some conflict.
You can remove the Python package by
WARNING : USE WITH CAUTION THIS COMMAND MAY DELETE A LOT OF PACKAGES FROM YOUR SYSTEM
sudo apt purge python3
and reinstall with
sudo apt install python3

Upgradation to Python 3.7

I have Ubuntu 19.04 OS and I needed python 3.6 version so I somehow managed to get python3.6 on my device without removing python3.7 but now I would like to revert back to using python3.7. Can anyone suggest how to do it?
If you've got multiple version of Python installed, you can choose which one to use as default in update-alternatives:
sudo update-alternatives --config python3
, then follow the prompt instructions.
Try using virtual environments, namely anaconda for these kinds of things. I am not aware of any other methods. Anaconda basically creates a virtual environment in which you can specify the version of all packages including python itself

Installation guide for ROS-Kinetic with Python 3.5 on Ubuntu 16.04

I'm having a ROS-node that uses Python 3.5 and I want to run it on ROS-Kinetic. This is supposed to run on Ubuntu 16.04 with Kernel 4.4.
I've read that it's complicated to match ROS-Kinetic with Python 3 because it's not officially supported...but I've also read that it is possible to do so...
There are several installation guides for specific packages and I've tried some of them but failed everytime.
What I've tried so far:
1) Installed ROS-Kinetic-desktop-full
2) pip3 install rospkg catkin_pkg
3) export PYTHONPATH = /usr/local/lib/python3.5/dist-packages
When I'm running catkin_make, the first error appearing says:
... ImportError: No module named genmsg ...
Can anyone please write an exact installation guide for making ROS-Kinetic run with Python 3.5 (without a virtual environment) or tell me what's missing in my installation?
Thanks in advance!
An alternative to Some progammer's answer, you could install the packages in global space
sudo apt-get install python3-yaml # you'll also need this
sudo pip3 install rospkg catkin_pkg
or add --user flag
pip3 install --user rospkg catkin_pkg
People used Python 3.5 + ROS-Kinetic in Ubuntu before (for example, check out cozmo_driver) and it should work according to REP3.
You are not exporting the right folder to PYTHONPATH. Try
export PYTHONPATH=/opt/ros/kinetic/lib/python2.7/dist-packages/

Resources