Cannot import TabularPrediction from AutoGluon

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.

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

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.

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.

import autogluon as ag
from autogluon import TabularPrediction as task