diff --git a/build.cmd b/build.cmd index c34f8e77..8b6bf29b 100644 --- a/build.cmd +++ b/build.cmd @@ -59,7 +59,7 @@ if /i [%1] == [--azureBuild] ( ) else goto :Usage :Usage -echo "Usage: build.cmd [--configuration ] [--runTests] [--includeExtendedTests] [--buildDotNetBridgeOnly] [--skipDotNetBridge] [--azureBuild]" +echo "Usage: build.cmd [--configuration ] [--runTests] [--installPythonPackages] [--includeExtendedTests] [--buildDotNetBridgeOnly] [--skipDotNetBridge] [--azureBuild]" echo "" echo "Options:" echo " --configuration Build Configuration (DbgWinPy3.7,DbgWinPy3.6,DbgWinPy3.5,DbgWinPy2.7,RlsWinPy3.7,RlsWinPy3.6,RlsWinPy3.5,RlsWinPy2.7)" diff --git a/build.sh b/build.sh index 2689f233..b1300c3f 100755 --- a/build.sh +++ b/build.sh @@ -11,7 +11,7 @@ mkdir -p "${DependenciesDir}" usage() { - echo "Usage: $0 --configuration [--runTests] [--includeExtendedTests]" + echo "Usage: $0 --configuration [--runTests] [--includeExtendedTests] [--installPythonPackages]" echo "" echo "Options:" echo " --configuration Build Configuration (DbgLinPy3.7,DbgLinPy3.6,DbgLinPy3.5,DbgLinPy2.7,RlsLinPy3.7,RlsLinPy3.6,RlsLinPy3.5,RlsLinPy2.7,DbgMacPy3.7,DbgMacPy3.6,DbgMacPy3.5,DbgMacPy2.7,RlsMacPy3.7,RlsMacPy3.6,RlsMacPy3.5,RlsMacPy2.7)" diff --git a/src/DotNetBridge/Bridge.cs b/src/DotNetBridge/Bridge.cs index 302a9426..40220cc8 100644 --- a/src/DotNetBridge/Bridge.cs +++ b/src/DotNetBridge/Bridge.cs @@ -242,6 +242,10 @@ private struct EnvironmentBlock // Call back to provide cancel flag. [FieldOffset(0x28)] public readonly void* checkCancel; + + // Path to python executable. + [FieldOffset(0x30)] + public readonly sbyte* pythonPath; #pragma warning restore 649 // never assigned } diff --git a/src/DotNetBridge/DotNetBridge.csproj b/src/DotNetBridge/DotNetBridge.csproj index d2a95a7c..dd0e2c5d 100644 --- a/src/DotNetBridge/DotNetBridge.csproj +++ b/src/DotNetBridge/DotNetBridge.csproj @@ -42,7 +42,7 @@ - + diff --git a/src/DotNetBridge/RunGraph.cs b/src/DotNetBridge/RunGraph.cs index f79cff9d..c9d668fa 100644 --- a/src/DotNetBridge/RunGraph.cs +++ b/src/DotNetBridge/RunGraph.cs @@ -147,8 +147,11 @@ private static void RunGraphCore(EnvironmentBlock* penv, IHostEnvironment env, s var extension = Path.GetExtension(path); if (extension == ".txt") dv = TextLoader.LoadFile(host, new TextLoader.Options(), new MultiFileSource(path)); - else if(extension == ".dprep") + else if (extension == ".dprep") + { + DPrepSettings.Instance.PythonPath = BytesToString(penv->pythonPath); dv = DataFlow.FromDPrepFile(path).ToDataView(); + } else dv = new BinaryLoader(host, new BinaryLoader.Arguments(), path); } diff --git a/src/NativeBridge/ManagedInterop.cpp b/src/NativeBridge/ManagedInterop.cpp index 497d5d0f..bca89755 100644 --- a/src/NativeBridge/ManagedInterop.cpp +++ b/src/NativeBridge/ManagedInterop.cpp @@ -77,7 +77,7 @@ EnvironmentBlock::~EnvironmentBlock() FillDead(_vset[i]); } -EnvironmentBlock::EnvironmentBlock(int verbosity, int maxThreadsAllowed, int seed) +EnvironmentBlock::EnvironmentBlock(int verbosity, int maxThreadsAllowed, int seed, const char* pythonPath) { // Assert that this class doesn't have a vtable. assert(offsetof(EnvironmentBlock, verbosity) == 0); @@ -86,6 +86,7 @@ EnvironmentBlock::EnvironmentBlock(int verbosity, int maxThreadsAllowed, int see this->verbosity = verbosity; this->maxThreadsAllowed = maxThreadsAllowed; this->seed = seed; + this->pythonPath = pythonPath; this->_kindMask = (1 << Warning) | (1 << Error); if (verbosity > 0) this->_kindMask |= (1 << Info); diff --git a/src/NativeBridge/ManagedInterop.h b/src/NativeBridge/ManagedInterop.h index 1629716a..5d9582a3 100644 --- a/src/NativeBridge/ManagedInterop.h +++ b/src/NativeBridge/ManagedInterop.h @@ -81,8 +81,11 @@ class CLASS_ALIGN EnvironmentBlock // Check cancellation flag. CHECKCANCEL checkCancel; + // Path to python executable + const char* pythonPath; + public: - EnvironmentBlock(int verbosity = 0, int maxThreadsAllowed = 0, int seed = 42); + EnvironmentBlock(int verbosity = 0, int maxThreadsAllowed = 0, int seed = 42, const char* pythonPath = NULL); ~EnvironmentBlock(); PyErrorCode GetErrorCode() { return _errCode; } std::string GetErrorMessage() { return _errMessage; } diff --git a/src/NativeBridge/dllmain.cpp b/src/NativeBridge/dllmain.cpp index c656f6d0..0dafd696 100644 --- a/src/NativeBridge/dllmain.cpp +++ b/src/NativeBridge/dllmain.cpp @@ -12,6 +12,7 @@ #define PARAM_MLNET_PATH "mlnetPath" #define PARAM_DOTNETCLR_PATH "dotnetClrPath" #define PARAM_DPREP_PATH "dprepPath" +#define PARAM_PYTHON_PATH "pythonPath" #define PARAM_DATA "data" @@ -74,13 +75,15 @@ bp::dict pxCall(bp::dict& params) bp::extract mlnetPath(params[PARAM_MLNET_PATH]); bp::extract dotnetClrPath(params[PARAM_DOTNETCLR_PATH]); bp::extract dprepPath(params[PARAM_DPREP_PATH]); - bp::extract verbose(params[PARAM_VERBOSE]); + bp::extract pythonPath(params[PARAM_PYTHON_PATH]); + bp::extract verbose(params[PARAM_VERBOSE]); std::int32_t i_verbose = std::int32_t(verbose); std::string s_mlnetPath = std::string(mlnetPath); std::string s_dotnetClrPath = std::string(dotnetClrPath); std::string s_dprepPath = std::string(dprepPath); - std::string s_graph = std::string(graph); - const char *mlnetpath = s_mlnetPath.c_str(); + std::string s_pythonPath = std::string(pythonPath); + std::string s_graph = std::string(graph); + const char *mlnetpath = s_mlnetPath.c_str(); const char *coreclrpath = s_dotnetClrPath.c_str(); const char *dpreppath = s_dprepPath.c_str(); @@ -93,7 +96,7 @@ bp::dict pxCall(bp::dict& params) if (params.has_key(PARAM_SEED)) seed = bp::extract(params[PARAM_SEED]); - EnvironmentBlock env(i_verbose, 0, seed); + EnvironmentBlock env(i_verbose, 0, seed, s_pythonPath.c_str()); int retCode; if (params.has_key(PARAM_DATA) && bp::extract(params[PARAM_DATA]).check()) { diff --git a/src/Platforms/build.csproj b/src/Platforms/build.csproj index 4cd284fc..75fa806f 100644 --- a/src/Platforms/build.csproj +++ b/src/Platforms/build.csproj @@ -22,7 +22,7 @@ - + diff --git a/src/python/nimbusml/__init__.py b/src/python/nimbusml/__init__.py index bff09a6f..88e006aa 100644 --- a/src/python/nimbusml/__init__.py +++ b/src/python/nimbusml/__init__.py @@ -2,7 +2,7 @@ Microsoft Machine Learning for Python """ -__version__ = '1.3.0' +__version__ = '1.3.1' # CoreCLR version of MicrosoftML is built on Windows. # But file permissions are not preserved when it's copied to Linux. diff --git a/src/python/nimbusml/internal/utils/entrypoints.py b/src/python/nimbusml/internal/utils/entrypoints.py index 6d985eaa..1e6037db 100644 --- a/src/python/nimbusml/internal/utils/entrypoints.py +++ b/src/python/nimbusml/internal/utils/entrypoints.py @@ -5,6 +5,7 @@ """ definition of classes for the entities in the entrypoint manifest.json """ +import sys import functools import json import os @@ -450,6 +451,7 @@ def remove_multi_level_index(c): call_parameters['dotnetClrPath'] = try_set(get_clr_path(), False, str) call_parameters['mlnetPath'] = try_set(get_mlnet_path(), False, str) call_parameters['dprepPath'] = try_set(get_dprep_path(), False, str) + call_parameters['pythonPath'] = try_set(sys.executable, False, str) if random_state: call_parameters['seed'] = try_set(random_state, False, six.integer_types) diff --git a/src/python/setup.py b/src/python/setup.py index 3a19fc47..251adae1 100644 --- a/src/python/setup.py +++ b/src/python/setup.py @@ -45,7 +45,7 @@ # Versions should comply with PEP440. For a discussion on # single-sourcing the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html - version='1.3.0', + version='1.3.1', description='NimbusML', long_description=long_description, diff --git a/version.txt b/version.txt index 589268e6..6261a05b 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.3.0 \ No newline at end of file +1.3.1 \ No newline at end of file