Skip to content

Commit

Permalink
[misc] Upgrade C++ dependencies. (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
duburcqa committed Mar 21, 2024
1 parent 8375be2 commit a51cc10
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 26 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,19 @@ jobs:
sudo apt install -y gdb gnupg curl wget build-essential cmake doxygen graphviz texlive-latex-base
"${PYTHON_EXECUTABLE}" -m pip install setuptools wheel "pip>=20.3"
"${PYTHON_EXECUTABLE}" -m pip install "numpy>=1.23,<2.0"
git config --global advice.detachedHead false
- name: Build jiminy dependencies
run: |
BUILD_TYPE="${{ matrix.BUILD_TYPE }}" ./build_tools/build_install_deps_unix.sh
- name: Install pre-compiled binaries for additional gym-jiminy dependencies
if: matrix.PYTHON_VERSION != '3.13'
run: |
"${PYTHON_EXECUTABLE}" -m pip install "torch" -f https://download.pytorch.org/whl/torch
"${PYTHON_EXECUTABLE}" -m pip install "gymnasium>=0.28,<1.0" "stable_baselines3>=2.0"
- name: Install latest numpy version at build-time for run-time binary compatibility
run: |
"${PYTHON_EXECUTABLE}" -m pip install --upgrade "numpy>=1.23,<2.0"
- name: Build jiminy dependencies
run: |
BUILD_TYPE="${{ matrix.BUILD_TYPE }}" ./build_tools/build_install_deps_unix.sh
#####################################################################################

Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,19 @@ jobs:
echo "InstallDir=${GITHUB_WORKSPACE}/install" >> $GITHUB_ENV
"${PYTHON_EXECUTABLE}" -m pip install setuptools wheel "pip>=20.3"
"${PYTHON_EXECUTABLE}" -m pip install "numpy>=1.23,<2.0"
"${PYTHON_EXECUTABLE}" -m pip install delocate twine
- name: Build jiminy dependencies
run: |
OSX_DEPLOYMENT_TARGET=${OSX_DEPLOYMENT_TARGET} OSX_ARCHITECTURES=${OSX_ARCHITECTURES} \
BUILD_TYPE="${{ matrix.BUILD_TYPE }}" ./build_tools/build_install_deps_unix.sh
- name: Install pre-compiled binaries for additional gym-jiminy dependencies
if: matrix.PYTHON_VERSION != '3.13'
run: |
"${PYTHON_EXECUTABLE}" -m pip install "torch" -f https://download.pytorch.org/whl/torch
"${PYTHON_EXECUTABLE}" -m pip install "gymnasium>=0.28,<1.0" "stable_baselines3>=2.0"
- name: Install latest numpy version at build-time for run-time binary compatibility
run: |
"${PYTHON_EXECUTABLE}" -m pip install --upgrade "numpy>=1.23,<2.0"
- name: Build jiminy dependencies
run: |
OSX_DEPLOYMENT_TARGET=${OSX_DEPLOYMENT_TARGET} OSX_ARCHITECTURES=${OSX_ARCHITECTURES} \
BUILD_TYPE="${{ matrix.BUILD_TYPE }}" ./build_tools/build_install_deps_unix.sh
#####################################################################################

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/manylinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ jobs:
echo "InstallDir=${GITHUB_WORKSPACE}/install" >> $GITHUB_ENV
"${PYTHON_EXECUTABLE}" -m pip install setuptools wheel "pip>=20.3"
"${PYTHON_EXECUTABLE}" -m pip install "numpy>=1.23,<2.0"
"${PYTHON_EXECUTABLE}" -m pip install twine cmake
- name: Install latest numpy version at build-time for run-time binary compatibility
run: |
"${PYTHON_EXECUTABLE}" -m pip install --upgrade "numpy>=1.23,<2.0"
- name: Build project dependencies
run: |
./build_tools/build_install_deps_unix.sh
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,19 @@ jobs:
run: |
git config --global advice.detachedHead false
python -m pip install setuptools wheel "pip>=20.3"
python -m pip install "numpy>=1.23,<2.0"
python -m pip install pefile machomachomangler
- name: Build jiminy dependencies
run: |
${env:BUILD_TYPE} = "${{ matrix.BUILD_TYPE }}"
& "./workspace/build_tools/build_install_deps_windows.ps1"
- name: Install pre-compiled binaries for additional gym-jiminy dependencies
if: matrix.PYTHON_VERSION != '3.13'
run: |
python -m pip install "torch" -f https://download.pytorch.org/whl/torch
python -m pip install "gymnasium>=0.28,<1.0" "stable_baselines3>=2.0"
- name: Install latest numpy version at build-time for run-time binary compatibility
run: |
python -m pip install --upgrade "numpy>=1.23,<2.0"
- name: Build jiminy dependencies
run: |
${env:BUILD_TYPE} = "${{ matrix.BUILD_TYPE }}"
& "./workspace/build_tools/build_install_deps_windows.ps1"
#####################################################################################

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ install
build
build_tools/cmake/*cppad*
**/log
**/*.trace
6 changes: 2 additions & 4 deletions build_tools/build_install_deps_unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ rm -rf "${RootDir}/eigenpy/build"
mkdir -p "${RootDir}/eigenpy/build"
cd "${RootDir}/eigenpy"
git reset --hard
git fetch origin "v3.3.0" && git checkout --force FETCH_HEAD || true
git fetch origin "v3.4.0" && git checkout --force FETCH_HEAD || true
git submodule --quiet foreach --recursive git reset --quiet --hard
git submodule --quiet update --init --recursive --depth 1 --jobs 8
git apply --reject --whitespace=fix "${RootDir}/build_tools/patch_deps_unix/eigenpy.patch"
Expand Down Expand Up @@ -207,13 +207,12 @@ git fetch origin "v5.2.5" && git checkout --force FETCH_HEAD || true
### Checkout hpp-fcl
if [ ! -d "${RootDir}/hpp-fcl" ]; then
git clone --depth 1 https://github.com/humanoid-path-planner/hpp-fcl.git "${RootDir}/hpp-fcl"
git config --global url."https://".insteadOf git://
fi
rm -rf "${RootDir}/hpp-fcl/build"
mkdir -p "${RootDir}/hpp-fcl/build"
cd "${RootDir}/hpp-fcl"
git reset --hard
git fetch origin "v2.4.1" && git checkout --force FETCH_HEAD || true
git fetch origin "v2.4.4" && git checkout --force FETCH_HEAD || true
git submodule --quiet foreach --recursive git reset --quiet --hard
git submodule --quiet update --init --recursive --depth 1 --jobs 8
git apply --reject --whitespace=fix "${RootDir}/build_tools/patch_deps_unix/hppfcl.patch"
Expand All @@ -224,7 +223,6 @@ git fetch origin "v8.0.2" && git checkout --force FETCH_HEAD || true
### Checkout pinocchio and its submodules
if [ ! -d "${RootDir}/pinocchio" ]; then
git clone --depth 1 https://github.com/stack-of-tasks/pinocchio.git "${RootDir}/pinocchio"
git config --global url."https://".insteadOf git://
fi
rm -rf "${RootDir}/pinocchio/build"
mkdir -p "${RootDir}/pinocchio/build"
Expand Down
6 changes: 2 additions & 4 deletions build_tools/build_install_deps_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ if (-not (Test-Path -PathType Container "$RootDir/eigenpy")) {
}
Push-Location -Path "$RootDir/eigenpy"
git reset --hard
git fetch origin "v3.3.0"
git fetch origin "v3.4.0"
git checkout --force FETCH_HEAD
git submodule --quiet foreach --recursive git reset --quiet --hard
git submodule --quiet update --init --recursive --depth 1 --jobs 8
Expand Down Expand Up @@ -191,11 +191,10 @@ Pop-Location
### Checkout hpp-fcl, then apply some patches
if (-not (Test-Path -PathType Container "$RootDir/hpp-fcl")) {
git clone --depth=1 https://github.com/humanoid-path-planner/hpp-fcl.git "$RootDir/hpp-fcl"
git config --global url."https://".insteadOf git://
}
Push-Location -Path "$RootDir/hpp-fcl"
git reset --hard
git fetch origin "v2.4.1"
git fetch origin "v2.4.4"
git checkout --force FETCH_HEAD
git submodule --quiet foreach --recursive git reset --quiet --hard
git submodule --quiet update --init --recursive --depth 1 --jobs 8
Expand All @@ -210,7 +209,6 @@ Pop-Location
### Checkout pinocchio and its submodules, then apply some patches
if (-not (Test-Path -PathType Container "$RootDir/pinocchio")) {
git clone --depth=1 https://github.com/stack-of-tasks/pinocchio.git "$RootDir/pinocchio"
git config --global url."https://".insteadOf git://
}
Push-Location -Path "$RootDir/pinocchio"
git reset --hard
Expand Down
4 changes: 2 additions & 2 deletions build_tools/easy_install_deps_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ fi
# Note that `apt-get` is used instead of `apt` because it supports wildcard in package names
apt-mark unhold "robotpkg-py3*-eigenpy" "robotpkg-py3*-hpp-fcl" "robotpkg-py3*-pinocchio"
apt-get install -y --allow-downgrades --allow-unauthenticated \
robotpkg-urdfdom-headers=1.0.4 robotpkg-hpp-fcl=2.4.1 robotpkg-pinocchio=2.7.0 \
robotpkg-py3*-eigenpy=3.3.0 robotpkg-py3*-hpp-fcl=2.4.1 robotpkg-py3*-pinocchio=2.7.0
robotpkg-urdfdom-headers=1.0.4 robotpkg-hpp-fcl=2.4.4 robotpkg-pinocchio=2.7.0 \
robotpkg-py3*-eigenpy=3.4.0 robotpkg-py3*-hpp-fcl=2.4.4 robotpkg-py3*-pinocchio=2.7.0
apt-mark hold "robotpkg-py3*-eigenpy" "robotpkg-py3*-hpp-fcl" "robotpkg-py3*-pinocchio"

# Add openrobots libraries to python packages search path
Expand Down
25 changes: 24 additions & 1 deletion python/jiminy_py/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from glob import glob
from importlib.metadata import version
from setuptools import setup, dist, find_namespace_packages
from setuptools.command.install import install

Expand All @@ -20,6 +21,28 @@ def finalize_options(self) -> None:
self.install_lib = self.install_platlib


# Determine the supported range of numpy versions, assuming that the version
# currently available was used to compile all C++ extension modules bundled
# with Jiminy.
# * Numpy API as limited backward compatibility range based on some complex
# logics not following a predefined pattern (since 1.25). See documentation:
# https://numpy.org/devdocs/dev/depending_on_numpy.html#build-time-dependency
# * Numpy API is only minor-version forward compatible
np_ver = tuple(map(int, version('numpy').split(".", 3)[:2]))
if np_ver < (1, 25):
np_req = f"numpy>={np_ver[0]}.{np_ver[1]}.0"
if np_ver < (1, 20):
np_req += ",<1.20.0"
elif np_ver < (1, 22):
np_req += ",!=1.21.0,!=1.21.1,!=1.21.2,!=1.21.3,!=1.21.4"
else:
if np_ver < (2, 1):
np_req = "numpy>=1.19"
else:
raise ImportError("'numpy>2.0' not supported at built-time for now.")
np_req += f",<{np_ver[0]}.{np_ver[1] + 1}"


setup(
name="jiminy-py",
version="@PROJECT_VERSION@",
Expand Down Expand Up @@ -77,7 +100,7 @@ def finalize_options(self) -> None:
# - 1.22 breaks API for compiled libs.
# - 2.0 is backward compatible up to 1.23, but not forward compatible.
# see: https://numpy.org/devdocs/dev/depending_on_numpy.html
"numpy>=1.23,<2.0",
np_req,
# Parser for Jiminy's hardware description file.
"toml",
# Standalone cross-platform mesh visualizer used as Viewer's backend.
Expand Down

0 comments on commit a51cc10

Please sign in to comment.