File size: 2,279 Bytes
19faf57 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | <#
PowerShell script to provision Miniconda environment on Windows (native).
Run in an elevated or normal PowerShell after downloading Miniconda installer.
#>
param(
[string]$EnvName = 'axioenv'
)
Write-Host "Creating conda environment '$EnvName' from environment.yml (conda-forge)..."
# Ensure conda is on PATH (assumes Miniconda installed for current user)
if (-not (Get-Command conda -ErrorAction SilentlyContinue)) {
Write-Host "Conda not found on PATH. Please install Miniconda and re-run this script."
exit 1
}
conda config --env --add channels conda-forge || true
conda config --env --set channel_priority strict || true
try {
conda env create -f "$PSScriptRoot/../environment.yml" -n $EnvName -y
} catch {
Write-Host "Environment exists or create failed — attempting update"
conda env update -f "$PSScriptRoot/../environment.yml" -n $EnvName -y
}
Write-Host "Activating environment and installing pip requirements..."
& conda activate $EnvName
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r "$PSScriptRoot/../requirements-merged.txt"
Write-Host "Done. To activate: conda activate $EnvName"
<#
PowerShell script to create `axioenv` using Miniconda on Windows.
Run in PowerShell after installing Miniconda.
#>
Param()
Set-StrictMode -Version Latest
$RootDir = Split-Path -Parent $MyInvocation.MyCommand.Path
Write-Host "Project root: $RootDir"
if (-not (Get-Command conda -ErrorAction SilentlyContinue)) {
Write-Host "Conda not found. Please install Miniconda from https://repo.anaconda.com/miniconda/ and re-run this script." -ForegroundColor Yellow
exit 1
}
# Ensure conda-forge channel priority and create env
conda config --env --add channels conda-forge
conda config --env --set channel_priority strict
conda env remove -n axioenv -y 2>$null | Out-Null
conda env create -f "$RootDir\environment.yml"
Write-Host "Environment 'axioenv' created. Activate with: conda activate axioenv"
# Install pip requirements from merged file inside the environment
Write-Host "Installing pip requirements from requirements-merged.txt (inside the environment)..."
conda run -n axioenv pip install -r "$RootDir\requirements-merged.txt"
Write-Host "Done."
|