Cannot import TabularPrediction from AutoGluon

Cannot import TabularPrediction from AutoGluon v0.0.14 due to a namespace collision. Upgrade to AutoGluon v0.0.15.

Written by kavya.parag

Last published at: May 11th, 2022

Problem

You are trying to import TabularPrediction from AutoGluon, but are getting an error message.

ImportError: cannot import name 'TabularPrediction' from 'autogluon' (unknown location)

This happens when AutoGluon is installed via a notebook or as a cluster-installed library (AWS | Azure | GCP).

You can reproduce the error by running the import command in your notebook:

%python

import autogluon as ag
from autogluon import TabularPrediction as task

Cause

There is a namespace collision in AutoGluon v0.0.14.

autogluon==0.0.14 installs gluoncv>=0.5.0,<1.0. This results in gluoncv==0.9.0 getting installed, which creates the namespace collision.

Solution

The namespace collision was resolved in AutoGluon v0.0.15. Upgrade to AutoGluon v0.0.15 to use TabularPrediction.

Specify autogluon==0.0.15 when installing AutoGluon as a cluster-installed library from PyPI.

You can also install it via a notebook.

%sh
pip install autogluon==0.0.15 autogluon.tabular "mxnet<2.0.0"

After you have upgraded to AutoGluon v0.0.15, you can successfully import TabularPrediction.

%python

import autogluon as ag
from autogluon import TabularPrediction as task


Was this article helpful?