Giter VIP home page Giter VIP logo

Comments (10)

dosubot avatar dosubot commented on June 2, 2024 3

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


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.

rusackas avatar rusackas commented on June 2, 2024

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.

mistercrunch avatar mistercrunch commented on June 2, 2024

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.

dpgaspar avatar dpgaspar commented on June 2, 2024

Just checked and I was able to configure STATS_LOGGER exactly as the documentation says

from superset.

rusackas avatar rusackas commented on June 2, 2024

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.

rajesh-bijja avatar rajesh-bijja commented on June 2, 2024

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.

rajesh-bijja avatar rajesh-bijja commented on June 2, 2024

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.

rajesh-bijja avatar rajesh-bijja commented on June 2, 2024

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.

mistercrunch avatar mistercrunch commented on June 2, 2024

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.

SamraHanifCareem avatar SamraHanifCareem commented on June 2, 2024

Moving from 4.0.1 to statsd >= 3.3.0 in setup.py worked for me also

from superset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.