Skip to content

Commit

Permalink
Packaging setup (pytorch#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens committed Jul 5, 2022
1 parent 225f92f commit 009cea6
Show file tree
Hide file tree
Showing 13 changed files with 754 additions and 108 deletions.
318 changes: 227 additions & 91 deletions .circleci/config.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .circleci/unittest/linux/scripts/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ dependencies:
- mujoco_py
- hydra-core
- pyrender
- tensorboard
2 changes: 1 addition & 1 deletion .circleci/unittest/linux/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pip install "git+https://github.com/pytorch/functorch.git"
python -c "import functorch"

printf "* Installing torchrl\n"
pip install -e .
python setup.py develop

if [[ $OSTYPE == 'darwin'* ]]; then
PRIVATE_MUJOCO_GL=glfw
Expand Down
2 changes: 1 addition & 1 deletion .circleci/unittest/linux_optdeps/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pip install "git+https://github.com/pytorch/functorch.git"
python -c "import functorch"

printf "* Installing torchrl\n"
pip install -e .
python setup.py develop

# smoke test
python -c "import torchrl"
1 change: 1 addition & 0 deletions .circleci/unittest/linux_stable/scripts/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ dependencies:
- mujoco_py
- hydra-core
- pyrender
- tensorboard
2 changes: 1 addition & 1 deletion .circleci/unittest/linux_stable/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ printf "* Installing torchrl\n"
printf "g++ version: "
gcc --version

pip install -e .
python setup.py develop

if [[ $OSTYPE == 'darwin'* ]]; then
PRIVATE_MUJOCO_GL=glfw
Expand Down
58 changes: 58 additions & 0 deletions packaging/build_wheels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash
set -ex

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
. "$script_dir/pkg_helpers.bash"

export BUILD_TYPE=wheel
setup_env
setup_wheel_python
pip_install numpy pyyaml future ninja
pip_install --upgrade setuptools
setup_pip_pytorch_version
python setup.py clean

# Copy binaries to be included in the wheel distribution
if [[ "$(uname)" == Darwin || "$OSTYPE" == "msys" ]]; then
python_exec="$(which python)"
bin_path=$(dirname $python_exec)
env_path=$(dirname $bin_path)
if [[ "$(uname)" == Darwin ]]; then
# Install delocate to relocate the required binaries
pip_install "delocate>=0.9"
else
cp "$bin_path/Library/bin/libpng16.dll" torchvision
cp "$bin_path/Library/bin/libjpeg.dll" torchvision
fi
else
# Install auditwheel to get some inspection utilities
pip_install auditwheel

# Point to custom libraries
export LD_LIBRARY_PATH=$(pwd)/ext_libraries/lib:$LD_LIBRARY_PATH
fi

if [[ "$OSTYPE" == "msys" ]]; then
echo "ERROR: Windows installation is not supported yet." && exit 100
else
python setup.py bdist_wheel
if [[ "$(uname)" != Darwin ]]; then
rename "linux_x86_64" "manylinux1_x86_64" dist/*.whl
fi
fi

#if [[ "$(uname)" == Darwin ]]; then
# pushd dist/
# python_exec="$(which python)"
# bin_path=$(dirname $python_exec)
# env_path=$(dirname $bin_path)
# for whl in *.whl; do
# DYLD_FALLBACK_LIBRARY_PATH="$env_path/lib/:$DYLD_FALLBACK_LIBRARY_PATH" delocate-wheel -v --ignore-missing-dependencies $whl
# done
#else
# if [[ "$OSTYPE" == "msys" ]]; then
# "$script_dir/windows/internal/vc_env_helper.bat" python $script_dir/wheel/relocate.py
# else
# LD_LIBRARY_PATH="/usr/local/lib:$CUDA_HOME/lib64:$LD_LIBRARY_PATH" python $script_dir/wheel/relocate.py
# fi
#fi
Loading

0 comments on commit 009cea6

Please sign in to comment.