Cannot use gluonnlp on Amazon SageMaker

Hi, I’d love to use gluonnlp on Amazon SageMaker notebook instance.
!pip install gluonnlp
followed by
import gluonnlp as nlp


ImportError                               Traceback (most recent call last)
<ipython-input-5-0d7a2756aef3> in <module>()
      4 from mxnet import gluon
      5 from mxnet import nd
----> 6 import gluonnlp as nlp
      7 import re

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonnlp/ in <module>()
     23 from . import loss
---> 24 from . import data
     25 from . import embedding
     26 from . import model

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonnlp/data/ in <module>()
     21 """This module includes common utilities such as data readers and counter."""
---> 23 from . import (batchify, candidate_sampler, conll, corpora, dataloader,
     24                dataset, question_answering, registry, sampler, sentiment,
     25                stream, transforms, translation, utils,

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonnlp/data/batchify/ in <module>()
     21 """Batchify helpers."""
---> 23 from . import batchify, language_model
     24 from .batchify import *
     25 from .embedding import *

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonnlp/data/batchify/ in <module>()
     30 from import RandomSampler, SequentialSampler, SimpleDataset
---> 32 from ..utils import slice_sequence, _slice_pad_length
     33 from import DataStream

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonnlp/data/ in <module>()
     35 from import SimpleDataset
---> 36 from mxnet.gluon.utils import _get_repo_url, download, check_sha1
     38 from .. import _constants as C

ImportError: cannot import name '_get_repo_url'

How can I use gluonnlp on Amazon SageMaker?

starting the script with !pip install --pre --upgrade mxnet solved the issue

1 Like

That’s correct - as you’ve seen the training instances do currently run different versions of MXNet than the instance hosting the notebook Also for future ref, you can see the mxnet version with mxnet.version.