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

returns

---------------------------------------------------------------------------
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/__init__.py in <module>()
     22 
     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/__init__.py in <module>()
     21 """This module includes common utilities such as data readers and counter."""
     22 
---> 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/__init__.py in <module>()
     21 """Batchify helpers."""
     22 
---> 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/language_model.py in <module>()
     30 from mxnet.gluon.data import RandomSampler, SequentialSampler, SimpleDataset
     31 
---> 32 from ..utils import slice_sequence, _slice_pad_length
     33 from ..stream import DataStream
     34 

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

ImportError: cannot import name '_get_repo_url'

How can I use gluonnlp on Amazon SageMaker?
Cheers

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.