Anaconda

From psadt | Evergreen Application Management
Jump to navigation Jump to search

About

Anaconda.png

Anaconda is a free and open-source distribution of the Python and R programming languages for scientific computing, that aims to simplify package management and deployment.

Version: 2020.02 (with Python 3.7.6)

Assumptions

This document assumes you are familiar with the use of a Windows Administrator Command Prompt. It also assumes your copy of the PSADT is preconfigured to write logs to C:\ProgramData\Logs.

Obtain Package Source

Download the installer from the vendor website.

Vendor Configuration for Silent Install

Information on silent installtions can be found in the vendor documentation.

Bear in mind with a silent install the installation directory must be specified, and must be the last argument.

Please also be aware that for a Windows 10 installation, logged in users are given full permissions to the Anaconda3 install directory, and the install directory has been added to the system path. You will see many forum posts from people saying their Anaconda installation was incomplete or that the icons didn't display properly, which is resolved either by addressing the permissions as I've just described, or performing a user-based install. You may also encounter other issues from Group Policy and/or if your organisation uses AppLocker.


Anaconda11.png

Deploy Info

Anaconda3 2020.02 (Python 3.7.6 64-bit)
Anaconda, Inc.
C:\ProgramData\Anaconda3\pythonw.exe
C:\ProgramData\Anaconda3\Uninstall-Anaconda3.exe /S

Hive: HKEY_LOCAL_MACHINE
Key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Anaconda3 2020.02 (Python 3.7.6 64-bit)
Value: DisplayVersion
DataType: Version
Data: 2020.02
Operator: Greater than or equal to
32-bit: No
SCCM Requirement: None

Deploy-Application.ps1

Please note the script contains Pre-installation logic to detect and uninstall any legacy version it encounters and logs the version number. It achieves this by searching the registry for the associated application as a keyword, then methodically running any version, ascertaining it’s Uninstall string, and calling it with the provided silent switches. If the application and version we want is already installed, the install will not proceed.

Relevant extracts from the script are as follows:

##*===============================================
##* VARIABLE DECLARATION
##*===============================================
## Variables: Application
[string]$appVendor = 'Anaconda'
[string]$appName = 'Anaconda3'
[string]$appVersion = '2020.02'
[string]$appArch = 'x64'
[string]$appLang = 'EN'
[string]$appRevision = '01'
[string]$appScriptVersion = '1.0.0'
[string]$appScriptDate = '30/07/2020'
[string]$appScriptAuthor = 'psadt.com'
[string]$appPath = "$env:ProgramData\Apps\Anaconda3"
[string]$appRegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Anaconda3 2020.02 (Python 3.7.6 64-bit)"
[string]$envRegPath = "HKLM:\System\CurrentControlSet\Control\Session Manager\Environment"
##*===============================================




##*===============================================
##* PRE-INSTALLATION
##*===============================================

## <Perform Pre-Installation tasks here>

# Remove previous versions if exist
ForEach ($regKey in $regKeyApplications)
	{
	$appVer = Get-ChildItem -Path $regKey |
		Get-ItemProperty |
			Where-Object {$_.DisplayName -like "*Anaconda3*" } |
				Select-Object -Property DisplayName, DisplayVersion, UninstallString
	ForEach ($ver in $appVer)
		{
		If ($ver.UninstallString)
			{
			$appExist = 1
			$OldVersion = $ver.DisplayVersion
			$Uninst = $ver.UninstallString
			$Parms = "/S"

			# Uninstall
			Write-Log -Message "Uninstalling $appName $OldVersion" -LogType 'CMTrace'
			Write-Log -Message "Executing $Uninst $Parms" -LogType 'CMTrace'
			Start-Process $Uninst -ArgumentList $Parms -Wait -PassThru -NoNewWindow -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Out-Null
			}
		}
	}
	
If ($appExist -ne 1)
	{Write-Log -Message "No $appName installations detected." -LogType 'CMTrace'}




##*===============================================
##* INSTALLATION 
##*===============================================

## <Perform Installation tasks here>

Execute-Process -Path 'Anaconda3-2020.02-Windows-x86_64.exe' -Parameters "/S /InstallationType=AllUsers /AddToPath=1 /D=$env:ProgramData\Apps\Anaconda3" -WindowStyle Hidden

# Set user permissions
# Add rights for users to mitigate known issues
If (Test-Path $appPath)
	{
	# Remove inheritance
	$acl = Get-Acl $appPath
	$acl.SetAccessRuleProtection($true,$true)
	Set-Acl $appPath $acl

	# Add Modify access for Users
	$acl = Get-Acl $appPath
	$rule = New-Object System.Security.AccessControl.FileSystemAccessRule("Authenticated Users","FullControl","ContainerInherit,ObjectInherit","None","Allow")
	$acl.SetAccessRule($rule)
	Set-Acl $appPath $acl
	}




##*===============================================
##* UNINSTALLATION
##*===============================================



# Remove any version if exist
ForEach ($regKey in $regKeyApplications)
	{
	$appVer = Get-ChildItem -Path $regKey |
		Get-ItemProperty |
			Where-Object {$_.DisplayName -like "*Anaconda3*" } |
				Select-Object -Property DisplayName, DisplayVersion, UninstallString
	ForEach ($ver in $appVer)
		{
		If ($ver.UninstallString)
			{
			$appExist = 1
			$OldVersion = $ver.DisplayVersion
			$Uninst = $ver.UninstallString
			$Parms = "/S"

			# Uninstall
			Write-Log -Message "Uninstalling $appName $OldVersion" -LogType 'CMTrace'
			Write-Log -Message "Executing $Uninst $Parms" -LogType 'CMTrace'
			Start-Process $Uninst -ArgumentList $Parms -Wait -PassThru -NoNewWindow -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Out-Null
			}
		}
	}
	
If ($appExist -ne 1)
	{
	Write-Log -Message "No $appName installations detected." -LogType 'CMTrace'
	Exit-Script -ExitCode 1605
	}

Manual installation

Anaconda01.png

Click Next


Anaconda02.png

Click I Agree


Anaconda03.png

Ensure All Users is selected and click Next


Anaconda04.png

Set your preferred install directory or leave as default, and click Next


Anaconda05.png

Click Install


Anaconda06.png

Monitor the install and allow it to finish


Anaconda07.png

Monitor the install and allow it to finish


Anaconda08.png

Click Next


Anaconda09.png

Click Next


Anaconda10.png

Click Finish