if the target environment doesn't exist, it will be created with conda env create, for an existing environment it will now be updated through conda env update

adddressed CR comments, merged master
This commit is contained in:
Wolfgang Manousek 2016-11-14 17:21:37 +01:00
Родитель c7c9ee6368
Коммит a3e264884d
6 изменённых файлов: 39 добавлений и 22 удалений

Просмотреть файл

@ -114,10 +114,12 @@ PY_ACTIVATE="$HOME/anaconda3/bin/activate"
CNTK_PY34_ENV_PREFIX="$ANACONDA_PREFIX/envs/cntk-py34"
if [ -d "$CNTK_PY34_ENV_PREFIX" ]; then
printf "Path '%s' already exists, skipping CNTK Python 3.4 environment setup\n" "$CNTK_PY34_ENV_PREFIX"
"$CONDA" env update --file "$CNTK_PY34_ENV_FILE" --name "$CNTK_PY34_ENV_PREFIX" || {
echo Updating Anaconda environment failed.
exit 1
}
else
# (--force shouldn't be needed)
"$CONDA" env create --quiet --force --file "$CNTK_PY34_ENV_FILE" --prefix "$CNTK_PY34_ENV_PREFIX" || {
"$CONDA" env create --file "$CNTK_PY34_ENV_FILE" --prefix "$CNTK_PY34_ENV_PREFIX" || {
echo Creating Anaconda environment failed.
rm -rf "$CNTK_PY34_ENV_PREFIX"
exit 1

Просмотреть файл

@ -79,6 +79,29 @@ function InstallExe(
}
}
function InstallYml(
[Parameter(Mandatory = $true)][hashtable] $table)
{
FunctionIntro $table
$func = $table["Function"]
$basePath = $table["BasePath"]
$env= $table["Env"]
$ymlFile = $table["ymlFile"]
$envsDir = join-path $basePath "envs"
$targetDir = join-path $envsDir $env
if (test-path -path $targetDir -PathType Container) {
$newTable = @{ Function = "InstallExe"; Command = "$basepath\Scripts\conda.exe"; Param = "env update --file $ymlFile --name $targetDir"; WorkDir = "$basePath\Scripts"; runAs=$false }
}
else {
$newTable = @{ Function = "InstallExe"; Command = "$basepath\Scripts\conda.exe"; Param = "env create --file $ymlFile --prefix $targetDir"; WorkDir = "$basePath\Scripts"; runAs=$false }
}
InstallExe $newTable
}
function ExecuteApplication(
[Parameter(Mandatory = $true)][hashtable] $table)
{

Просмотреть файл

@ -35,8 +35,8 @@ Repeated operation of this script will reuse already downloaded components.
- If required VS2012 Runtime and VS2013 Runtime will be installed
- If required MSMPI will be installed
- Anaconda3 will be installed into [$AnacondaBasePath]
- A CNTK-PY34 environment will be created in [$AnacondaBasePath\envs]
- CNTK will be installed into the CNTK-PY34 environment
- A CNTK-PY34 environment will be created or updated in [$AnacondaBasePath\envs]
- CNTK will be installed or updated in the CNTK-PY34 environment
"
}

Просмотреть файл

@ -30,11 +30,11 @@ $operations = @(
Action = @( @{Function = "InstallExe"; Command = "$localCache\Anaconda3-4.1.1-Windows-x86_64.exe"; Param = "/InstallationType=JustMe /AddToPath=0 /RegisterPython=0 /S /D=$AnacondaBasePath"; runAs=$false; Message="Installing Anaconda3-4.1.1. This will take several minutes. Please be patient ...."} );
},
@{Name = "CNTK Python Environment 3.4"; ShortName = "CNTKPY34"; Info = "Setup CNTK PythonEnvironment 3.4";
Verification = @( @{Function = "VerifyDirectory"; Path = "$AnacondaBasePath\envs\cntk-py34"; } );
Action = @( @{Function = "InstallExe"; Command = "$AnacondaBasePath\Scripts\conda.exe"; Param = "env create --file $MyDir\conda-windows-cntk-py34-environment.yml --prefix $AnacondaBasePath\envs\cntk-py34"; WorkDir = "$AnacondaBasePath\Scripts"; runAs=$false; Message="Setting up CNTK-PY34 environment. Please be patient...." } )
Verification = @( @{Function = "VerifyRunAlways" } );
Action = @( @{Function = "InstallYml"; BasePath = $AnacondaBasePath; Env = "cntk-py34"; ymlFile= "$MyDir\conda-windows-cntk-py34-environment.yml" } )
},
@{Name = "CNTK WHL Install"; ShortName = "CNTKWHL34"; Info = "Setup/Update CNTK Wheel";
Verification = @( @{Function = "VerifyWheelDirectory"; WheelDirectory = "$AnacondaBasePath\envs\cntk-py34\Lib\site-packages\cntk" } );
Verification = @( @{Function = "VerifyRunAlways" } );
Action = @( @{Function = "InstallWheel"; BasePath = "$AnacondaBasePath"; EnvName = "cntk-py34"; WheelDirectory="$AnacondaBasePath\envs\cntk-py34\Lib\site-packages\cntk"; Message="Setup/Update of CNTK Wheel environment. Please be patient...." } )
},
@{Name = "Create CNTKPY34 batch file"; ShortName = "BATCH34"; Info = "Create CNTKPY34 batch file";

Просмотреть файл

@ -154,18 +154,14 @@ function VerifyDirectory(
return $noInstallRequired
}
function VerifyWheelDirectory(
[Parameter(Mandatory = $true)][hashtable] $table)
function VerifyRunAlways(
[Parameter(Mandatory = $true)][hashtable] $table)
{
FunctionIntro $table
$func = $table["Function"]
$path = $table["WheelDirectory"]
$forceUpdate = $table["ForceUpdate"]
$noInstallRequired = $false
Write-Verbose "[$func]: [$path] returned [$noInstallRequired]"
Write-Verbose "[$func]: returned [$noInstallRequired]"
return $noInstallRequired
}

Просмотреть файл

@ -5,7 +5,7 @@
<#
.SYNOPSIS
Use this cmdlet to install CNTK
Use this cmdlet to install CNTK from a precompiled binary drop (see https://github.com/Microsoft/CNTK/releases)
.DESCRIPTION
The script will download and install the CNTK prerequisites and Anaconda environment
@ -17,8 +17,8 @@
- If required VS2012 Runtime and VS2013 Runtime will be installed
- If required MSMPI will be installed
- Anaconda3 will be installed into [<AnacondaBasePath>]
- A CNTK-PY34 environment will be created in [<AnacondaBasePath>\envs]
- CNTK will be installed into the CNTK-PY34 environment
- A CNTK-PY34 environment will be created or updated in [<AnacondaBasePath>\envs]
- CNTK will be installed or updated in the CNTK-PY34 environment
.PARAMETER Execute
This is an optional parameter. Without setting this switch, no changes to the machine setup/installation will be performed
@ -35,10 +35,6 @@
.\install.ps1 -Execute
Run the installer and perform the installation operations
.EXAMPLE
.\install.ps1 -Execute -ForceWheelUpdate
Run the installer and install CNTK on the machine. Force a CNTK whl Update in the CNTK-Anaconda install
.EXAMPLE
.\install.ps1 -Execute -AnacondaBasePath d:\cntkBeta