Sagemaker-python-sdk: Unable to suppress pandas warnings from analytics module

Created on 10 Jul 2020  路  3Comments  路  Source: aws/sagemaker-python-sdk

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.

pending release bug

All 3 comments

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

released in v1.71.0

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
Was this page helpful?
0 / 5 - 0 ratings