Package: python3-influxdb-client
Version: 1.40.0-3
I recently upgraded to Debian trixie and installed the
python3-influxdb-client/stable lib via apt. Since I am using the async
version of it, I encountered a
ModuleNotFoundError "aiocsv"
when using the query_api() of InfluxDBClientAsync. I am using Debian 13/trixie.
The import of aiocsv is a local import as seen in
https://github.com/influxdata/influxdb-client-python/blob/feb97eef067013881e798b322f90a83e27d07366/influxdb_client/client/flux_csv_parser.py#L102-L107
async def __aenter__(self) -> 'FluxCsvParser':
"""Initialize CSV reader."""
from aiocsv import AsyncReader
self._reader =
AsyncReader(_StreamReaderToWithAsyncRead(self._response.content))
Unfortunately, I was not able to find aiocsv in the trixie packages
nor is there an automatic dependency on it. So I had to use a
venv/pip-installed version instead. Are you aware of this problem or
is there any plan to include aiocsv as a Debian package in the future?
I attached a minimal example (it will probably require a valid
influxdb server running).
Thanks,
Matthias Straka
import asyncio
from influxdb_client.client.influxdb_client_async import InfluxDBClientAsync
async def main():
connection = InfluxDBClientAsync(url='http://localhost:8086', token="TOKEN", org="MyOrg")
query = f"""
from(bucket: "my_bucket")
|> range(start: -1h, stop: now())
|> filter(fn: (r) => r["_measurement"] == "market" and r["_field"] == "price")
"""
try:
results = await connection.query_api().query(query)
print(results[0].records[0].get_value())
except Exception as ex:
print(ex) # Prints No module named 'aiocsv'
asyncio.run(main())