colab notebook in Chapter 3 of Underactuated Robotics is not working - drake

The colab notebooks are not working even I used pip install:
!pip install drake
import importlib
import sys
from urllib.request import urlretrieve
# Install drake (and underactuated).
if 'google.colab' in sys.modules and importlib.util.find_spec('underactuated') is None:
urlretrieve(f"http://underactuated.csail.mit.edu/setup/setup_underactuated_colab.py",
"setup_underactuated_colab.py")
from setup_underactuated_colab import setup_underactuated
setup_underactuated(underactuated_sha='e089af19ca62590e131ad295b51d2c950a5ecc10', drake_version='0.27.0', drake_build='release')
server_args = []
if 'google.colab' in sys.modules:
server_args = ['--ngrok_http_tunnel']
# Start two meshcat server instances to use for the remainder of this notebook.
from meshcat.servers.zmqserver import start_zmq_server_as_subprocess
proc_planar, zmq_url_planar, web_url_planar = start_zmq_server_as_subprocess(server_args=server_args)
proc, zmq_url, web_url = start_zmq_server_as_subprocess(server_args=server_args)
import numpy as np
from ipywidgets import FloatSlider, ToggleButton
from IPython.display import display, SVG
import pydot
import pydrake.all
from pydrake.all import (
DiagramBuilder, LinearQuadraticRegulator, Saturation, SceneGraph, Simulator,
WrapToSystem, AddMultibodyPlantSceneGraph, Parser
)
from pydrake.examples.acrobot import AcrobotPlant, AcrobotGeometry
from pydrake.systems.jupyter_widgets import WidgetSystem
from pydrake.common.containers import namedview
from underactuated import FindResource
from underactuated.jupyter import running_as_notebook
The drake version 0.27.0 that you've specified will be ignored. We've switched to a `pip install` workflow for colab, and are transitioning to that.
Cloning into '/opt/underactuated'...
HEAD is now at e089af1 setup colab uses pip install drake
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchvision 0.11.1+cu111 requires torch==1.10.0, but you have torch 1.8.1 which is incompatible.
torchtext 0.11.0 requires torch==1.10.0, but you have torch 1.8.1 which is incompatible.
torchaudio 0.10.0+cu111 requires torch==1.10.0, but you have torch 1.8.1 which is incompatible.
albumentations 0.1.12 requires imgaug<0.2.7,>=0.2.5, but you have imgaug 0.2.9 which is incompatible.
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/x/xorg-server/xvfb_1.19.6-1ubuntu4.9_amd64.deb 404 Not Found [IP: 91.189.88.142 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-3-7cd256303862> in <module>()
8 "setup_underactuated_colab.py")
9 from setup_underactuated_colab import setup_underactuated
---> 10 setup_underactuated(underactuated_sha='e089af19ca62590e131ad295b51d2c950a5ecc10', drake_version='0.27.0', drake_build='release')
11
12 server_args = []
1 frames
/content/setup_underactuated_colab.py in run(cmd, **kwargs)
94 if cp.stderr:
95 print(cp.stderr)
---> 96 assert cp.returncode == 0, cp
97
98 # Clone the repo (if necessary).
AssertionError: CompletedProcess(args=['apt', 'install', 'xvfb'], returncode=100, stdout='Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following NEW packages will be installed:\n xvfb\n0 upgraded, 1 newly installed, 0 to remove and 37 not upgraded.\nNeed to get 784 kB of archives.\nAfter this operation, 2,270 kB of additional disk space will be used.\nIgn:1 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 xvfb amd64 2:1.19.6-1ubuntu4.9\nErr:1 http://security.ubuntu.com/ubuntu bionic-updates/universe amd64 xvfb amd64 2:1.19.6-1ubuntu4.9\n 404 Not Found [IP: 91.189.88.142 80]\n', stderr='\nWARNING: apt does not have a stable CLI interface. Use with caution in scripts.\n\nE: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/x/xorg-server/xvfb_1.19.6-1ubuntu4.9_amd64.deb 404 Not Found [IP: 91.189.88.142 80]\nE: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?\n')

Good news. As of this morning, you no longer have to use the setup_underactuated, and can install with pip, e.g. via
!pip install underactuated==2022.01.03
at the top of the notebook.
Unforunately, ngrok seems to have changed their support for unregistered connections, so you might still have to overcome this:
https://github.com/RussTedrake/underactuated/issues/454

Related

Pipenv uses the wrong lib directory

I have a project using Python 3.10.4, i. e., the Pipfile has,
[requires]
python_version = "3.10.4"
I installed Python 3.10.4 using pyenv install 3.10.4 and now pyenv versions returns,
* system (set by /home/username/.config/pyenv/version)
3.10.4
Now when I run pipenv install I get,
Creating a virtualenv for this project…
Using /home/username/.config/pyenv/versions/3.10.4/bin/python3 (3.10.4) to create virtualenv…
⠋created virtual environment CPython3.10.4.final.0-64 in 82ms
creator CPython3Posix(dest=/home/username/.local/share/virtualenvs/project-2ZeatEXR, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/username/.local/share/virtualenv)
added seed packages: pip==20.3.4, pkg_resources==0.0.0, setuptools==44.1.1, wheel==0.34.2
activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
Virtualenv location: /home/username/.local/share/virtualenvs/project-2ZeatEXR
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
from . import utils
File "/usr/lib/python3/dist-packages/pipenv/vendor/requests/utils.py", line 27, in <module>
from .cookies import RequestsCookieJar, cookiejar_from_dict
File "/usr/lib/python3/dist-packages/pipenv/vendor/requests/cookies.py", line 172, in <module>
class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'
The line Using /home/username/.config/pyenv/versions/3.10.4/bin/python3 (3.10.4) indicates that pipenv has found the right Python version and is using it to create the virtual environment but then when creating the lock file, observe that it uses the lib: /usr/lib/python3/dist-packages/pipenv/vendor/requests/utils.py directory is of the system installation. Which then causes the error since the system's lib is for Python 3.9.
Maybe this is a bug or maybe I have missed some config. Could someone see what is going wrong here?

Travis-CI - chrome 62 instead of 77

For two days Travis CI returns version 62 of chrome instead of 77, do you also have the problem on your CI / CD?
.travis.yml (source)
addons:
chrome: stable
trace: (source)
$ export CHROME_SOURCE_URL=https://dl.google.com/dl/linux/direct/google-chrome-stable_current_amd64.deb
Installing Google Chrome stable
1.17s$ wget --no-verbose -O /tmp/$(basename $CHROME_SOURCE_URL) $CHROME_SOURCE_URL
2019-09-11 15:41:31 URL:https://dl.google.com/dl/linux/direct/google-chrome-stable_current_amd64.deb [62302944/62302944] -> "/tmp/google-chrome-stable_current_amd64.deb" [1]
dpkg-deb: error: archive '/tmp/google-chrome-stable_current_amd64.deb' has premature member 'control.tar.xz' before 'control.tar.gz', giving up
dpkg: error processing archive /tmp/google-chrome-stable_current_amd64.deb (--install):
subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
/tmp/google-chrome-stable_current_amd64.deb
Google Chrome 62.0.3202.94
I add install dpkg
.travis.yml:
addons:
apt:
packages:
- dpkg
chrome: stable
It's a known bug with the dpkg package not supporting xz compressed packages and latest versions of Chrome apparently use it.
The best solution would be to upgrade to dist: xenial build env since trusty are quire old now. Or update the package I guess.
See https://github.com/travis-ci/travis-ci/issues/9361
Changing the Linux distribution fixed the issue for me.
Change:
dust: trusty
To:
dist: xenial
In the .travis.yml file, change my Chrome version from 62.0.3202.94 to 81.0.4044.138
I fixed it on our opensource project by forcing dpkg reinstall:
https://github.com/PrestaShop/PrestaShop/pull/15581

Can't install libgtk2.0-dev_2.24.31-2_arm64.deb on Renesas R-Car H3 (H3ULCB)

I am trying to run object detection algorithm (which is using OpenCV 2.4.13.7) on H3ULCB. It is giving libGTK as shown below
root#h3ulcb:/media/2.4.13_algo_target_# ./main_
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or [ 1976.641753] audit: type=1706
Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvWaitKey, fil7
terminate called after throwing an instance of 'cv::Exception'
what(): /media/2.4.13.7_pckage/modules/highgui/src/window.cpp:567: error: (-2) The function is not implemented. Rebuild the library with Wiy
Aborted (core dumped)}
To solve the error , I tried to install libGTK package (libgtk2.0-dev_2.24.31-2_arm64.deb) on H3ULCB, but its not getting installed to the target.
* pkg_extract_data_file_names_to_stream: Failed to extract data.tar.gz from package '/media/libgtk2.0-dev_2.24.31-2_arm64.deb'.
* pkg_get_installed_files: Error extracting file list from /media/libgtk2.0-dev_2.24.31-2_arm64.deb.
* opkg_install: Cannot install package libgtk2.0-dev.
BSP and SDK for H3ULCB are build using yocto, details are listed below:
Yocto version: 2.23
Poky: 2.1.3
The same error is resolved on the native Linux (Ubuntu16.04) by installing the libgtk2.0 library from apt-get manager. But package manager apt and dpkg is not getting installed on the target. I tried to add these managers in the yocto layers while building the image.
Currently Available package manager on H3ULCB is OPKG. Since OPKG works on .IPK packages but not .IPK packages on available for libgtk2.0, I have converted the .deb package to a .IPK package .While executing the .IPK package on H3ulcb:
root#h3ulcb:/media# opkg install libgtk2.0-dev_2.24.31-2_arm64.ipk
Collected errors:
* open_outer: Failed to open package 'libgtk2.0-dev_2.24.31-2_arm64.ipk': Unrecognized archive format
* pkg_extract_control_file_to_stream: Failed to extract control.tar.gz from package 'libgtk2.0-dev_2.24.31-2_arm64.ipk'.
* pkg_init_from_file: Failed to extract control file from libgtk2.0-dev_2.24.31-2_arm64.ipk.
In the package libgtk2.0-dev_2.24.31-2_arm64.deb, there are 3 files
control.tar.gz
data.tar.xz
debian-binary
while executing the .deb file on H3ULCB, the error showed data.tar.gz instead of data.tar.xz as given below:
pkg_extract_data_file_names_to_stream: Failed to extract data.tar.gz from package '/media/libgtk2.0-dev_2.24.31-2_arm64.deb'.
I have converted data.tar.xz to data.tar.gz, but how to pack these files 3 files back to .deb package?

How to include Eigen in C++ library after installing libeigen3-dev package

I am trying to build OpenCV from Source (master branch) using cmake.
I installed Eigen package via apt-get.
sudo apt-get install libeigen3-dev
It was successfully installed, and cmake prints that eigen 3.3.4 is installed.
Eigen: YES(ver 3.3.4)
But when I did 'make', it showed the error
/opencv/modules/core/include/opencv2/core/private.hpp:66.12: fatal error: Eigen/Core: No such file or directory
# include <Eigen/Core>
^~~~~~~~~~~~
compilation teminated.
I found the same question on superuser.
So as the answer did, I have changed cmake/OpenCVFindLibsPerf.cmake from line 44 to 59.
After I have commented out line 46-48 and 59,
and changed find_package(Eigen3 QUIET) in line 44 to find_package(Eigen3 3.0.0), it works.
And this problem only happens on OpenCV 4.0 version.
When I install OpenCV 3.4.6 version(tag 3.4.6 on github), this problem does not occur.

Library not loaded: /usr/local/lib/libhdf5.9.dylib

After "brew upgrade", I found I cannot use Pytables on my Mac.
import tables as tb
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-29-57032f570037> in <module>()
----> 1 import tables as tb
/usr/local/lib/python2.7/site-packages/tables/__init__.py in <module>()
80
81 # Necessary imports to get versions stored on the cython extension
---> 82 from tables.utilsextension import (
83 get_pytables_version, get_hdf5_version, blosc_compressor_list,
84 blosc_compcode_to_compname_ as blosc_compcode_to_compname,
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/tables/utilsextension.so, 2): Library not loaded: /usr/local/lib/libhdf5.9.dylib
Referenced from: /usr/local/lib/python2.7/site-packages/tables/utilsextension.so
Reason: image not found
I found that instead of having libhdf5.9.dylib in the directory, I have libhdf5.10.dylib now.
I can uninstall and install hdf5 without a problem and I also tried to reinstall tables.
I'm not sure how to solve this problem.
You need to reinstall tables. If you are using a recent version of pip, you also need to make sure you don't use a cached version of pytables that was built against the old libhdf. You can do this with pip install -U --force-reinstall --no-binary tables tables.
Problem solved by installing the developing version from GitHub:
pip install git+https://github.com/PyTables/PyTables.git#develop#egg=tables

Resources