From fe24d82c2372437fd60d47027f3fce3e07ee91d5 Mon Sep 17 00:00:00 2001 From: Yixing Lao Date: Wed, 17 Oct 2018 15:31:12 -0700 Subject: [PATCH 1/3] supports make conda-package --- src/Python/CMakeLists.txt | 32 +++++++++++++++-- .../Python/Package/conda_meta}/bld.bat | 0 .../Python/Package/conda_meta}/build.sh | 0 .../conda_meta/conda_build_config.yaml | 2 ++ .../Python/Package/conda_meta}/meta.yaml | 34 +++++++++---------- .../Python/Package/conda_meta}/test_import.py | 0 .../open3d/{__init__.py.in => __init__.py} | 0 src/Python/Package/{setup.py.in => setup.py} | 0 src/Python/check_and_install_conda_deps.cmake | 34 +++++++++++++++++++ src/Python/install_pip_wheel.cmake | 6 ++-- src/Python/make_all_pip_wheels.cmake | 2 +- src/Python/make_python_package.cmake | 11 +++--- util/conda_package/README.md | 5 +-- .../open3d/conda_build_config.yaml | 4 --- 14 files changed, 96 insertions(+), 34 deletions(-) rename {util/conda_package/open3d => src/Python/Package/conda_meta}/bld.bat (100%) rename {util/conda_package/open3d => src/Python/Package/conda_meta}/build.sh (100%) create mode 100644 src/Python/Package/conda_meta/conda_build_config.yaml rename {util/conda_package/open3d => src/Python/Package/conda_meta}/meta.yaml (50%) rename {util/conda_package/open3d => src/Python/Package/conda_meta}/test_import.py (100%) rename src/Python/Package/open3d/{__init__.py.in => __init__.py} (100%) rename src/Python/Package/{setup.py.in => setup.py} (100%) create mode 100644 src/Python/check_and_install_conda_deps.cmake delete mode 100644 util/conda_package/open3d/conda_build_config.yaml diff --git a/src/Python/CMakeLists.txt b/src/Python/CMakeLists.txt index 31e23188fc5..92336a72d44 100644 --- a/src/Python/CMakeLists.txt +++ b/src/Python/CMakeLists.txt @@ -9,7 +9,15 @@ if (NOT PYTHON_EXECUTABLE) find_program(PYTHON_IN_PATH "python") set(PYTHON_EXECUTABLE ${PYTHON_IN_PATH}) endif() -message("Using Python executable ${PYTHON_EXECUTABLE}") +message(STATUS "Using Python executable: ${PYTHON_EXECUTABLE}") + +# We need to get python version to configure some meta files +execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import sys; print('%d.%d' % (sys.version_info.major, sys.version_info.minor))" + OUTPUT_VARIABLE PYTHON_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE +) +message(STATUS "Using Python version: ${PYTHON_VERSION}") set(PACKAGE_NAME open3d) @@ -48,6 +56,7 @@ add_custom_target(python-package COMMAND ${CMAKE_COMMAND} -DPYTHON_PACKAGE_SRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}/Package -DPYTHON_PACKAGE_DST_DIR=${PYTHON_PACKAGE_DST_DIR} + -DPYTHON_VERSION=${PYTHON_VERSION} -DPYTHON_COMPILED_MODULE_PATH=$ -DPROJECT_EMAIL=${PROJECT_EMAIL} -DPROJECT_HOME=${PROJECT_HOME} @@ -61,7 +70,8 @@ add_custom_target(python-package # Use `make pip-wheel` to create the pip package in the build directory add_custom_target(pip-wheel - COMMAND ${PYTHON_EXECUTABLE} "setup.py" "bdist_wheel" + COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel --dist-dir pip_wheel + COMMAND echo "pip wheel created at ${PYTHON_PACKAGE_DST_DIR}/pip_wheel" WORKING_DIRECTORY ${PYTHON_PACKAGE_DST_DIR} DEPENDS python-package ) @@ -75,6 +85,24 @@ add_custom_target(install-pip-wheel DEPENDS pip-wheel ) +# Use `make conda-package` to create conda package in the build directory +# Note that we don't provide `make install-conda-package` similar to pip. This +# is becuase: +# 1) `make install-pip-whell` works in conda environment for local build +# 2) `make conda-package` is mainly for internal use to distribute conda +add_custom_target(conda-package + COMMAND ${CMAKE_COMMAND} + -DPYTHON_PACKAGE_DST_DIR=${PYTHON_PACKAGE_DST_DIR} + -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} + -P ${CMAKE_CURRENT_SOURCE_DIR}/check_and_install_conda_deps.cmake + # If we put the following `conda-build` in check_and_install_conda_deps.cmake, it + # causes broken pipe problem while running conda build. So we put it here. + COMMAND conda-build conda_meta --output-folder conda_package + COMMAND echo "conda package created at ${PYTHON_PACKAGE_DST_DIR}/conda_package" + WORKING_DIRECTORY ${PYTHON_PACKAGE_DST_DIR} + DEPENDS python-package +) + ################################################################################ # Warning: Internal use only, consider droping this in the future # Use `make all-pip-wheels` to create the pip package in the build directory diff --git a/util/conda_package/open3d/bld.bat b/src/Python/Package/conda_meta/bld.bat similarity index 100% rename from util/conda_package/open3d/bld.bat rename to src/Python/Package/conda_meta/bld.bat diff --git a/util/conda_package/open3d/build.sh b/src/Python/Package/conda_meta/build.sh similarity index 100% rename from util/conda_package/open3d/build.sh rename to src/Python/Package/conda_meta/build.sh diff --git a/src/Python/Package/conda_meta/conda_build_config.yaml b/src/Python/Package/conda_meta/conda_build_config.yaml new file mode 100644 index 00000000000..57637295519 --- /dev/null +++ b/src/Python/Package/conda_meta/conda_build_config.yaml @@ -0,0 +1,2 @@ +python: + - @PYTHON_VERSION@ diff --git a/util/conda_package/open3d/meta.yaml b/src/Python/Package/conda_meta/meta.yaml similarity index 50% rename from util/conda_package/open3d/meta.yaml rename to src/Python/Package/conda_meta/meta.yaml index 331ed1e787a..73b94379f74 100644 --- a/util/conda_package/open3d/meta.yaml +++ b/src/Python/Package/conda_meta/meta.yaml @@ -6,28 +6,28 @@ # since we'll use the `open3d` name rather than open3d-python`. package: - name: open3d - version: "0.3.0" + name: open3d + version: "@PROJECT_VERSION@" source: - path: ../../pip_package + path: ../ # Points to setup.py after configuration requirements: - build: - - python {{ python }} - - setuptools - run: - - python - - numpy + build: + - python {{ python }} + - setuptools + run: + - python + - numpy test: - script: - - test_import.py + script: + - test_import.py about: - home: http://www.open3d.org/ - license: MIT - license_file: LICENSE.txt - summary: Open3D is an open-source library that supports rapid development of software that deals with 3D data. - doc_url: http://www.open3d.org/docs/ - dev_url: https://github.com/IntelVCL/Open3D + home: @PROJECT_HOME@ + license: MIT + license_file: LICENSE.txt + summary: Open3D is an open-source library that supports rapid development of software that deals with 3D data. + doc_url: @PROJECT_DOCS@ + dev_url: @PROJECT_CODE@ diff --git a/util/conda_package/open3d/test_import.py b/src/Python/Package/conda_meta/test_import.py similarity index 100% rename from util/conda_package/open3d/test_import.py rename to src/Python/Package/conda_meta/test_import.py diff --git a/src/Python/Package/open3d/__init__.py.in b/src/Python/Package/open3d/__init__.py similarity index 100% rename from src/Python/Package/open3d/__init__.py.in rename to src/Python/Package/open3d/__init__.py diff --git a/src/Python/Package/setup.py.in b/src/Python/Package/setup.py similarity index 100% rename from src/Python/Package/setup.py.in rename to src/Python/Package/setup.py diff --git a/src/Python/check_and_install_conda_deps.cmake b/src/Python/check_and_install_conda_deps.cmake new file mode 100644 index 00000000000..4d5d30df25c --- /dev/null +++ b/src/Python/check_and_install_conda_deps.cmake @@ -0,0 +1,34 @@ +# Check if conda in path, if not, throw exception +find_program(CONDA "conda") +if (NOT CONDA) + message(FATAL_ERROR "conda not found, please install, see https://conda.io/docs/user-guide/install/index.html") +else () + message(STATUS "conda is found at ${CONDA}") +endif() + +# Assert that we're inside a conda environemnt +message(STATUS "Asserting this is Conda python: ${PYTHON_EXECUTABLE} ...") +execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import sys; assert 'conda' in sys.version" + RESULT_VARIABLE return_code +) +if (${return_code}) + message(FATAL_ERROR "Not in a conda environment: 1) activate conda, 2) rerun cmake and make") +endif() + +# Check if conda-build is installed, if not, install it +find_program(CONDA_BUILD "conda-build") +if (NOT CONDA_BUILD) + message(STATUS "conda-build not found") + message(STATUS "Trying to install conda-build ...") + execute_process( + COMMAND conda install -y -q conda-build + RESULT_VARIABLE return_code + ) + find_program(CONDA_BUILD "conda-build") + if (NOT CONDA_BUILD) + message(FATAL_ERROR "conda-build installation failed, please install manualy") + else() + message(STATUS "conda-build installed at ${CONDA_BUILD}") + endif() +endif() diff --git a/src/Python/install_pip_wheel.cmake b/src/Python/install_pip_wheel.cmake index e8f2d9c9550..9ec90739f3e 100644 --- a/src/Python/install_pip_wheel.cmake +++ b/src/Python/install_pip_wheel.cmake @@ -1,7 +1,7 @@ # We need this file for cross-platform support on Windows -# For Ubuntu/Mac, we can simply do `pip install ${PYTHON_PACKAGE_DST_DIR}/dist/*.whl -U` +# For Ubuntu/Mac, we can simply do `pip install ${PYTHON_PACKAGE_DST_DIR}/pip_wheel/*.whl -U` # Note: Since `make python-package` clears PYTHON_COMPILED_MODULE_DIR every time, -# it is guaranteed that there is only one wheel in ${PYTHON_PACKAGE_DST_DIR}/dist/*.whl -file(GLOB WHEEL_FILE "${PYTHON_PACKAGE_DST_DIR}/dist/*.whl") +# it is guaranteed that there is only one wheel in ${PYTHON_PACKAGE_DST_DIR}/pip_wheel/*.whl +file(GLOB WHEEL_FILE "${PYTHON_PACKAGE_DST_DIR}/pip_wheel/*.whl") execute_process(COMMAND pip install ${WHEEL_FILE} -U) diff --git a/src/Python/make_all_pip_wheels.cmake b/src/Python/make_all_pip_wheels.cmake index dfc2d98081e..6b77cbb5a2b 100644 --- a/src/Python/make_all_pip_wheels.cmake +++ b/src/Python/make_all_pip_wheels.cmake @@ -37,7 +37,7 @@ foreach (PYPI_PACKAGE_NAME ${PYPI_PACKAGE_NAMES}) configure_file("${PYTHON_PACKAGE_SRC_DIR}/setup.py.in" "${PYTHON_PACKAGE_DST_DIR}/setup.py") execute_process( - COMMAND ${PYTHON_EXECUTABLE} "setup.py" "bdist_wheel" + COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel --dist-dir pip_wheel WORKING_DIRECTORY ${PYTHON_PACKAGE_DST_DIR} ) endforeach() diff --git a/src/Python/make_python_package.cmake b/src/Python/make_python_package.cmake index e8564c9230f..153577c2367 100644 --- a/src/Python/make_python_package.cmake +++ b/src/Python/make_python_package.cmake @@ -10,7 +10,6 @@ file(MAKE_DIRECTORY ${PYTHON_PACKAGE_DST_DIR}/open3d) # 1) Pure-python code and misc files, copied from src/Python/Package file(COPY ${PYTHON_PACKAGE_SRC_DIR}/ DESTINATION ${PYTHON_PACKAGE_DST_DIR} - PATTERN "*.in" EXCLUDE ) # 2) The compiled python-C++ module, i.e. open3d.so (or the equivalents) @@ -19,9 +18,11 @@ file(COPY ${PYTHON_COMPILED_MODULE_PATH} DESTINATION ${PYTHON_PACKAGE_DST_DIR}/open3d) # 3) Configured files and supporting files -configure_file("${PYTHON_PACKAGE_SRC_DIR}/setup.py.in" +configure_file("${PYTHON_PACKAGE_SRC_DIR}/setup.py" "${PYTHON_PACKAGE_DST_DIR}/setup.py") -configure_file("${PYTHON_PACKAGE_SRC_DIR}/MANIFEST.in" - "${PYTHON_PACKAGE_DST_DIR}/MANIFEST.in" COPYONLY) -configure_file("${PYTHON_PACKAGE_SRC_DIR}/open3d/__init__.py.in" +configure_file("${PYTHON_PACKAGE_SRC_DIR}/open3d/__init__.py" "${PYTHON_PACKAGE_DST_DIR}/open3d/__init__.py") +configure_file("${PYTHON_PACKAGE_SRC_DIR}/conda_meta/conda_build_config.yaml" + "${PYTHON_PACKAGE_DST_DIR}/conda_meta/conda_build_config.yaml") +configure_file("${PYTHON_PACKAGE_SRC_DIR}/conda_meta/meta.yaml" + "${PYTHON_PACKAGE_DST_DIR}/conda_meta/meta.yaml") diff --git a/util/conda_package/README.md b/util/conda_package/README.md index 8b3f2d75ef1..d72e11dcd95 100644 --- a/util/conda_package/README.md +++ b/util/conda_package/README.md @@ -27,7 +27,7 @@ source activate clean_build_env2.7 # On Mac/Ubuntu, we need to build all dependencies as static libs from source # On Windows, this is enabled by default -cmake -DWITH_OPENMP=ON -DBUILD_EXPERIMENTAL=ON -DBUILD_EIGEN3=ON \ +cmake -DWITH_OPENMP=ON -DBUILD_EIGEN3=ON \ -DBUILD_GLEW=ON -DBUILD_GLFW=ON -DBUILD_JPEG=ON -DBUILD_JSONCPP=ON \ -DBUILD_PNG=ON -DBUILD_PYBIND11=ON -DBUILD_PYTHON_MODULE=ON \ -DBUILD_TINYFILEDIALOGS=ON \ @@ -48,6 +48,7 @@ Note: On windows, in order to build 32-bit binaries, we'll need to run ``` set CONDA_FORCE_32BIT=1 ``` + before creating and activating the conda environment. When configuring the projects, instead of `Visual Studio 15 2017 Win64`, we @@ -103,7 +104,7 @@ conda create -n build_env python=3.6 source activate build_env # Install conda-build -conda install conda-build +conda install -y -q conda-build # Build Conda package conda-build open3d --output-folder dist diff --git a/util/conda_package/open3d/conda_build_config.yaml b/util/conda_package/open3d/conda_build_config.yaml deleted file mode 100644 index 2f4865cd2df..00000000000 --- a/util/conda_package/open3d/conda_build_config.yaml +++ /dev/null @@ -1,4 +0,0 @@ -python: - - 2.7 - - 3.5 - - 3.6 From 2dc80b62503332b3ae98456812c94586dfe466b1 Mon Sep 17 00:00:00 2001 From: Yixing Lao Date: Wed, 17 Oct 2018 15:41:14 -0700 Subject: [PATCH 2/3] consistant naming for pip package --- src/Python/CMakeLists.txt | 22 +++++++++---------- ...eels.cmake => make_all_pip_packages.cmake} | 4 ++-- ...l.cmake => make_install_pip_package.cmake} | 6 ++--- 3 files changed, 16 insertions(+), 16 deletions(-) rename src/Python/{make_all_pip_wheels.cmake => make_all_pip_packages.cmake} (94%) rename src/Python/{install_pip_wheel.cmake => make_install_pip_package.cmake} (70%) diff --git a/src/Python/CMakeLists.txt b/src/Python/CMakeLists.txt index 92336a72d44..f123c77b7fa 100644 --- a/src/Python/CMakeLists.txt +++ b/src/Python/CMakeLists.txt @@ -68,21 +68,21 @@ add_custom_target(python-package -P ${CMAKE_CURRENT_SOURCE_DIR}/make_python_package.cmake ) -# Use `make pip-wheel` to create the pip package in the build directory -add_custom_target(pip-wheel - COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel --dist-dir pip_wheel - COMMAND echo "pip wheel created at ${PYTHON_PACKAGE_DST_DIR}/pip_wheel" +# Use `make pip-package` to create the pip package in the build directory +add_custom_target(pip-package + COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel --dist-dir pip_package + COMMAND echo "pip wheel created at ${PYTHON_PACKAGE_DST_DIR}/pip_package" WORKING_DIRECTORY ${PYTHON_PACKAGE_DST_DIR} DEPENDS python-package ) -# Use `make install-pip-wheel` to install pip wheel package to the current +# Use `make install-pip-package` to install pip wheel package to the current # python environment. -add_custom_target(install-pip-wheel +add_custom_target(install-pip-package COMMAND ${CMAKE_COMMAND} -DPYTHON_PACKAGE_DST_DIR=${PYTHON_PACKAGE_DST_DIR} - -P ${CMAKE_CURRENT_SOURCE_DIR}/install_pip_wheel.cmake - DEPENDS pip-wheel + -P ${CMAKE_CURRENT_SOURCE_DIR}/make_install_pip_package.cmake + DEPENDS pip-package ) # Use `make conda-package` to create conda package in the build directory @@ -105,10 +105,10 @@ add_custom_target(conda-package ################################################################################ # Warning: Internal use only, consider droping this in the future -# Use `make all-pip-wheels` to create the pip package in the build directory +# Use `make all-pip-packages` to create the pip package in the build directory # This creates: open3d-python, py3d, open3d-original, open3d-official, open-3d # pip wheels -add_custom_target(all-pip-wheels +add_custom_target(all-pip-packages COMMAND ${CMAKE_COMMAND} -DPYTHON_PACKAGE_SRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}/Package -DPYTHON_PACKAGE_DST_DIR=${PYTHON_PACKAGE_DST_DIR} @@ -120,5 +120,5 @@ add_custom_target(all-pip-wheels -DPROJECT_CODE=${PROJECT_CODE} -DPROJECT_ISSUES=${PROJECT_ISSUES} -DPROJECT_VERSION=${PROJECT_VERSION} - -P ${CMAKE_CURRENT_SOURCE_DIR}/make_all_pip_wheels.cmake + -P ${CMAKE_CURRENT_SOURCE_DIR}/make_all_pip_packages.cmake ) diff --git a/src/Python/make_all_pip_wheels.cmake b/src/Python/make_all_pip_packages.cmake similarity index 94% rename from src/Python/make_all_pip_wheels.cmake rename to src/Python/make_all_pip_packages.cmake index 6b77cbb5a2b..35d54290b7e 100644 --- a/src/Python/make_all_pip_wheels.cmake +++ b/src/Python/make_all_pip_packages.cmake @@ -1,5 +1,5 @@ # Warning: Internal use only, consider droping this in the future -# Use `make all-pip-wheels` to create the pip package in the build directory +# Use `make all-pip-pacakges` to create the pip package in the build directory # This creates: open3d-python, py3d, open3d-original, open3d-official, open-3d # pip wheels @@ -37,7 +37,7 @@ foreach (PYPI_PACKAGE_NAME ${PYPI_PACKAGE_NAMES}) configure_file("${PYTHON_PACKAGE_SRC_DIR}/setup.py.in" "${PYTHON_PACKAGE_DST_DIR}/setup.py") execute_process( - COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel --dist-dir pip_wheel + COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel --dist-dir pip_package WORKING_DIRECTORY ${PYTHON_PACKAGE_DST_DIR} ) endforeach() diff --git a/src/Python/install_pip_wheel.cmake b/src/Python/make_install_pip_package.cmake similarity index 70% rename from src/Python/install_pip_wheel.cmake rename to src/Python/make_install_pip_package.cmake index 9ec90739f3e..beb77cb569e 100644 --- a/src/Python/install_pip_wheel.cmake +++ b/src/Python/make_install_pip_package.cmake @@ -1,7 +1,7 @@ # We need this file for cross-platform support on Windows -# For Ubuntu/Mac, we can simply do `pip install ${PYTHON_PACKAGE_DST_DIR}/pip_wheel/*.whl -U` +# For Ubuntu/Mac, we can simply do `pip install ${PYTHON_PACKAGE_DST_DIR}/pip_package/*.whl -U` # Note: Since `make python-package` clears PYTHON_COMPILED_MODULE_DIR every time, -# it is guaranteed that there is only one wheel in ${PYTHON_PACKAGE_DST_DIR}/pip_wheel/*.whl -file(GLOB WHEEL_FILE "${PYTHON_PACKAGE_DST_DIR}/pip_wheel/*.whl") +# it is guaranteed that there is only one wheel in ${PYTHON_PACKAGE_DST_DIR}/pip_package/*.whl +file(GLOB WHEEL_FILE "${PYTHON_PACKAGE_DST_DIR}/pip_package/*.whl") execute_process(COMMAND pip install ${WHEEL_FILE} -U) From cd53d10634763bddf2c8d4474726d5de810621c6 Mon Sep 17 00:00:00 2001 From: Yixing Lao Date: Wed, 17 Oct 2018 16:44:05 -0700 Subject: [PATCH 3/3] removed old doc --- util/conda_package/README.md | 155 ----------------------------------- 1 file changed, 155 deletions(-) delete mode 100644 util/conda_package/README.md diff --git a/util/conda_package/README.md b/util/conda_package/README.md deleted file mode 100644 index d72e11dcd95..00000000000 --- a/util/conda_package/README.md +++ /dev/null @@ -1,155 +0,0 @@ -# Building Conda package for Open3D - -## Prerequisites - -Install `conda`, following -[this instruction](https://conda.io/docs/user-guide/install/index.html). - -## Build Conda package - -We use the same `setup.py` and shared library objects as when we're building -the `pip_package`. - -### 1. Compile Open3D with different platforms with different Python versions - -Example of building with Python 2.7 on Mac -- other platforms and Python -versions shall be similar: - -```bash -# Create a clean build folder, you'll need different build folders for -# different configurations -mkdir build_macos_27 -cd build_macos_27 - -# Create build environment with a specific Python version -conda create -n clean_build_env2.7 python=2.7 -source activate clean_build_env2.7 - -# On Mac/Ubuntu, we need to build all dependencies as static libs from source -# On Windows, this is enabled by default -cmake -DWITH_OPENMP=ON -DBUILD_EIGEN3=ON \ - -DBUILD_GLEW=ON -DBUILD_GLFW=ON -DBUILD_JPEG=ON -DBUILD_JSONCPP=ON \ - -DBUILD_PNG=ON -DBUILD_PYBIND11=ON -DBUILD_PYTHON_MODULE=ON \ - -DBUILD_TINYFILEDIALOGS=ON \ - -DPYTHON_EXECUTABLE=`which python2.7` .. -make -j - -# Copy shared library to the corresponding platform folder -# The `open3d.so` name will be different depending on your Python version -cp lib/Python/open3d.so ../util/pip_package/open3d/macos - -# Deactivate -source deactivate -cd .. -``` - -Note: On windows, in order to build 32-bit binaries, we'll need to run - -``` -set CONDA_FORCE_32BIT=1 -``` - -before creating and activating the conda environment. - -When configuring the projects, instead of `Visual Studio 15 2017 Win64`, we -use - -``` -cmake -DPYTHON_EXECUTABLE=C:\path_to_the_32bit_python_env\python.exe \ - -G "Visual Studio 15 2017" .. -``` - -After copying the file, the directory shall contain the following files: - -```bash -➜ ~/repo/Open3D tree util/pip_package/open3d/ -util/pip_package/open3d/ -├── __init__.py -├── linux -│   ├── __init__.py -│   ├── open3d.cpython-35m-x86_64-linux-gnu.so -│   ├── open3d.cpython-36m-x86_64-linux-gnu.so -│   ├── open3d.so -│   └── readme.txt -├── macos -│   ├── __init__.py -│   ├── open3d.cpython-35m-darwin.so -│   ├── open3d.cpython-36m-darwin.so -│   ├── open3d.so -│   └── readme.txt -└── win32 - ├── 32b - │   ├── __init__.py - │   ├── open3d.cp35-win32.pyd - │   ├── open3d.cp36-win32.pyd - │   └── open3d.pyd - ├── 64b - │   ├── __init__.py - │   ├── open3d.cp35-win_amd64.pyd - │   ├── open3d.cp36-win_amd64.pyd - │   └── open3d.pyd - ├── __init__.py - └── readme.txt -``` - -### 2. Build Conda package - -For each OS, we need to run the following commands to build the conda package: - -```bash -cd Open3D/util/conda_package - -# Create a fresh Conda virtualenv -conda create -n build_env python=3.6 -source activate build_env - -# Install conda-build -conda install -y -q conda-build - -# Build Conda package -conda-build open3d --output-folder dist -``` - -After building, `conda-build` automatically tries to run `import open3d`. If the -build is successful, the Conda package tar files shall be located in -`Open3D/util/conda_package/dist`. - -### 3. Install Conda package locally for testing (optional) - -We could test the conda package locally. Example for macOS with Python 3.6: - -```bash -# Activate the new environment that we just created -conda create -n test_env3.6 python=3.6 -source activate test_env3.6 - -# Install the Conda packages -conda install numpy # For local conda packages, we need to install deps manually -conda install Open3D/util/conda_package/dist/osx-64/open3d-0.3.0-py36_0.tar.bz2 - -# Try importing -python -c "from open3d import *" -``` - -### 4. Upload to Anaconda cloud - -The last step is to upload it to Anaconda cloud. Example for macOS with Python -3.6: - -```bash -# Install Anaconda client -source activate build_env -conda install anaconda-client - -# Example: upload macOS python3.6 package -anaconda upload dist/osx-64/open3d-0.3.0-py36_0.tar.bz2 -``` - -Now we can try installing it by: - -```bash -conda create -n new_env3.6 python=3.6 -source activate new_env3.6 - -conda install -c open3d-admin open3d -```