added ability to create 27 34 and 35 python environments

support for the new vs15 drops of cntk
This commit is contained in:
Wolfgang Manousek 2017-01-12 17:30:48 +01:00
Родитель bed7c19cfb
Коммит af99f9006d
5 изменённых файлов: 36 добавлений и 36 удалений

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

@ -89,14 +89,14 @@ function InstallYml(
$env= $table["Env"]
$ymlFile = $table["ymlFile"]
$envsDir = join-path $basePath "envs"
$targetDir = join-path $envsDir $env
$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 }
$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 }
$newTable = @{ Function = "InstallExe"; Command = "$basepath\Scripts\conda.exe"; Param = "env create --file `"$ymlFile`" --prefix `"$targetDir`""; WorkDir = "$basePath\Scripts"; runAs=$false }
}
InstallExe $newTable
@ -149,6 +149,7 @@ function InstallWheel(
$EnvName = $table["EnvName"]
$message = $table["message"]
$whlDirectory = $table["WheelDirectory"]
$pyVersion = $table["PyVersion"]
Write-Host $message
if (-not $Execute) {
@ -156,8 +157,8 @@ function InstallWheel(
return
}
$whlFile = Get-ChildItem $cntkRootDir\cntk\Python\cntk*.whl
if ($whlFile -eq $null) {
$whlFile = Get-ChildItem $cntkRootDir\cntk\Python\cntk*cp$pyVersion-cp$pyVersion*.whl
if (-not $whlFile) {
throw "No WHL file found at $cntkRootDir\cntk\Python"
}
if ($whlFile.Count -gt 1) {
@ -260,6 +261,7 @@ function CreateBatch(
$func = $table["Function"]
$filename = $table["Filename"]
$pyVersion = $table["PyVersion"]
if (-not $Execute) {
Write-Host "Create-Batch [$filename]:No-Execute flag. No file created"
@ -277,7 +279,7 @@ if /I "%CMDCMDLINE%" neq ""%COMSPEC%" " (
exit /b 0
)
set PATH=$cntkRootDir\cntk;%PATH%
"$AnacondaBasePath\Scripts\activate" "$AnacondaBasePath\envs\cntk-py34"
"$AnacondaBasePath\Scripts\activate" "$AnacondaBasePath\envs\cntk-py$pyVersion"
"@
add-content -Path $filename -Encoding Ascii -Value $batchScript

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

@ -32,11 +32,11 @@ The script will analyse your machine and will determine which components are req
The required components will be downloaded in [$localCache]
Repeated operation of this script will reuse already downloaded components.
- If required VS2012 Runtime and VS2013 Runtime will be installed
- If required VS2015 Runtime will be installed
- If required MSMPI will be installed
- Anaconda3 will be installed into [$AnacondaBasePath]
- A CNTK-PY34 environment will be created or updated in [$AnacondaBasePath\envs]
- CNTK will be installed or updated in the CNTK-PY34 environment
- A CNTK-PY$PyVersion environment will be created or updated in [$AnacondaBasePath\envs]
- CNTK will be installed or updated in the CNTK-PY$PyVersion environment
"
}
@ -108,7 +108,7 @@ function DisplayStart()
CheckOSVersion
if (-not $Execute) {
Write-Host $(DisplayWarningNoExecuteMessage)
Write-Warning $(DisplayWarningNoExecuteMessage)
}
Write-Host $(DisplayStartContinueMessage)
@ -131,7 +131,7 @@ Write-Host "
CNTK v2 Python install complete.
To activate the CNTK Python environment and set the PATH to include CNTK, start a command shell and run
$cntkRootDir\scripts\cntkpy34.bat
$cntkRootDir\scripts\cntkpy$PyVersion.bat
Please checkout tutorials and examples here:
$cntkRootDir\Tutorials

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

@ -10,15 +10,10 @@ $operations = @(
@{Name = "Verifying Installation contents"; ShortName = "INSTCONTENT"; Info = "Verifying Installation contents";
Verification = @( @{Function = "VerifyInstallationContent"; Path = "$cntkRootDir" } )
},
@{Name = "Installation VS2012 Runtime"; ShortName = "VS2012"; Info = "Install VS2012 Runtime";
Verification = @( @{Function = "VerifyWin32ProductExists"; Match = "^Microsoft Visual C\+\+ 2012 x64 Additional Runtime" },
@{Function = "VerifyWin32ProductExists"; Match = "^Microsoft Visual C\+\+ 2012 x64 Minimum Runtime" } );
Action = @( @{Function = "InstallExe"; Command = "$cntkRootDir\prerequisites\VS2012\vcredist_x64.exe"; Param = "/install /passive /norestart"; Message="Installing VS2012 Runtime...." } )
},
@{Name = "Installation VS2013 Runtime"; ShortName = "VS2013"; Info = "Install VS2013 Runtime";
Verification = @( @{Function = "VerifyWin32ProductExists"; Match = "^Microsoft Visual C\+\+ 2013 x64 Additional Runtime" },
@{Function = "VerifyWin32ProductExists"; Match = "^Microsoft Visual C\+\+ 2013 x64 Minimum Runtime" } );
Action = @( @{Function = "InstallExe"; Command = "$cntkRootDir\prerequisites\VS2013\vcredist_x64.EXE"; Param = "/install /passive /norestart"; Message="Installing VS2013 Runtime...." } )
@{Name = "Installation VS2015 Runtime"; ShortName = "VS2015"; Info = "Install VS2015 Runtime";
Verification = @( @{Function = "VerifyWin32ProductExists"; Match = "^Microsoft Visual C\+\+ 2015 x64 Additional Runtime" },
@{Function = "VerifyWin32ProductExists"; Match = "^Microsoft Visual C\+\+ 2015 x64 Minimum Runtime" } );
Action = @( @{Function = "InstallExe"; Command = "$cntkRootDir\prerequisites\VS2015\vc_redist.x64.exe"; Param = "/install /passive /norestart"; Message="Installing VS2015 Runtime...." } )
},
@{Name = "MSMPI Installation"; ShortName = "CNTK"; Info = "Install MSMPI";
Verification = @( @{Function = "VerifyWin32ProductVersion"; Match = "^Microsoft MPI \(\d+\."; Version = "7.0.12437.6" } );
@ -29,16 +24,16 @@ $operations = @(
Download = @( @{Function = "Download"; Source = "https://repo.continuum.io/archive/Anaconda3-4.1.1-Windows-x86_64.exe"; Destination = "$localCache\Anaconda3-4.1.1-Windows-x86_64.exe" } );
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";
@{Name = "CNTK Python Environment"; ShortName = "CNTKPY"; Info = "Setup CNTK PythonEnvironment $PyVersion";
Verification = @( @{Function = "VerifyRunAlways" } );
Action = @( @{Function = "InstallYml"; BasePath = $AnacondaBasePath; Env = "cntk-py34"; ymlFile= "$MyDir\conda-windows-cntk-py34-environment.yml" } )
Action = @( @{Function = "InstallYml"; BasePath = $AnacondaBasePath; Env = "cntk-py$PyVersion"; ymlFile= "$MyDir\conda-windows-cntk-py$PyVersion-environment.yml"; PyVersion = $PyVersion } )
},
@{Name = "CNTK WHL Install"; ShortName = "CNTKWHL34"; Info = "Setup/Update CNTK Wheel";
@{Name = "CNTK WHL Install"; ShortName = "CNTKWHL"; Info = "Setup/Update CNTK Wheel $PyVersion";
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...." } )
Action = @( @{Function = "InstallWheel"; BasePath = "$AnacondaBasePath"; EnvName = "cntk-py$PyVersion"; WheelDirectory="$AnacondaBasePath\envs\cntk-py$PyVersion\Lib\site-packages\cntk"; PyVersion = $PyVersion; Message="Setup/Update of CNTK Wheel $PyVersion environment. Please be patient...." } )
},
@{Name = "Create CNTKPY34 batch file"; ShortName = "BATCH34"; Info = "Create CNTKPY34 batch file";
Verification = @( @{Function = "VerifyFile"; Path = "$cntkRootDir\scripts\cntkpy34.bat" } );
Action = @( @{Function = "CreateBatch"; Filename = "$cntkRootDir\scripts\cntkpy34.bat" } )
@{Name = "Create CNTKPY batch file"; ShortName = "BATCH"; Info = "Create CNTKPY batch file";
Verification = @( @{Function = "VerifyFile"; Path = "$cntkRootDir\scripts\cntkpy$PyVersion.bat"; PyVersion = $PyVersion } );
Action = @( @{Function = "CreateBatch"; Filename = "$cntkRootDir\scripts\cntkpy$PyVersion.bat"; PyVersion = $PyVersion } )
}
)

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

@ -127,8 +127,7 @@ function VerifyInstallationContent(
$path = $table["Path"]
$noInstallRequired = (join-path $path cntk\cntk.exe | test-path -PathType Leaf)
$noInstallRequired = (join-path $path prerequisites\VS2012\vcredist_x64.exe | test-path -PathType Leaf) -and $noInstallRequired
$noInstallRequired = (join-path $path prerequisites\VS2013\vcredist_x64.exe | test-path -PathType Leaf) -and $noInstallRequired
$noInstallRequired = (join-path $path prerequisites\VS2015\vc_redist.x64.exe | test-path -PathType Leaf) -and $noInstallRequired
$noInstallRequired = (join-path $path prerequisites\MSMpiSetup.exe | test-path -PathType Leaf) -and $noInstallRequired
if ($noInstallRequired) {
@ -136,7 +135,7 @@ function VerifyInstallationContent(
return $noInstallRequired
}
throw "`nFatal Error: Files from CNTK binary download package are missing!`nThe install script must be run out of the unpacked binary CNTK package, not from a CNTK source clone."
throw "`nFatal Error: Files from the CNTK binary download package are missing!`nThe install script must be run out of the unpacked binary CNTK package, not from a CNTK source clone."
}
function VerifyDirectory(

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

@ -14,11 +14,11 @@
The required components will be downloaded and cached.
Repeated operation of this script will reuse already downloaded components.
- If required VS2012 Runtime and VS2013 Runtime will be installed
- If required VS2015 Runtime will be installed
- If required MSMPI will be installed
- Anaconda3 will be installed into [<AnacondaBasePath>]
- A CNTK-PY34 environment will be created or updated in [<AnacondaBasePath>\envs]
- CNTK will be installed or updated in the CNTK-PY34 environment
- A CNTK-PY<version> environment will be created or updated in [<AnacondaBasePath>\envs]
- CNTK will be installed or updated in the CNTK-PY<version> environment
.PARAMETER Execute
This is an optional parameter. Without setting this switch, no changes to the machine setup/installation will be performed
@ -27,6 +27,10 @@
This is an optional parameter and can be used to specify an already installed Anaconda3 installation.
By default a version of Anaconda3 will be installed into [C:\local\Anaconda3-4.1.1-Windows-x86_64]
.PARAMETER PyVersion
This is an optional parameter and can be used to specify the Python version to be used for the CNTK Python environment.
Allowed values for this parameter are 27 34 or 35. The default values is 34 (for a CNTK Python 34 environment)
.EXAMPLE
.\install.ps1
@ -46,8 +50,8 @@
[CmdletBinding()]
Param(
[parameter(Mandatory=$false)] [string] $AnacondaBasePath = "C:\local\Anaconda3-4.1.1-Windows-x86_64",
[parameter(Mandatory=$false)] [switch] $Execute
)
[parameter(Mandatory=$false)] [ValidateSet("27", "34", "35")] [string] $PyVersion = "34",
[parameter(Mandatory=$false)] [switch] $Execute)
$MyDir = Split-Path $MyInvocation.MyCommand.Definition