Skip to content

Instantly share code, notes, and snippets.

@ghostbust555
Last active March 28, 2018 19:38
Show Gist options
  • Save ghostbust555/327cd9cdfdce38b70f9aa6b60d8d0f55 to your computer and use it in GitHub Desktop.
Save ghostbust555/327cd9cdfdce38b70f9aa6b60d8d0f55 to your computer and use it in GitHub Desktop.
Pull down and create python environment
$outputDir = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$PSScriptRoot/../python")
$zipOutput = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$PSScriptRoot/../Framework/Neural.DocumentRecognition/pythonEnvironment.zip")
if(-not (test-path $outputDir) -or -not (test-path $zipOutput)){
if(-not (test-path "$PSScriptRoot/minicondaInstaller.exe")){
Invoke-WebRequest -Uri "https://repo.continuum.io/miniconda/Miniconda3-4.4.10-Windows-x86_64.exe" -OutFile "$PSScriptRoot/minicondaInstaller.exe"
}
& "$PSScriptRoot/minicondaInstaller.exe" /InstallationType=JustMe /RegisterPython=0 /NoRegistry=1 /S /D="$outputDir" | Out-Null
$old_ErrorActionPreference = $ErrorActionPreference
$ErrorActionPreference = 'SilentlyContinue'
& "$outputDir\Scripts\conda.exe" env create -f environment.yml
$ErrorActionPreference = $old_ErrorActionPreference
#Remove-Item "$outputDir/envs/tf/Library/bin/mkl_*.dll" -Force
Compress-Archive -Path "$outputDir/envs/tf/*" -CompressionLevel Optimal -DestinationPath $zipOutput -Force
}
#if((Get-FileHash $zipOutput -Algorithm SHA256).Hash -ne "9BA10189336DF33D30CC767563DF161A0B6B326352B883B7A1A6864B4DF8F5C5"){
# throw "Python environment does not match hash. This may be fine (if a package was modified without changing a verison) but may be scary."
#}
<# Environment.yml
name: tf
channels:
- defaults
dependencies:
- h5py=2.7.0=np112py35_0
- hdf5=1.8.15.1=vc14_4
- libpython=2.0=py35_0
- mkl=2017.0.1=0
- numpy=1.12.1=py35_0
- pandas=0.19.2=np112py35_1
- pip=9.0.1=py35_1
- python=3.5.3=0
- python-dateutil=2.6.0=py35_0
- pytz=2016.10=py35_0
- scikit-learn=0.19.0=np112py35_0
- scipy=0.19.0=np112py35_0
- setuptools=27.2.0=py35_1
- six=1.10.0=py35_0
- vc=14=0
- vs2015_runtime=14.0.25123=0
- wheel=0.29.0=py35_0
- zlib=1.2.8=vc14_3
- pip:
- altgraph==0.15
- appdirs==1.4.3
- bleach==1.5.0
- cycler==0.10.0
- enum34==1.1.6
- future==0.16.0
- html5lib==0.9999999
- keras==2.1.3
- macholib==1.9
- markdown==2.6.11
- matplotlib==2.1.2
- olefile==0.44
- packaging==16.8
- pefile==2017.11.5
- pillow==4.0.0
- protobuf==3.5.1
- pyparsing==2.2.0
- pypiwin32==223
- pywin32==223
- pyyaml==3.12
- pyzmq==17.0.0
- seaborn==0.8.1
- tensorflow==1.4.0
- tensorflow-tensorboard==0.4.0
- werkzeug==0.14.1
prefix: C:\Users\kyle.flanigan\Anaconda3\envs\tf
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment