ERROR: Package 'stomp.py' requires a different Python: 2.7.12 not in '>=3.6,<4.0'?
I am trying to install ElastAlert on my ubuntu 16.04 and whenever i run pip install elastalert i keep running into an error. I am currently running python 2.7.12. Any help would be appreciated. I am new to this so not sure what i am doing wrong. The error message is as follows:-
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020.
Please upgrade your Python as Python 2.7 is no longer maintained.
pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at Defaulting to user installation because normal site-packages is not writeable Collecting elastalert Using cached elastalert-0.2.4.tar.gz (128 kB) Requirement already satisfied: apscheduler>=3.3.0 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (3.6.3) Requirement already satisfied: aws-requests-auth>=0.3.0 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (0.4.2) Requirement already satisfied: blist>=1.3.6 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (1.3.6) Requirement already satisfied: boto3>=1.4.4 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (1.12.28) Requirement already satisfied: configparser>=3.5.0 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (4.0.2) Requirement already satisfied: croniter>=0.3.16 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (0.3.31) Collecting elasticsearch==7.0.0 Using cached elasticsearch-7.0.0-py2.py3-none-any.whl (80 kB) Requirement already satisfied: envparse>=0.2.0 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (0.2.0) Requirement already satisfied: exotel>=0.1.3 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (0.1.5) Collecting jira>=2.0.0 Using cached jira-2.0.0-py2.py3-none-any.whl (57 kB) Collecting jsonschema>=3.0.2 Using cached jsonschema-3.2.0-py2.py3-none-any.whl (56 kB) Collecting mock>=2.0.0 Using cached mock-3.0.5-py2.py3-none-any.whl (25 kB) Collecting prison>=0.1.2 Using cached prison-0.1.3-py2.py3-none-any.whl (5.8 kB) Requirement already satisfied: PyStaticConfiguration>=0.10.3 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (0.10.4) Collecting python-dateutil<2.7.0,>=2.6.0 Using cached python_dateutil-2.6.1-py2.py3-none-any.whl (194 kB) Requirement already satisfied: PyYAML>=3.12 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (5.3.1) Requirement already satisfied: requests>=2.10.0 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (2.23.0) Requirement already satisfied: stomp.py>=4.1.17 in /home/ubuntu/.local/lib/python2.7/site-packages (from elastalert) (6.0.0) ERROR: Package 'stomp.py' requires a different Python: 2.7.12 not in '>=3.6,<4.0' 1 2 Answers
The error is rather clear. The package you are trying to install only supports Python 3.6+.
Your options are either to install newer python (for which there are numerous guides online) or to upgrade to a newer Ubuntu LTS release (16.04 is getting close to the End Of Life).
1Looks like you somehow managed to install a newer version of stomp.py (6.0.0) which is incompatible with Python 2, which is only supported up to version 4.x.x.
I suggest you uninstall stomp.py and let it install the correct version again as a dependency. I tested it in a fresh Ubuntu 16.04 container and it worked fine for me, although keep in mind you also need the latest versions of pip and setuptools to build and install everything correctly, from what I tried:
pip install --upgrade pip
pip install --upgrade setuptools
pip uninstall stomp.py
pip install elastalertThat said, while it is possible to install elastalert on Python 2.7, it is also compatible with Python 3 (tested Ubuntu 16.04's default 3.5), which should be the way to go, unless you have something specific holding you back, since Python 2 is deprecated and no longer supported with updates.
apt install python3-pip
pip3 install elastalert 1