Drake Deepnote Tutorials Import Failure - Versioning Issue?

168 views Asked by At

| OS: Ubuntu 20.04 | Py: 3.8.10, downloaded via apt | Drake: 1.2.0, downloaded via apt | using venv | Running in PyCharm: |

Took the Deepnote Tutorial .ipynb "Chapter 2: Let's get you a robot" and tried running it in Jupyter Notebook (which doesn't work for me.) I then converting that file to .py (through Jupyter's File->Download As... screen) and tried running the file locally in pycharm in my env:

both times, it fails to find: "manipulation.meshcat_cpp_utils" and produces the "ModuleNotFoundError:"

I went into the pydrake file directory directly and I do not see anything by the name "meshcat_cpp_utils" in pydrake/manipulator and I'm wondering if this release no longer supports the tutorials, or if it's trying to import from the wrong folder.

Here's the code:

# Imports
import numpy as np
import pydot
from IPython.display import display, HTML, SVG

from pydrake.all import (
    AddMultibodyPlantSceneGraph, DiagramBuilder, 
    FindResourceOrThrow, GenerateHtml, InverseDynamicsController, 
    MultibodyPlant, Parser, Simulator, MeshcatVisualizerCpp)
from manipulation import running_as_notebook
from manipulation.meshcat_cpp_utils import (
  StartMeshcat, MeshcatJointSlidersThatPublish) ```
2

There are 2 answers

1
Xuchen Han On

The manipulation module here is different from the pydrake/manipulation module as far as I understand it. I believe the deepnote tutorial could use an update as StartMeshcat and MeshcatJointSlidersThatPublish should both already have their pydrake counterparts (under different names).

0
L Wall On

(1) The Deepnote is actually quite old: it requires Python 3.7 ran in a venv with Drake 0.38.0 with latest commit of the manipulation package. Most of the drake and drake-adjacent API's do not currently include deprecation notices so while you aren't directly told what has replaced "MeshcatJointSlidersThatPublish" if you slug through the API you'll be able to find it's replacement. (1b) Or, if you're looking for a fast, brute-force patch, go to this specific commit of the manipulation repo (manipulation as in for the "Robotic Manipulation MIT course), scroll to the bottom, and copy the class yourself. (2) The Deepnote is meant to be ran as a .ipynb and stepped through - converting it to .py doesn't work out the same and doesn't present the information as intended