Comments (10)
It looks like the issue you're encountering with the ImportError
for StatsdStatsLogger
from superset.stats_logger
could be due to the statsd
library not being properly installed or recognized in your environment. To resolve this, ensure that the statsd
library is installed by running:
pip install statsd
This step is crucial because the StatsdStatsLogger
class depends on the successful import of the statsd
library. If the library is missing or there's an import issue, the class won't be defined, leading to the error you're seeing.
Additionally, verify that your Docker environment is correctly configured to communicate with the statsd
service. This involves setting the correct host
and port
values in your configuration to match where your statsd
instance is running. In a Docker setup, the host
might need to be set to the service name of your statsd
container or the IP address of the host machine if statsd
is running outside Docker.
If after ensuring the statsd
library is installed and your Docker configuration is correct you still face issues, it might be helpful to double-check the version compatibility of Superset and the statsd
library, as well as ensuring there are no path or import conflicts in your setup.
Details
Sources
- ImportError: cannot import name 'StatsdStatsLogger' from 'superset.stats_logger' (/app/superset/stats_logger.py)
- ImportError: cannot import name 'StatsdStatsLogger'
- superset/stats_logger.py
- tests/integration_tests/stats_logger_tests.py
- docker/superset-websocket/config.json
- RELEASING/release-notes-4-0/README.md
- pyproject.toml
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
from superset.
I think the superset.config
it says it's not finding is actually referring to config.py
. Is that present? I'm not well versed in this app bootstrapping workflow... maybe @dpgaspar can spot a problem here.
If there's not much outcry about something broken here, then it's probably a configuration problem rather than a bug, so we might be forced to migrate this to a Discussion rather than an Issue.
from superset.
Looks like you're in docker-compose. To repro/debug you can
$ docker-compose exec superset bash
root@4625ad55f961:/app# python
Python 3.10.14 (main, Apr 24 2024, 07:50:19) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from superset.stats_logger import StatsdStatsLogger
>>>
This works for me as is on latest master.
The comment from the error message you provided above seems generic but probably captures the issue:
superset_app | - missing __init__.py in a package;
superset_app | - package or module path not included in sys.path;
superset_app | - duplicated package or module name taking precedence in sys.path;
superset_app | - missing module, class, function or variable;
from superset.
Just checked and I was able to configure STATS_LOGGER
exactly as the documentation says
from superset.
Sounds like it's a config issue, not a bug. I'll close this for now, but I'm happy to move it to a Q&A Discussion if you'd like. Just say the word :)
from superset.
Thank you all for your comments/answers.
I tried connecting to the docker container and ran the above commands:
docker exec -it superset_app bash
root@e24559e47f80:/app# python
Python 3.10.14 (main, Apr 10 2024, 04:55:18) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from superset.stats_logger import StatsdStatsLogger
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'StatsdStatsLogger' from 'superset.stats_logger' (/app/superset/stats_logger.py)
>>>
I am getting the same error. I am not sure what is wrong in my config file or in my env vars file.
Let me try configuring this statsd in our kubernetes pod as the configuration style is helm based and is different from docker compose. If it works in kubernetes then we can skip this in docker compose as we want to get this working finally in kubernetes.
from superset.
I just tried importing StatsClient
from python console and that is also failing.
>>> from statsd import StatsClient
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.10/site-packages/statsd/__init__.py", line 2, in <module>
from statsd.client import Client
ImportError: cannot import name 'Client' from 'statsd.client' (/usr/local/lib/python3.10/site-packages/statsd/client/__init__.py)
pip freeze | grep stats
python-statsd==2.1.0
statsd==4.0.1
Not sure how can statsd be a problem in importing here.
from superset.
I think I am able to avoid this issue.
Currently I am using statsd 4.0.1 version. I tried moving to 3.3.0 version and it worked fine.
I am assuming the reason why it is working for others with statsd 4.0.1 version and not in my env is that I am installing other database dependency libraries that might have cause conflict in one of them.
If others also run in to this issue then though try switching the version of statsd and retry.
from superset.
If we know for sure that certain versions of a lib work or don't work, we should set that range here: https://github.com/apache/superset/blob/master/pyproject.toml#L196
from superset.
Moving from 4.0.1 to statsd >= 3.3.0 in setup.py worked for me also
from superset.
Related Issues (20)
- [Bug] Unable to edit mail list of existing alert & reports HOT 5
- Improper Input Validation while creating dashboard and charts HOT 1
- Can not specify recipient for slack or email for Superset Reports HOT 5
- Problem Exporting Charts as Diagram HOT 4
- Cannot fetch schema list and table list in sqllab after setting values to table_cache_timeout and schema_cache_timeout HOT 1
- Customize loading spinner position and appereance HOT 1
- New permalinks retain previous permalink activeTab state HOT 1
- No table names shown in Dataset creation window / SQL Lab for Apache Kyuubi HOT 1
- Add button grayed out even tough all fields are filled HOT 4
- Unable to execute any Superset command in terminal HOT 1
- Datasource access HOT 6
- Typo in IBM DB2 image reference in README.md HOT 2
- Gauge chart interval bounds and colors not working properly when added to a dashboard HOT 1
- Dataset access HOT 3
- Method 405 not allowed for guest_token fetching HOT 4
- There was an error loading the schemas HOT 2
- UUID columns show up as NULL HOT 1
- 0.12.11 fails for helm install HOT 2
- sql query is different from chart results HOT 3
- Inconsistent spacing between viz gallery charts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superset.