Elastalert: ImportError: No module named base.exceptions

Created on 10 Apr 2017  路  16Comments  路  Source: Yelp/elastalert

Hi, getting this error since I switched from v0.1.8 to master to get the Fix on AWS.

Creating Elastalert index in Elasticsearch...
Index elastalert_status already exists. Skipping index creation.
Traceback (most recent call last):
File "elastalert/elastalert.py", line 20, in
from alerts import DebugAlerter
File "/opt/elastalert/elastalert/alerts.py", line 26, in
from twilio.base.exceptions import TwilioRestException
ImportError: No module named base.exceptions

Can you please help me ?

Thanks,
Guillaume

Most helpful comment

Thank you @Qmando, your suggestions fixed it for me.
Here is my resulting docker installcommands :

RUN apk add --update \
    ca-certificates \
    openssl-dev \
    libffi-dev \
    build-base \
  && rm -rf /var/cache/apk/*

# Install Elastalert.
RUN python setup.py install && \
    pip install -e . && \
    pip uninstall twilio --yes && \
    pip install twilio==6.0.0

Notice I am now installing openssl-dev and libffi-dev, then forcing twillio 6.0.0

Thanks again.

All 16 comments

+1

pip install twilio==6.0.0

The default version I get is twilio 6.3.dev0 after python setup.py install

pip install twilio==6.0.0 crashes with compilation errors.
pip install twilio==5.7.0 works but Elastalert give same errors as reported.

You get this exception when 6.3.dev0 is installed?

Regarding the error for 6.0.0, is it while compiling cryptography library? You probably need libssl-dev and maybe libffi-dev

You get this exception when 6.3.dev0 is installed? Yes

I will look into suggested packages and report back

The compilation error is indeed related to cryptography library. I can install libffi-dev without problem, but libssl-dev is giving me this error :

/opt/elastalert # apk add libssl-dev
ERROR: unsatisfiable constraints:
  libssl-dev (missing):
    required by: world[libssl-dev]

Ah, this one is slightly different on apt and apk.
Try openssl-dev instead

i got same error in lasted version ElasticAlert (Centos 6)

Thank you @Qmando, your suggestions fixed it for me.
Here is my resulting docker installcommands :

RUN apk add --update \
    ca-certificates \
    openssl-dev \
    libffi-dev \
    build-base \
  && rm -rf /var/cache/apk/*

# Install Elastalert.
RUN python setup.py install && \
    pip install -e . && \
    pip uninstall twilio --yes && \
    pip install twilio==6.0.0

Notice I am now installing openssl-dev and libffi-dev, then forcing twillio 6.0.0

Thanks again.

Glad we could get this fixed. Sorry about the trouble! Changing library APIs and C extensions make it a little bit a of a nightmare sometimes.

I'm gonna try to move most of these to being optional.

I am getting the same error as above:

Traceback (most recent call last):
File "/usr/local/bin/elastalert-test-rule", line 9, in
load_entry_point('elastalert==0.1.12', 'console_scripts', 'elastalert-test-rule')()
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 560, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2648, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2302, in load
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2308, in resolve
File "/usr/local/lib/python2.7/dist-packages/elastalert-0.1.12-py2.7.egg/elastalert/test_rule.py", line 20, in
import elastalert.config
File "/usr/local/lib/python2.7/dist-packages/elastalert-0.1.12-py2.7.egg/elastalert/config.py", line 8, in
import alerts
File "/usr/local/lib/python2.7/dist-packages/elastalert-0.1.12-py2.7.egg/elastalert/alerts.py", line 26, in
from twilio.base.exceptions import TwilioRestException
ImportError: No module named base.exceptions

I installed twilio == 6.0.0 but not resolved the issue.

I have one python installed in my system.

I am not able to run this command as mentioned above i.e
RUN apk add --update
ca-certificates
openssl-dev
libffi-dev
build-base
&& rm -rf /var/cache/apk/*

Install Elastalert.

RUN python setup.py install &&
pip install -e . &&
pip uninstall twilio --yes &&
pip install twilio==6.0.0

it is telling like 馃憤
apk : Command not found.

Can anybody help me in resolving @Qmando;@gjobin

@anjan-cele

apk is for Alpine linux. If you are using Ubuntu (debian) you should use apt-get instead.

sudo apt-get update
sudo apt-get install libssl-dev libffi-dev

"I installed twilio == 6.0.0 but not resolved the issue."
If this were true you would not be getting that exception.
Try typing $ python -c "import twilio;print twilio.__version__"
How did you install it?

Hi @Qmando

apt-get worked for me. Thanks for suggesting.

But I am facing a new issue when I am testing the rule i.e

$ elastalert-test-rule example_rules/example_frequency.yaml

Following error I am getting -
Successfully loaded Example frequency rule

WARNING:elasticsearch:GET http://localhost:14900/ [status:N/A request:0.002s]
Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/elasticsearch/connection/http_requests.py", line 75, in perform_request
timeout=timeout or self.timeout)
File "/usr/local/lib/python2.7/dist-packages/requests-2.13.0-py2.7.egg/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests-2.13.0-py2.7.egg/requests/adapters.py", line 487, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='localhost', port=14900): Max retries exceeded with url: / (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',))
WARNING:elasticsearch:GET http://localhost:14900/ [status:N/A request:0.001s]

Can you tell me what is the issue here. Thanks

You didn't change the default es_host and es_port.

Error solved but email not working.
Does elastalert only work with postfix? Because that isn't going to be able to send mail outside its local server. Is there an option to connect to an SMTP server or Exchange server?

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PMDubuc picture PMDubuc  路  3Comments

shaohk picture shaohk  路  4Comments

Eyad87 picture Eyad87  路  4Comments

serialdoom picture serialdoom  路  3Comments

tkumark picture tkumark  路  3Comments