'Drake Deepnote Tutorials Import Failure - Versioning Issue?
| 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) ```
Solution 1:[1]
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).
Solution 2:[2]
(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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Xuchen Han |
Solution 2 | L Wall |