amazon-sagemaker-examples icon indicating copy to clipboard operation
amazon-sagemaker-examples copied to clipboard

An Introduction to SageMaker LDA: import modules error.

Open araitats opened this issue 7 years ago • 1 comments

An Introduction to SageMaker LDA

  • I cannot pass the second cell. The error indicates matplotlib cannot import urllib.request. This error did not occur with other notebook examples.
  • module 'numpy' has no attribute 'set_printoptions'
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-8-7097f69479d9> in <module>()
----> 1 get_ipython().run_line_magic('matplotlib', 'inline')
      2 
      3 import os, re
      4 
      5 import boto3

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2129                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2130             with self.builtin_trap:
-> 2131                 result = fn(*args,**kwargs)
   2132             return result
   2133 

<decorator-gen-107> in matplotlib(self, line)

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/IPython/core/magics/pylab.py in matplotlib(self, line)
     97             print("Available matplotlib backends: %s" % backends_list)
     98         else:
---> 99             gui, backend = self.shell.enable_matplotlib(args.gui)
    100             self._show_matplotlib_backend(args.gui, backend)
    101 

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/IPython/core/interactiveshell.py in enable_matplotlib(self, gui)
   3037         """
   3038         from IPython.core import pylabtools as pt
-> 3039         gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select)
   3040 
   3041         if gui != 'inline':

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/IPython/core/pylabtools.py in find_gui_and_backend(gui, gui_select)
    271     """
    272 
--> 273     import matplotlib
    274 
    275     if gui and gui != 'auto':

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/matplotlib/__init__.py in <module>()
    134 import subprocess
    135 import tempfile
--> 136 import urllib.request
    137 import warnings
    138 

ModuleNotFoundError: No module named 'urllib.request'

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-3e691583549a> in <module>()
      6 #import matplotlib.pyplot as plt
      7 import numpy as np
----> 8 np.set_printoptions(precision=3, suppress=True)
      9 
     10 # some helpful utility functions are defined in the Python module

AttributeError: module 'numpy' has no attribute 'set_printoptions'

araitats avatar Jul 24 '19 21:07 araitats

Hi @araitats,

Apologies for the late response.

Are you still facing this issue? I was able to successfully run the mentioned cell in SageMaker Notebook.

Thanks, Neelam

neelamgehlot avatar Jan 15 '20 23:01 neelamgehlot