Is it possible to use nbextension in custom images for SageMaker Studio Notebooks, and how?

0

I'm not asking for help on debugging this particular error, but more for a general answer for Is it possible to use nbextension in custom images for SageMaker Studio Notebooks, and how?

As background: I fail on step 2 of the Installation of jupyter_contrib_nbextensions.

The reason I'm trying to install that is because it's a prerequisite to using Black in Jupyter Notebook.).

When I run !jupyter contrib nbextension install --user in a cell of SageMaker Studio that's using a custom SageMaker image based on continuumio/miniconda3:4.9.2 and the following environment:

name: base
channels:
  - conda-forge
dependencies:
  - python=3.9
  - numpy
  - awscli
  - boto3
  - ipykernel
  - black
  - jupyter_contrib_nbextensions

The error I get is:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2720, in _dep_map
    return self.__dep_map
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2835, in __getattr__
    raise AttributeError(attr)
AttributeError: _Distribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/bin/jupyter-contrib", line 10, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.9/site-packages/jupyter_core/application.py", line 277, in launch_instance
    return super().launch_instance(argv=argv, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/traitlets/config/application.py", line 1041, in launch_instance
    app = cls.instance(**kwargs)
  File "/opt/conda/lib/python3.9/site-packages/traitlets/config/configurable.py", line 551, in instance
    inst = cls(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/jupyter_contrib_core/application.py", line 27, in __init__
    self._refresh_subcommands()
  File "/opt/conda/lib/python3.9/site-packages/jupyter_contrib_core/application.py", line 43, in _refresh_subcommands
    get_subcommands_dict = entrypoint.load()
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2476, in load
    self.require(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2499, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py", line 820, in resolve
    new_requirements = dist.requires(req.extras)[::-1]
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2755, in requires
    dm = self._dep_map
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2722, in _dep_map
    self.__dep_map = self._filter_extras(self._build_dep_map())
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2737, in _filter_extras
    invalid_marker(marker) or not evaluate_marker(marker)
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1415, in invalid_marker
    evaluate_marker(text)
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1433, in evaluate_marker
    return marker.evaluate()
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/markers.py", line 245, in evaluate
    return _evaluate_markers(self._markers, current_environment)
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/markers.py", line 151, in _evaluate_markers
    groups[-1].append(_eval_op(lhs_value, op, rhs_value))
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/markers.py", line 109, in _eval_op
    return spec.contains(lhs, prereleases=True)
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/specifiers.py", line 565, in contains
    normalized_item = _coerce_version(item)
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/specifiers.py", line 36, in _coerce_version
    version = Version(version)
  File "/opt/conda/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/version.py", line 197, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: 'cpython'
AWS
asked a year ago89 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions