Skip to content

Instantly share code, notes, and snippets.

@CypherpunkSamurai
Last active February 16, 2025 23:04
Show Gist options
  • Save CypherpunkSamurai/73919282a513f63b7c2c4c2d6916c829 to your computer and use it in GitHub Desktop.
Save CypherpunkSamurai/73919282a513f63b7c2c4c2d6916c829 to your computer and use it in GitHub Desktop.
Miniconda Portable Installer for Windows
# Miniconda Portable Installer
# Author: Rakesh Chowdhury @ CypherpunkSamurai
# https://gist.github.com/CypherpunkSamurai/359503fa3a23ea5e493c5eeeaf2de8d4
# Get Miniconda
Invoke-WebRequest -Uri "https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe" -OutFile "miniconda.exe"
# Extract the Miniconda package
.\miniconda.exe /InstallationType=JustMe /AddToPath=0 /S /RegisterPython=0 /NoRegistry=1 /NoScripts=1 /NoShortcuts=1 /D=$PWD\conda_install
# Wait
$nid = (Get-Process miniconda).id
Write-Host "Waiting for installation to complete..."
Wait-Process -Id $nid
# Move _conda.exe to conda.exe
Move-Item .\conda_install\_conda.exe .\conda_install\conda.exe
# Note:
# Be sure to add the conda folder to path to use conda
$env:Path = "$env:Path;$pwd\conda_install;$pwd\conda_install\Scripts"
# Optionally
New-Item -ItemType File -Path .\conda_install\PATH.txt -Value "$pwd\conda_install;$pwd\conda_install\Scripts" -Force | Out-Null
New-Item -ItemType File -Path .\conda_install\activate_conda.cmd -Value ".\activate_conda.ps1" -Force | Out-Null
New-Item -ItemType File -Path .\conda_install\activate_conda.bat -Value ".\activate_conda.ps1" -Force | Out-NullNew-Item -ItemType File -Path .\conda_install\activate_conda.ps1 -Value ('$env:Path = "$env:Path;$(Get-Content -Path ' + "$PWD\conda_install\PATH.txt" + ')"') -Force | Out-Null
.\conda_install\conda.exe create --no-shortcuts -y -k --prefix "./conda_env" python=3.9
@CypherpunkSamurai
Copy link
Author

you can use iwr https://... | iex to run it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment