Last active
January 6, 2022 20:34
-
-
Save maphew/8b9ad8ba64c7121cd7502bfcef8ce025 to your computer and use it in GitHub Desktop.
Recipe for setting up environment for geospatial processing on Windows [DRAFT]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scoop uninstall scoop | |
$xlist = "$env:userprofile\scoop", "c:\apps\geo", "$env:userprofile\.condarc", "$env:userprofile\.conda", "$env:userprofile\.config\scoop" | |
foreach ($x in $xlist) { | |
if (Test-Path $x) { Remove-Item $x} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Setting up env-gis-dev on a new machine or user profile --- | |
---- Allowing powershell scripts... | |
---- Installing Scoop command line program installer... | |
Initializing... | |
Downloading scoop... | |
Extracting... | |
Creating shim... | |
Downloading main bucket... | |
Extracting... | |
'lastupdate' has been set to '2022-01-06T13:32:15.7555330-07:00' | |
Scoop was installed successfully! | |
Type 'scoop help' for instructions. | |
---- Configure scoop defaults | |
'cachePath' has been set to '\\envgeoserver\share\GIS-Software\scoop\cache' | |
'rootPath' has been set to 'c:\apps\geo' | |
---- Installing Miniconda3 and Scoop update dependencies... Get-ChildItem : Cannot find path 'C:\apps\geo\shims' because it does not exist. At C:\Users\mhwilkie\scoop\apps\scoop\current\lib\commands.ps1:3 char:12 + + (Get-ChildItem "$scoopdir\shims") ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
+ CategoryInfo : ObjectNotFound: (C:\apps\geo\shims:String) [Get-ChildItem], ItemNotFoundException | |
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand | |
Get-ChildItem : Cannot find path 'C:\apps\geo\shims' because it does not exist. | |
At C:\Users\mhwilkie\scoop\apps\scoop\current\lib\commands.ps1:3 char:12 | |
+ + (Get-ChildItem "$scoopdir\shims") ` | |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
+ CategoryInfo : ObjectNotFound: (C:\apps\geo\shims:String) [Get-ChildItem], ItemNotFoundException | |
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand | |
Get-ChildItem : Cannot find path 'C:\apps\geo\buckets' because it does not exist. | |
At C:\Users\mhwilkie\scoop\apps\scoop\current\lib\buckets.ps1:62 char:13 | |
+ return (Get-ChildItem -Directory $bucketsdir).Name | |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
+ CategoryInfo : ObjectNotFound: (C:\apps\geo\buckets:String) [Get-ChildItem], ItemNotFoundException | |
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand | |
Get-ChildItem : Cannot find path 'C:\apps\geo\buckets' because it does not exist. | |
At C:\Users\mhwilkie\scoop\apps\scoop\current\lib\buckets.ps1:62 char:13 | |
+ return (Get-ChildItem -Directory $bucketsdir).Name | |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
+ CategoryInfo : ObjectNotFound: (C:\apps\geo\buckets:String) [Get-ChildItem], ItemNotFoundException | |
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand | |
Couldn't find manifest for 'git'. | |
Get-ChildItem : Cannot find path 'C:\apps\geo\shims' because it does not exist. | |
At C:\Users\mhwilkie\scoop\apps\scoop\current\lib\commands.ps1:3 char:12 + + (Get-ChildItem "$scoopdir\shims") ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\apps\geo\shims:String) [Get-ChildItem], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand | |
Git is required for buckets. Run 'scoop install git' and try again. | |
Get-ChildItem : Cannot find path 'C:\apps\geo\shims' because it does not exist. | |
At C:\Users\mhwilkie\scoop\apps\scoop\current\lib\commands.ps1:3 char:12 + + (Get-ChildItem "$scoopdir\shims") ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\apps\geo\shims:String) [Get-ChildItem], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand | |
Get-ChildItem : Cannot find path 'C:\apps\geo\shims' because it does not exist. | |
At C:\Users\mhwilkie\scoop\apps\scoop\current\lib\commands.ps1:3 char:12 | |
+ + (Get-ChildItem "$scoopdir\shims") ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\apps\geo\shims:String) [Get-ChildItem], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand | |
Get-ChildItem : Cannot find path 'C:\apps\geo\buckets' because it does not exist. | |
At C:\Users\mhwilkie\scoop\apps\scoop\current\lib\buckets.ps1:62 char:13 | |
+ return (Get-ChildItem -Directory $bucketsdir).Name | |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\apps\geo\buckets:String) [Get-ChildItem], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand Get-ChildItem : Cannot find path 'C:\apps\geo\buckets' because it does not exist. | |
At C:\Users\mhwilkie\scoop\apps\scoop\current\lib\buckets.ps1:62 char:13 | |
+ return (Get-ChildItem -Directory $bucketsdir).Name | |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
+ CategoryInfo : ObjectNotFound: (C:\apps\geo\buckets:String) [Get-ChildItem], ItemNotFoundException | |
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand | |
Couldn't find manifest for 'miniconda3'. | |
---- Configuring conda | |
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a | |
path was included, verify that the path is correct and try again. | |
At \\envgeoserver\share\GIS-Software\ENV-GIS-COE\env-gis-dev\init-new-machine.ps1:28 char:1 | |
+ conda init powershell + ~~~~~ + CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException | |
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a | |
path was included, verify that the path is correct and try again. | |
At \\envgeoserver\share\GIS-Software\ENV-GIS-COE\env-gis-dev\init-new-machine.ps1:29 char:1 | |
+ conda config --add channels conda-forge | |
+ ~~~~~ + CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a | |
path was included, verify that the path is correct and try again. | |
At \\envgeoserver\share\GIS-Software\ENV-GIS-COE\env-gis-dev\init-new-machine.ps1:30 char:1 | |
+ conda config --set channel_priority strict | |
+ ~~~~~ + CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a | |
path was included, verify that the path is correct and try again. | |
At \\envgeoserver\share\GIS-Software\ENV-GIS-COE\env-gis-dev\init-new-machine.ps1:31 char:1 | |
+ conda config --add pkgs_dirs \\envgeoserver\share\GIS-Software\conda\ ... | |
+ ~~~~~ | |
+ CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException Get-Item : Cannot find path 'C:\apps\geo\apps\miniconda3\current\envs\geo' because it does not exist. At \\envgeoserver\share\GIS-Software\ENV-GIS-COE\env-gis-dev\init-new-machine.ps1:34 char:11 | |
+ if (-Not (Get-Item "$rootPath\apps\miniconda3\current\envs\geo")) { | |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
+ CategoryInfo : ObjectNotFound: (C:\apps\geo\app...urrent\envs\geo:String) [Get-Item], ItemNotFoundException | |
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand ---- Creating Conda 'geo' environment conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. | |
At \\envgeoserver\share\GIS-Software\ENV-GIS-COE\env-gis-dev\init-new-machine.ps1:36 char:5 | |
+ conda create -y -n geo | |
+ ~~~~~ | |
+ CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException | |
+ FullyQualifiedErrorId : CommandNotFoundException | |
----- Installing conda packages | |
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a | |
path was included, verify that the path is correct and try again. | |
At \\envgeoserver\share\GIS-Software\ENV-GIS-COE\env-gis-dev\init-new-machine.ps1:40 char:1 | |
+ conda activate geo | |
+ ~~~~~ | |
+ CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException | |
+ FullyQualifiedErrorId : CommandNotFoundException | |
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a | |
path was included, verify that the path is correct and try again. | |
At \\envgeoserver\share\GIS-Software\ENV-GIS-COE\env-gis-dev\init-new-machine.ps1:42 char:1 | |
+ conda install -y rasterio | |
+ ~~~~~ | |
+ CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException | |
+ FullyQualifiedErrorId : CommandNotFoundException | |
---- Starting tests | |
python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a | |
path was included, verify that the path is correct and try again. | |
At \\envgeoserver\share\GIS-Software\ENV-GIS-COE\env-gis-dev\init-new-machine.ps1:45 char:1 | |
+ python --version | |
+ ~~~~~~ | |
+ CategoryInfo : ObjectNotFound: (python:String) [], CommandNotFoundException | |
+ FullyQualifiedErrorId : CommandNotFoundException | |
rio : The term 'rio' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path | |
was included, verify that the path is correct and try again. | |
At \\envgeoserver\share\GIS-Software\ENV-GIS-COE\env-gis-dev\init-new-machine.ps1:47 char:1 | |
+ rio --version | |
+ ~~~ | |
+ CategoryInfo : ObjectNotFound: (rio:String) [], CommandNotFoundException | |
+ FullyQualifiedErrorId : CommandNotFoundException | |
--- Finished --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write-Output "--- Setting up env-gis-dev on a new machine or user profile ---" | |
Write-Output "---- Allowing powershell scripts..." | |
Set-ExecutionPolicy RemoteSigned -scope CurrentUser | |
if (-Not (Get-Command scoop -ErrorAction SilentlyContinue)) { | |
echo "---- Installing Scoop command line program installer..." | |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') | |
} | |
Write-Output "---- Configure scoop defaults" | |
scoop config cachePath \\envgeoserver\share\GIS-Software\scoop\cache | |
$rootPath = "c:\apps\geo" | |
# $dirs = "shims" | |
# foreach ($d in $dirs) { | |
# if (-Not (Get-Item $rootPath\$d -ErrorAction SilentlyContinue)) { | |
# New-Item $rootPath\$d -ItemType Directory | |
# }} | |
scoop config rootPath $rootPath | |
Write-Output "---- Installing Miniconda3 and Scoop update dependencies..." | |
scoop install git | |
scoop bucket add extras | |
scoop install miniconda3 | |
Write-Output "---- Configuring conda" | |
conda init powershell | |
conda config --add channels conda-forge | |
conda config --set channel_priority strict | |
conda config --add pkgs_dirs \\envgeoserver\share\GIS-Software\conda\pkgs | |
# to-do: would be better to ask conda where the envs are | |
if (-Not (Get-Item "$rootPath\apps\miniconda3\current\envs\geo")) { | |
Write-Output "---- Creating Conda 'geo' environment" | |
conda create -y -n geo | |
} | |
Write-Output "----- Installing conda packages" | |
conda activate geo | |
# conda install -y gdal | |
conda install -y rasterio | |
Write-Output "---- Starting tests" | |
python --version | |
# gdalinfo --version | |
rio --version | |
Write-Output "--- Finished ---" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment