Skip to content

Importing sdmetrics crashes because of torch dependency #764

@amontanez24

Description

@amontanez24

Environment Details

Please indicate the following details about the environment in which you found the bug:

  • SDMetrics version: 0.20.0
  • Python version:
  • Operating System:

Error Description

Torch is being imported in the file below after this change. Since it isn't listed as a required dependency, it crashes whenever you import from sdmetrics unless you happened to already have torch installed.

Steps to reproduce

  1. Create a new environment
  2. Install sdmetrics and nothing else
  3. Run
import sdmetrics

Additional Context

  • We should wrap the importing of torch in a try/catch like we do here
    def lstm_classifier(X_train, X_test, y_train, y_test):
    """ML Scorer based on a simple LSTM based NN implemented using torch."""
    try:
    import torch
    except ImportError:
    raise ImportError('Please install torch with `pip install torch`')
  • We should add an install test workflow like we have here

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions