moorepants / learn-multibody-dynamics

Interactive computational book on multibody dynamics
https://moorepants.github.io/learn-multibody-dynamics/
Other
117 stars 28 forks source link

make html fails with `scikits.odes` error #88

Closed agryman closed 2 years ago

agryman commented 2 years ago

@moorepants I'm trying to build the html on my iMac running macOS 10.15.7. It's a late 2013 model so I can't install the latest macOS.

I've consistently been running into a problem with scikits.odes. Initially, I created a Python 3.10 venv and pip installed the packages listed in multibody-book-env.yml since that's what I normally use for development. That failed with a scikits.odes error. I then thought perhaps I needed to roll back to Python 3.9 since that's what's listed in the yml file. That too failed with the same error. Finally I tried installing Anaconda. I installed it using brew since that's how I manage packages on my Mac. I created the conda environment as per the README.rst but the make html command failed again with an error related to scikits.odes. Any idea what's going wrong? Perhaps my macOS level is not supported by scikits.odes?

Here's the error messages from make html:

(multibody-book) riemann:learn-multibody-dynamics arthurryman$ make html
Running Sphinx v5.0.2
making output directory... done
loading intersphinx inventory from https://matplotlib.org/stable/objects.inv...
loading intersphinx inventory from https://numpy.org/doc/stable/objects.inv...
loading intersphinx inventory from https://docs.scipy.org/doc/scipy/objects.inv...
loading intersphinx inventory from https://docs.sympy.org/latest/objects.inv...
loading intersphinx inventory from https://pythreejs.readthedocs.io/en/stable/objects.inv...
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 44 source files that are out of date
updating environment: [new config] 44 added, 0 changed, 0 removed
executing angular. [  4%] angular                                                                                                                                                                                                  
executing configuration%] configuration                                                                                                                                                                                            
executing differentiation differentiation                                                                                                                                                                                          
executing eomes... [ 11%] eom                                                                                                                                                                                                      
executing generalized-forcesneralized-forces                                                                                                                                                                                       
executing holonomic-eom%] holonomic-eom                                                                                                                                                                                            
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/generalized-forces.rst:688: WARNING: duplicate label of equation eq-nonholonomic-gaf, other instance in generalized-forces
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/generalized-forces.rst:3: CRITICAL: Duplicate ID: "equation-eq-nonholonomic-gaf".
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook

Extension error:
Cell raised uncaught exception:
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Input In [47], in <cell line: 1>()
----> 1 from scikits.odes import dae

File /usr/local/anaconda3/envs/multibody-book/lib/python3.9/site-packages/scikits/odes/__init__.py:17, in <module>
      1 # -*- coding: utf-8 -*-
      2 """
      3 scikits.odes is a scikit offering a cython wrapper around some extra ode/dae
      4 solvers, so they can mature outside of scipy.
   (...)
     14 .. _SUNDIALS: https://computation.llnl.gov/casc/sundials/main.html
     15 """
---> 17 from .dae import *
     18 from .ode import *
     20 __all__ = ['test'] + [s for s in dir() if not s.startswith('_')]

File /usr/local/anaconda3/envs/multibody-book/lib/python3.9/site-packages/scikits/odes/dae.py:31, in <module>
     28 __version__ = "$Id$"
     29 __docformat__ = "restructuredtext en"
---> 31 from numpy import asarray, array, zeros, sin, int32, isscalar, empty, alen
     32 from copy import copy
     33 import re, sys

ImportError: cannot import name 'alen' from 'numpy' (/usr/local/anaconda3/envs/multibody-book/lib/python3.9/site-packages/numpy/__init__.py)
make: *** [html] Error 2
moorepants commented 2 years ago

scikits.odes is a bit hard to get installed in general. I created the conda-forge package (https://github.com/conda-forge/scikits.odes-feedstock) that should run on mac, windows, and linux (at least it does when built over at conda forge). I suggest opening an issue on the scikits.odes repository, maybe they have tips to get it installed on a mac. That alen error seems like something wrong with numpy, not scikits.odes. It looks like alen may have been removed from numpy, see https://github.com/numpy/numpy/pull/14181. So maybe you are getting a very new numpy that just dropped alen? If that is the case, maybe scikits.odes needs to update their code to not use alen. You could try to force numpy to be a lower version in you conda env file.

moorepants commented 2 years ago

It's already been addressed in scikits.odes: https://github.com/bmcage/odes/pull/136, so either wait for a new release or you'll have to keep numpy at a lower version.

agryman commented 2 years ago

I'll wait for the new version. Thanks.

moorepants commented 2 years ago

It makes sense to do:

name: multibody-book
channels:
  - conda-forge
dependencies:
  - ghp-import
  - graphviz
  - jupyter-sphinx
  - matplotlib
  - numpy <1.23
  - python ==3.9.*
  - pythreejs
  - scikits.odes
  - scipy
  - sphinx
  - sphinx-autobuild  # dev
  - sphinx-material
  - sphinx-togglebutton
  - sympy >=1.9

for this build though, until it scikits.odes releases.

agryman commented 2 years ago

@moorepants OK. Thx for modifying the yml file. I'll try it.

agryman commented 2 years ago

@moorepants I can now run make html without error, but there are a lot of warnings. Here's the console log:

make html
Running Sphinx v5.0.2
loading intersphinx inventory from https://matplotlib.org/stable/objects.inv...
loading intersphinx inventory from https://numpy.org/doc/stable/objects.inv...
loading intersphinx inventory from https://docs.scipy.org/doc/scipy/objects.inv...
loading intersphinx inventory from https://docs.sympy.org/latest/objects.inv...
loading intersphinx inventory from https://pythreejs.readthedocs.io/en/stable/objects.inv...
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 27 source files that are out of date
updating environment: [new config] 27 added, 0 changed, 0 removed
executing angular. [  7%] angular                                                                                                                                                                                                  
executing configuration%] configuration                                                                                                                                                                                            
executing differentiation differentiation                                                                                                                                                                                          
executing eomes... [ 18%] eom                                                                                                                                                                                                      
executing generalized-forcesneralized-forces                                                                                                                                                                                       
executing holonomic-eom%] holonomic-eom                                                                                                                                                                                            
executing install. [ 37%] install                                                                                                                                                                                                  
executing jupyter-python] jupyter-python                                                                                                                                                                                           
executing loads... [ 51%] loads                                                                                                                                                                                                    
executing masss... [ 55%] mass                                                                                                                                                                                                     
executing motion.. [ 59%] motion                                                                                                                                                                                                   
executing noncontributing noncontributing                                                                                                                                                                                          
executing nonholonomic-eomnonholonomic-eom                                                                                                                                                                                         
executing orientation74%] orientation                                                                                                                                                                                              
executing simulation 81%] simulation                                                                                                                                                                                               
executing sympy... [ 85%] sympy                                                                                                                                                                                                    
executing tmtes... [ 88%] tmt                                                                                                                                                                                                      
executing translational%] translational                                                                                                                                                                                            
executing vectors. [ 96%] vectors                                                                                                                                                                                                  
executing visualization%] visualization                                                                                                                                                                                            

WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/generalized-forces.rst:688: WARNING: duplicate label of equation eq-nonholonomic-gaf, other instance in generalized-forces
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/generalized-forces.rst:3: CRITICAL: Duplicate ID: "equation-eq-nonholonomic-gaf".
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: Cell printed to stderr:
/var/folders/xf/mksx171s4gs4wj0yvbzxb3xw0000gn/T/ipykernel_43940/3139199006.py:1: DeprecationWarning: scipy.cos is deprecated and will be removed in SciPy 2.0.0, use numpy.cos instead
  sp.cos(12.0)

/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/jupyter-python.rst:482: WARNING: duplicate label python, other instance in /Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/jupyter-python.rst
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/license.rst:3: WARNING: duplicate label license, other instance in /Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/README.rst
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/loads.rst:92: ERROR: Unknown target name: "kane1985".
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/mass.rst:608: WARNING: duplicate label of equation eq-parallel-axis-theorem, other instance in mass
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/mass.rst:3: CRITICAL: Duplicate ID: "equation-eq-parallel-axis-theorem".
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/mass.rst:126: WARNING: duplicate label mass distribution, other instance in /Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/mass.rst
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/noncontributing.rst:267: WARNING: duplicate label generalized active forces, other instance in /Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/generalized-forces.rst
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/noncontributing.rst:323: WARNING: duplicate label generalized inertia forces, other instance in /Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/generalized-forces.rst
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/noncontributing.rst:368: WARNING: duplicate label dynamical differential equations, other instance in /Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/eom.rst
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/orientation.rst:78: WARNING: duplicate label simple orientations, other instance in /Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/angular.rst
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/simulation.rst:722: ERROR: Unknown target name: "floating point arithmetic error".
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/tmt.rst:219: WARNING: duplicate label fig-eom-double-rod-pendulum, other instance in /Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/eom.rst
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: unknown directive or role name: jupyter-download:script
WARNING: unknown directive or role name: jupyter-download:notebook
WARNING: Cell printed to stderr:
/usr/local/anaconda3/envs/multibody-book/lib/python3.9/site-packages/jupyter_client/session.py:718: UserWarning: Message serialization failed with:
Out of range float values are not JSON compliant
Supporting this message is deprecated in jupyter-client 7, please make sure your message is JSON-compliant
  content = self.pack(content)

WARNING: Cell printed to stderr:
/usr/local/anaconda3/envs/multibody-book/lib/python3.9/site-packages/pythreejs/traits.py:203: UserWarning: 64-bit data types not supported for WebGL data, casting to 32-bit.
  warnings.warn('64-bit data types not supported for WebGL '

looking for now-outdated files... none found
pickling environment... done
checking consistency... /Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/README.rst: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%] visualization                                                                                                                                                                                             
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/differentiation.rst:284: WARNING: external py:func reference target not found: sympy.physics.vector.functions.dynamicsymbols
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/holonomic-eom.rst:186: WARNING: external py:func reference target not found: sympy.trigsimp
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/motion.rst:454: WARNING: undefined label: fig-snakeboard-configuration
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/orientation.rst:19: WARNING: term not in glossary: reference frame
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/orientation.rst:237: WARNING: term not in glossary: direction cosine matrix
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/simulation.rst:256: WARNING: external py:func reference target not found: numpy.deg2rad
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/simulation.rst:256: WARNING: external py:func reference target not found: numpy.rad2deg
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/simulation.rst:768: WARNING: external py:meth reference target not found: sympy.matrices.Matrix.row_join
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/sympy.rst:93: WARNING: external py:class reference target not found: sympy.core.function.UndefinedFunction
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/sympy.rst:527: WARNING: external py:func reference target not found: sympy.matrices.expressions.hadamard.hadamard_product
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/sympy.rst:550: WARNING: external py:meth reference target not found: sympy.matrices.matrices.DenseMatrix.jacobian
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/sympy.rst:668: WARNING: external py:meth reference target not found: sympy.matrices.matrices.MutableDenseMatrix.LUsolve
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/tmt.rst:211: WARNING: undefined label: example of kane’s equations
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:240: WARNING: external py:class reference target not found: py3js.geometries.CylinderGeometry
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:254: WARNING: external py:class reference target not found: py3js.Mesh
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:254: WARNING: external py:class reference target not found: py3js.Material
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:270: WARNING: external py:class reference target not found: py3js.AxesHelper()
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:270: WARNING: external py:attr reference target not found: py3js.Mesh.position
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:285: WARNING: external py:class reference target not found: py3js.Scene
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:285: WARNING: external py:class reference target not found: py3js.Renderer
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:285: WARNING: external py:class reference target not found: py3js.OrbitControls
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:337: WARNING: external py:attr reference target not found: py3js.Mesh.matrix
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:355: WARNING: external py:meth reference target not found: numpy.reshape
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:355: WARNING: external py:meth reference target not found: numpy.flatten
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:483: WARNING: external py:attr reference target not found: py3js.Mesh.matrixAutoUpdate
/Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/visualization.rst:553: WARNING: external py:class reference target not found: py3js.VectorKeyframeTrack
generating indices... genindex done
writing additional pages... search done
copying images... [100%] figures/vectors-desk-lamp.svg                                                                                                                                                                             
copying downloadable files... [100%] _build/jupyter_execute/visualization.ipynb                                                                                                                                                    
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
Generating sitemap for 29 pages in /Users/arthurryman/Documents/repositories/agryman/learn-multibody-dynamics/_build/html/sitemap.xml
build succeeded, 76 warnings.

The HTML pages are in _build/html.
moorepants commented 2 years ago

Great. I'm aware of the warnings, see #72. They need to eventually be fixed.