Skip to content

Unable to suppress pandas warnings from analytics module #1696

Closed

Description

@jaipreet-s

Describe the bug
The Python SDK outputs a warning for not having pandas on import even if I'm not using the analytics feature, and it's not straightforward to suppress the warnings from just the sagemaker module.

To reproduce

Without having pandas, do

import sagemaker

You'll see a warning WARNING:root:pandas failed to import. Analytics features will be impaired or broken.

Expected behavior
A clear and concise description of what you expected to happen.

Ideally, I only see this warning when I'm trying to use the analytics feature.
As an added measure, I should be able to suppress it by doing

        logging.getLogger('sagemaker').setLevel(logging.CRITICAL)
        import sagemaker
        logging.getLogger('sagemaker').setLevel(logging.WARNING)

but because we're using the root logger object I have to change the log level globally by doing

        logging.basicConfig(level=logging.CRITICAL)
        import sagemaker.session as session
        logging.basicConfig(level=logging.INFO)

Screenshots or logs
If applicable, add screenshots or logs to help explain your problem.

System information
A description of your system. Please provide:

  • SageMaker Python SDK version: 1.66
  • Framework name (eg. PyTorch) or algorithm (eg. KMeans): N/A
  • Framework version: N/A
  • Python version: 3.6
  • CPU or GPU: N/A
  • Custom Docker image (Y/N): N/A

Additional context
Add any other context about the problem here.

Activity

  1. laurenyu commented on Jul 23, 2020

    @laurenyu
    Contributor

    I've addressed this in #1745. thanks for bringing it to our attention!

  2. added
    status: pending release
    on Jul 23, 2020
  3. laurenyu commented on Jul 23, 2020

    @laurenyu
    Contributor

    released in v1.71.0

  4. carlowahlstedt commented on Feb 18, 2021

    @carlowahlstedt

    I'm seeing this issue.

    To reproduce:

    FROM python:3 as base
    
    RUN pip install sagemaker
    
    ENV AWS_DEFAULT_REGION us-east-2
    WORKDIR /usr/src/app
    COPY test_container.py .
    
    CMD [ "python", "./test_container.py" ]

    where test_container.py is:

    import sagemaker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: pending releasetype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions