From 36c082e26824aa7423005d37de83b8ddc3f77502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?xavier=20dupr=C3=A9?= Date: Tue, 5 Mar 2019 20:36:51 +0100 Subject: [PATCH 1/2] compilation on debian --- cmake/onnxruntime_python.cmake | 2 +- onnxruntime/__init__.py | 2 +- onnxruntime/python/onnxruntime_validation.py | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cmake/onnxruntime_python.cmake b/cmake/onnxruntime_python.cmake index c7df6a7de3b7d..efe411d46bf15 100644 --- a/cmake/onnxruntime_python.cmake +++ b/cmake/onnxruntime_python.cmake @@ -86,7 +86,7 @@ elseif (APPLE) BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH_USE_LINK_PATH FALSE) else() - target_link_libraries(onnxruntime_pybind11_state ${onnxruntime_pybind11_state_libs} ${PYTHON_LIBRARY} ${ONNXRUNTIME_SO_LINK_FLAG} debug ${onnxruntime_EXTERNAL_LIBRARIES_DEBUG} optimized ${onnxruntime_EXTERNAL_LIBRARIES}) + target_link_libraries(onnxruntime_pybind11_state PRIVATE ${onnxruntime_pybind11_state_libs} ${PYTHON_LIBRARY} ${ONNXRUNTIME_SO_LINK_FLAG} debug ${onnxruntime_EXTERNAL_LIBRARIES_DEBUG} optimized ${onnxruntime_EXTERNAL_LIBRARIES}) set_target_properties(onnxruntime_pybind11_state PROPERTIES LINK_FLAGS "-Xlinker -rpath=\$ORIGIN") endif() diff --git a/onnxruntime/__init__.py b/onnxruntime/__init__.py index f14d69330adb7..9808f2606f875 100644 --- a/onnxruntime/__init__.py +++ b/onnxruntime/__init__.py @@ -12,7 +12,7 @@ as Deep Learning algorithms in the `ONNX-ML format `_. """ -__version__ = "0.2.1" +__version__ = "0.2.2" __author__ = "Microsoft" from onnxruntime.capi import onnxruntime_validation diff --git a/onnxruntime/python/onnxruntime_validation.py b/onnxruntime/python/onnxruntime_validation.py index b337395d87c0a..7350fe6655bac 100644 --- a/onnxruntime/python/onnxruntime_validation.py +++ b/onnxruntime/python/onnxruntime_validation.py @@ -47,9 +47,6 @@ def check_distro_info(): # warn the user ONNX Runtime may not work out of the box __my_distro__ = __my_distro__.lower() __my_distro_ver__ = __my_distro_ver__.lower() - - if __my_distro__ != 'ubuntu' and __my_distro_ver__ != '16.04': - warnings.warn('Unsupported Linux distribution (%s-%s). ONNX Runtime supports Ubuntu 16.04 only.' % (__my_distro__, __my_distro_ver__)) elif __my_system__ == 'darwin': __my_distro__ = __my_system__ __my_distro_ver__ = platform.release().lower() From be6bed5a6fade01d6324255260d33ee4ff7fec3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?xavier=20dupr=C3=A9?= Date: Wed, 6 Mar 2019 12:40:40 +0100 Subject: [PATCH 2/2] add options numpy_version, skip_keras_test to build.py --- tools/ci_build/build.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 6f66e07a3416d..e420f516e0cc5 100755 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -79,6 +79,9 @@ def parse_arguments(): # Python bindings parser.add_argument("--enable_pybind", action='store_true', help="Enable Python Bindings.") parser.add_argument("--build_wheel", action='store_true', help="Build Python Wheel. ") + parser.add_argument("--numpy_version", default='1.15.0', help="Installs a specific version of numpy " + "before building the python binding.") + parser.add_argument("--skip-keras-test", action='store_true', help="Skip tests with Keras if keras is installed") # C-Sharp bindings parser.add_argument("--build_csharp", action='store_true', help="Build C#.Net DLL and NuGet package") @@ -195,8 +198,9 @@ def install_ubuntu_deps(args): except Exception as e: raise BuildError("Error setting up required APT packages. {}".format(str(e))) -def install_python_deps(): - dep_packages = ['setuptools', 'wheel', 'numpy==1.15.0'] +def install_python_deps(numpy_version=""): + dep_packages = ['setuptools', 'wheel'] + dep_packages.append('numpy==%s' % numpy_version if numpy_version else 'numpy') run_subprocess([sys.executable, '-m', 'pip', 'install', '--trusted-host', 'files.pythonhosted.org'] + dep_packages) def check_md5(filename, expected_md5): @@ -465,15 +469,16 @@ def run_onnxruntime_tests(args, source_dir, ctest_path, build_dir, configs, enab run_subprocess([os.path.join(cwd,'onnx_test_runner'), 'test_models'], cwd=cwd) if config != 'Debug': run_subprocess([sys.executable, 'onnx_backend_test_series.py'], cwd=cwd, dll_path=dll_path) - try: - import onnxmltools - import keras - onnxml_test = True - except ImportError: - warnings.warn("onnxmltools and keras are not installed. Following test cannot be run.") - onnxml_test = False - if onnxml_test: - run_subprocess([sys.executable, 'onnxruntime_test_python_keras.py'], cwd=cwd, dll_path=dll_path) + if not args.skip_keras_test: + try: + import onnxmltools + import keras + onnxml_test = True + except ImportError: + warnings.warn("onnxmltools and keras are not installed. Following test cannot be run.") + onnxml_test = False + if onnxml_test: + run_subprocess([sys.executable, 'onnxruntime_test_python_keras.py'], cwd=cwd, dll_path=dll_path) def run_onnx_tests(build_dir, configs, onnx_test_data_dir, provider, enable_parallel_executor_test, num_parallel_models): for config in configs: @@ -570,7 +575,7 @@ def main(): if not is_docker(): install_python_deps() if (args.enable_pybind and is_windows()): - install_python_deps() + install_python_deps(args.numpy_version) if (not args.skip_submodule_sync): update_submodules(source_dir)