Skip to content

Commit

Permalink
Address SAM issue #1928
Browse files Browse the repository at this point in the history
LandBOSSE 2.3.0.3 is latest PyPi package and supports Python 3.7 only - numpy 1.4.5 requirements do not work with later Python versions. Later LandBOSSE version 2.5.0 has to be installed locally if used with later versions of Python. install_python.ps1 updated to work with Python 3.7 since get-pip.py requires 3.8 or later.
  • Loading branch information
sjanzou committed Dec 4, 2024
1 parent 4fa438c commit da65a33
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
7 changes: 4 additions & 3 deletions deploy/runtime/python/install_python.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ function Get-Pip {
Remove-Item $filename
}
if (!(Test-Path $filename)) {
Invoke-WebRequestExitOnError https://bootstrap.pypa.io/${filename} $filename
#Specific to Python 3.7 and LandBOSSE 2.3.0.3
Invoke-WebRequestExitOnError https://bootstrap.pypa.io/pip/3.7/${filename} $filename
}
Invoke-CommandExitOnError ".\python.exe $filename --prefix=$path --no-warn-script-location"
Invoke-CommandExitOnError ".\python.exe $filename --prefix=`"$path`" --no-warn-script-location"
if ($FORCE_DOWNLOAD -eq 1) {
Remove-Item $filename
}
Expand Down Expand Up @@ -164,7 +165,7 @@ if (!(Test-Path $PYTHON_CONFIG_FILE)) {

$pythonPath = Get-Python $version $majorMinor
$execPath = Join-Path $pythonPath python.exe
$pipPath = Join-Path $pythonPath Scripts | Join-Path -ChildPath pip.exe
$pipPath = Join-Path $pythonPath Scripts | Join-Path -ChildPath pip3.exe

# Update the python config file.
$data = Get-Content -Raw -Path $PYTHON_CONFIG_FILE | ConvertFrom-Json
Expand Down
12 changes: 8 additions & 4 deletions deploy/runtime/python/install_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if [ -z $FORCE_DOWNLOAD ]; then
FORCE_DOWNLOAD=1
fi

if [ -z $3 ]; then
if [ -z "$3" ]; then
show_help
exit 1
fi
Expand All @@ -102,29 +102,33 @@ fi
PYTHON_MAJOR_MINOR="${VER_ARRAY[0]}${VER_ARRAY[1]}"
INSTALL_BASE=$3

if [ ! -d $INSTALL_BASE ]; then
if [ ! -d "$INSTALL_BASE" ]; then
error "path $INSTALL_BASE does not exist"
exit 1
fi

cd $INSTALL_BASE
cd "$INSTALL_BASE"
CONFIG_FILE=python_config.json

if [ ! -f $CONFIG_FILE ]; then
error "config file $CONFIG_FILE does not exist"
exit 1
fi

arch=$(uname -m)

if [[ "$OSTYPE" == "linux-gnu" ]]; then
PLATFORM=Linux-x86_64
elif [[ "$OSTYPE" == "darwin"* ]]; then
PLATFORM=MacOSX-x86_64
PLATFORM=MacOSX-$arch
else
error "unknown OS type $OSTYPE"
exit 1
fi




CONDA_PACKAGE_NAME=Miniconda3-py${PYTHON_MAJOR_MINOR}_${CONDA_VERSION}-${PLATFORM}.sh
CONDA_URL=https://repo.anaconda.com/miniconda/$CONDA_PACKAGE_NAME
CONDA_PACKAGE_PATH=/tmp/$CONDA_PACKAGE_NAME
Expand Down
3 changes: 2 additions & 1 deletion src/pythonhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ bool CheckPythonInstalled(const PythonConfig& config){
}

bool InstallPythonWindows(const std::string& path, const PythonConfig& config){
std::string cmd = "powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File " + path + "/install_python.ps1 -version " + config.pythonVersion + " -config " + path;
// std::string cmd = "powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File " + path + "/install_python.ps1 -version " + config.pythonVersion + " -config " + path;
std::string cmd = "powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File \"" + path + "/install_python.ps1\" -version " + config.pythonVersion + " -config \"" + path + "\"";
int rvalue = system(cmd.c_str());
return (bool)rvalue;
}
Expand Down

0 comments on commit da65a33

Please sign in to comment.