influxdata / influxdata/kapacitor

Getting "TypeError: __init__() got an unexpected keyword argument 'syntax'" when running doc example of anomaly detection

Open
#2,011 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

I am trying to follow the example of custom anomaly detection given here https://docs.influxdata.com/kapacitor/v1.5/guides/anomaly_detection/ . I am following the exact steps given in the documentation using python2 environment but still not able to run the custom UDF. I keep getting this error `"TypeError: __init__() got an unexpected keyword argument 'syntax'"`.

The stack-trace looks like this
```
ts=2018-08-01T11:19:33.639-04:00 lvl=info msg="opened task master" service=kapacitor task_master=main
ts=2018-08-01T11:19:33.663-04:00 lvl=info msg="UDF log" service=udf text="Traceback (most recent call last):"
ts=2018-08-01T11:19:33.663-04:00 lvl=info msg="UDF log" service=udf text=" File \"/tmp/kapacitor_udf/ttest.py\", line 1, in "
ts=2018-08-01T11:19:33.663-04:00 lvl=info msg="UDF log" service=udf text=" from kapacitor.udf.agent import Agent, Handler"
ts=2018-08-01T11:19:33.663-04:00 lvl=info msg="UDF log" service=udf text=" File \"/tmp/kapacitor_udf/kapacitor/udf/agent/py/kapacitor/udf/agent.py\", line 7, in "
ts=2018-08-01T11:19:33.663-04:00 lvl=info msg="UDF log" service=udf text=" from kapacitor.udf import udf_pb2"
ts=2018-08-01T11:19:33.663-04:00 lvl=info msg="UDF log" service=udf text=" File \"/tmp/kapacitor_udf/kapacitor/udf/agent/py/kapacitor/udf/udf_pb2.py\", line 23, in "
ts=2018-08-01T11:19:33.663-04:00 lvl=info msg="UDF log" service=udf text=" \\x32\\x0c.agent.PointH\\x00\\x12\\x1e\\n\\x03\\x65nd\\x18\\x12 \\x01(\\x0b\\x32\\x0f.agent.EndBatchH\\x00\\x42\\t\\n\\x07message\\\"\\xf0\\x02\\n\\x08Response\\x12#\\n\\x04info\\x18\\x01 \\x01(\\x0b\\x32\\x13.agent.InfoResponseH\\x00\\x12#\\n\\x04init\\x18\\x02 \\x01(\\x0b\\x32\\x13.agent.InitResponseH\\x00\\x12-\\n\\tkeepalive\\x18\\x03 \\x01(\\x0b\\x32\\x18.agent.KeepaliveResponseH\\x00\\x12+\\n\\x08snapshot\\x18\\x04 \\x01(\\x0b\\x32\\x17.agent.SnapshotResponseH\\x00\\x12)\\n\\x07restore\\x18\\x05 \\x01(\\x0b\\x32\\x16.agent.RestoreResponseH\\x00\\x12%\\n\\x05\\x65rror\\x18\\x06 \\x01(\\x0b\\x32\\x14.agent.ErrorResponseH\\x00\\x12\\\"\\n\\x05\\x62\\x65gin\\x18\\x10 \\x01(\\x0b\\x32\\x11.agent.BeginBatchH\\x00\\x12\\x1d\\n\\x05point\\x18\\x11 \\x01(\\x0b\\x32\\x0c.agent.PointH\\x00\\x12\\x1e\\n\\x03\\x65nd\\x18\\x12 \\x01(\\x0b\\x32\\x0f.agent.EndBatchH\\x00\\x42\\t\\n\\x07message*!\\n\\x08\\x45\\x64geType\\x12\\n\\n\\x06STREAM\\x10\\x00\\x12\\t\\n\\x05\\x42\\x41TCH\\x10\\x01*D\\n\\tValueType\\x12\\x08\\n\\x04\\x42OOL\\x10\\x00\\x12\\x07\\n\\x03INT\\x10\\x01\\x12\\n\\n\\x06\\x44OUBLE\\x10\\x02\\x12\\n\\n\\x06STRING\\x10\\x03\\x12\\x0c\\n\\x08\\x44URATION\\x10\\x04\\x62\\x06proto3')"
ts=2018-08-01T11:19:33.663-04:00 lvl=info msg="UDF log" service=udf text="TypeError: __init__() got an unexpected keyword argument 'syntax'"

```

I suspect this could be the problem because of my protobuf installation, but I am not very sure. Before getting this error, I was getting `"ImportError: No module named google.protobuf.internal"`, I then install protobuf using `pip install protobuf` and also `apt-get install python-protobuf` which resulted in the above issue.

I am running Kapacitor version `1.4.0` on ubuntu `16.04`
Edit: I updated my Kapacitor version to `1.5.0` but the issue still persists

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the custom anomaly detection example at the linked documentation URL and reproduce it in the stated Python 2, Kapacitor 1.5.0, Ubuntu 16.04 environment. Inspect the traceback paths under /tmp/kapacitor_udf/, especially kapacitor/udf/agent.py and udf_pb2.py, along with the installed protobuf versions. Done means the documented UDF example runs without the import or syntax TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.