- Setup machine
Important
This document assumes that your C: drive has limited space (e.g. SSD) and you have another hard drive (D:) which you can use to install apps on instead. If that is not the case, you can omit custom location (-l
) in winget install
invocation or specify a directory on your C drive instead.
Setting up a new Windows machine for development is painful.
This document hopefully alleviates the pain.
Note
🚧 Look into using winget configure to replace script to install apps.
👉 Need to learn how to specify custom install path.
Install winget from Microsoft Store if it is not already installed.
- Install:
winget install Mozilla.Firefox
. - Use Firefox account to sync various items.
- Nerd fonts
- Source Code Pro
- FiraCode: Monospaced font with programming ligatures.
- Hasklig: a code font with monospaced ligatures.
- Cascadia Code
- Julia Mono
- Intel One Mono
-
Download from web and install or use winget:
winget install -e Notepad++.Notepad++
-
Enable support for fonts with ligatures: Preferences ➡️MISC. Make sure
Use DirectWrite (May improve rendering special characters, need to restart Notepad++)
is ✅.
- Compare
- EditorConfig
- JSTool
- Location Navigate
- XML Tools
See here.
- Install: winget install Microsoft.OpenSSH.Beta
- Add install folder (C:\Program Files\OpenSSH) to $Path.
-
Install KeePassXC:
winget install KeePassXCTeam.KeePassXC
-
See here for information on getting started.
-
Add installation folder to
$Path
if needed:$path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') $path += ';C:\Program Files\KeePassXC' [System.Environment]::SetEnvironmentVariable('Path', $path, 'Machine')
-
Install:
winget install -e --id Microsoft.PowerShell
-
Install Oh My Posh as theme engine:
Invoke-RestMethod https://ohmyposh.dev/install.ps1 | Invoke-Expression
This will add install path to
$Path
.In a new shell:
oh-my-posh completion powershell | Out-File -encoding utf8 ~\Documents\PowerShell\Scripts\ArgumentCompleters\oh-my-posh.ps1
-
Disable telemetry:
[System.Environment]::SetEnvironmentVariable('POWERSHELL_TELEMETRY_OPTOUT', 1, 'User')
-
See here for info on how to resolve the issue Enabling PowerShell remoting fails due to Public network connection type
See ModulesToInstall.txt for list of modules to install.
-
Install modules if necessary:
Install-Module -Name Microsoft.PowerShell.SecretManagement -Repository PSGallery Install-Module -Name Microsoft.PowerShell.SecretStore -Repository PSGallery Install-Module SecretManagement.KeePass
-
Configure secret store:
Set-SecretstoreConfiguration -Scope CurrentUser -Authentication Password -PasswordTimeout 3600 Set-SecretStorePassword
-
Register vaults:
Register-SecretVault -Name SecretStore -ModuleName Microsoft.PowerShell.SecretStore -DefaultVault # Assuming you created a Keepass DB with path below Register-SecretVault -Name 'Keepass' -ModuleName 'SecretManagement.Keepass' -VaultParameters @{ Path = "D:\keepass\Passwords.kdbx" UseMasterPassword = $true }
-
Test that it works:
Get-SecretInfo Test-SecretVault -Name 'Keepass'
-
Install required apps:
winget install --id GnuPG.GnuPG -l 'D:\Apps\GnuPG' winget install --id GnuPG.Gpg4win -l 'D:\Apps\Gpg4win'
-
Add to
$Path
if needed:$path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') $path += ';D:\Apps\Gpg4win\bin;D:\Apps\GnuPG\bin' [System.Environment]::SetEnvironmentVariable('Path', $path, 'Machine')
List keys:
$secretKeys = (gpg --list-secret-keys --with-colons | sls -Pattern '^sec:').Line | % { $parts = $_ -split ':'; $parts[4] }
$secretKeys
$keys = (gpg --list-keys --with-colons | sls -Pattern '^pub:').Line | % { $parts = $_ -split ':'; $parts[4] }
$keys
Export keys:
$keys | % { gpg --export -a $_ | Out-File ${_}_.asc }
$secretKeys | % { gpg --export-secret-keys -a $_ | Out-File ${_}_sec.asc }
Import keys:
ls *.asc -Name | % { gpg --import $_ }
- https://superuser.com/questions/1150165/get-list-of-secret-key-ids
- https://security.stackexchange.com/questions/43348/extracting-the-pgp-keyid-from-the-public-key-file
- https://stackoverflow.com/questions/39596446/how-to-get-gpg-public-key-in-bash
- https://www.phildev.net/pgp/gpg_moving_keys.html
- https://blog.jmorbegoso.com/post/export-and-import-gpg-keys-in-windows-and-wsl/
WinMerge is a diff/merge tool.
-
Install:
winget install --id WinMerge.WinMerge -l 'D:\Apps\WinMerge'
-
Add to
$Path
:$path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') $path += ';D:\Apps\WinMerge' [System.Environment]::SetEnvironmentVariable('Path', $path, 'Machine')
SlickRun is a free-floating utility for Windows that can launch programs. Download it from here.
-
Install:
winget install --id Git.Git -e --source winget
.
💡 git comes bundled with Git Credential Manager on Windows. If you keep getting prompted to login when pushing to or pulling from a remote, you may have more than one account set up. To fix, see these instructions.
-
Download GitHub CLI. See Releases for latest version.
$version = '2.39.0' Invoke-RestMethod "https://github.com/cli/cli/releases/download/v${version}/gh_${version}_windows_amd64.zip" -OutFile ~/Downloads/gh_${version}_windows_amd64.zip
-
Copy binary to desired location.
[string] $folder = 'D:\Apps' 7z e C:\Users\Ajay\Downloads\gh_2.39.0_windows_amd64.zip bin\gh.exe -o"$($folder)"
-
Add shell completion script (that you can dot-source in PowerShell profile):
gh completion -s powershell | Out-File -Encoding utf8 ~\Documents\PowerShell\Scripts\ArgumentCompleters\gh.ps1
- Create an authentication token for github.com API requests.
- Set
$GITHUB_TOKEN
to this value to avoid being prompted to authenticate by CLI. - Alternatively, use
gh auth login --secure-storage -h github.com
to store the access token in the system keyring.
Install extensions:
gh extension install actions/gh-actions-cache
gh extension install securesauce/gh-alerts
gh extension install mislav/gh-branch
gh extension install chelnak/gh-changelog
gh extension install vilmibm/gh-contribute
gh extension install mislav/gh-cp
gh extension install dlvhdr/gh-dash
gh extension install yuler/gh-download
gh extension install owenvoke/gh-gpg-key
gh extension install k1LoW/gh-grep
gh extension install redraw/gh-install
gh extension install heaths/gh-label
gh extension install meiji163/gh-notify
gh extension install seachicken/gh-poi
gh extension install samcoe/gh-repo-explore
gh extension install samcoe/gh-triage
gh extension install vilmibm/gh-user-status
-
Install:
winget install Glab.Glab
-
Get a GitLab PAT with at least
api
andwrite_repository
scopes. -
Setup:
glab auth login
. -
Shell completion:
glab completion -s powershell | Out-File ~\Documents\PowerShell\Scripts\ArgumentCompleters\glab.ps1 -Encoding utf8
- Create a PAT.
- Follow prompts for
glab auth login
. Or, create$GITLAB_TOKEN
with value set to PAT.
Install: winget install GitExtensionsTeam.GitExtensions
.
git absorb eliminates tedious manual work of creating fixup commits (and rebasing if you specify --and-rebase
). It can automatically identify which commits are safe to modify, and which staged changes belong to each of those commits. It will then write fixup!
commits for each of those changes.
git add . # fixed files
git absorb --and-rebase
Install: winget install tummychow.git-absorb -l D:\Apps\CLI
.
Grab latest release from repo and add install folder to $Path
.
-
Install:
winget install Oracle.JDK.17
-
Set
$JAVA_HOME
:[System.Environment]::SetEnvironmentVariable('JAVA_HOME', 'C:\Program Files\Java\jdk-17.0.5', 'Machine')
-
Add bin folder (C:\Program Files\Java\jdk-17.0.5\bin) to
$Path
. -
Install maven from https://maven.apache.org/download.cgi and add installation folder to
$Path
.
💡 Install CLI apps in a common directory and add common directory to $Path
.
From Github repo:
Highly parallelized, blazing fast directory tree analyzer
Grab latest binary and shell completion script from Releases page.
typos is a CLI tool to check spelling. It has less false positives compared to the alternatives. Get the latest binaries from here.
less is a pager.
-
Install:
winget install jftuga.less -l D:\Apps\CLI
-
Set environment variables:
[System.Environment]::SetEnvironmentVariable('LESS', '-RX', 'Machine') [System.Environment]::SetEnvironmentVariable('LESSCHARSET', 'UTF8', 'Machine')
fzf is a command-line fuzzy finder.
-
Get latest binaries from here. If you have already installed GitHub CLI and 7zip:
$downloadFolder = (Resolve-Path ~\Downloads).Path $pattern = 'fzf*windows*amd64.zip' gh release download --repo junegunn/fzf --pattern $pattern -D $downloadFolder $zipFile = Get-ChildItem $downloadFolder -Filter $pattern | Select-Object -First 1 $destination = 'D:\Apps\CLI' & 'C:\Program Files\7-Zip\7z.exe' e -o"$destination" $zipFile 'fzf.exe' $zipFile | Remove-Item -Force
-
Override default command: set
$FZF_DEFAULT_COMMAND
torg --files . 2> nul
. -
Override default options:
$opts = @' --color=fg:-1,bg:-1,hl:#5fff87,fg+:-1,bg+:-1,hl+:#ffaf5f --color=info:#af87ff,prompt:#5fff87,pointer:#ff87d7,marker:#ff87d7,spinner:#ff87d7 --bind alt-up:preview-page-up,alt-down:preview-page-down,alt-e:preview-top,alt-f:preview-bottom,ctrl-e:half-page-up,ctrl-f:half-page-down '@ [System.Environment]::SetEnvironmentVariable('FZF_DEFAULT_OPTS', $opts, 'User')
ripgrep is a powerful search tool.
- Get it from here.
- Add installation path to
$Path
.
delta is a syntax-highlighting pager for git, diff, and grep output. In order to use it with git, you need to modify .gitconfig
or you can import dot files.
-
Add to PowerShell profile:
$env:DELTA_PAGER = 'less -rFX'
-
Generate shell completion:
delta --generate-completion powershell | Out-File -Encoding utf8 ~\Documents\PowerShell\Scripts\ArgumentCompleters\delta.ps1
yq is a portable command-line YAML, JSON, XML, CSV and properties processor.
Install: winget install MikeFarah.yq -l D:\Apps\CLI
.
jq is a command-line JSON processor.
Install: winget install jqlang.jq -l D:\Apps\CLI
.
-
Add installation path to
$Path
. -
Create folder if it does not exist:
$env:AppData\Local\bat\cache
-
Add following environment variables:
BAT_PAGER = less -RF
. -
A default configuration file can be created with the
--generate-config-file
option.bat --generate-config-file
Gum provides highly configurable, ready-to-use utilities to help you write useful shell scripts and dotfiles aliases with just a few lines of code.
winget install charmbracelet.gum -l D:\Apps\CLI
duf is a Disk Usage/Free Utility.
winget install muesli.duf -l D:\Apps\CLI
A modern replacement for ps
written in Rust.
winget install procs -l D:\Apps\CLI
winget install DuckDB.cli -l D:\Apps\CLI
Before installing new version of CLI, you need to export any databases from old CLI and re-import in new CLI 😦
For example, let's say you have a database D:/duck_db/nyc-taxi.duckdb
.
-
In CLI for old version, execute:
.open D:/duck_db/nyc-taxi.duckdb
-
In CLI for old version:
EXPORT DATABASE 'D:/duckdb_export/nyc-taxi';
-
Delete old file
D:/duck_db/nyc-taxi.duckdb
. -
In R using latest version of
duckdb
package:con <- dbConnect(duckdb::duckdb(), dbdir = "D:/duckdb/nyc-taxi.duckdb", read_only = FALSE) dbExecute(con, "IMPORT DATABASE 'D:/duckdb_export/nyc-taxi'")
winget install GNU.wget2
Difftastic is a structural diff tool that compares files based on their syntax.
winget install Wilfred.difftastic -l D:\Apps\CLI
ast-grep is a CLI tool for code structural search, lint, and rewriting.
ATAC is a CLI app like Postman. Download latest release from https://github.com/Julien-cpsn/ATAC/releases.
Set $ATAC_MAIN_DIR
to %HOME%/.atac
.
Hurl is a command line tool that runs HTTP requests defined in a simple plain text format.
Grab latest binary from GitHub and copy to install folder.
-
Install chezmoi:
winget install twpayne.chezmoi -l D:\Apps\CLI
-
Run
chezmoi init
to create an initialchezmoi.toml
using template in repo:chezmoi init AjayKMehta
Tip
You can supply --apply
in the above command to generate dot files at same time.
-
Provide the path to your KeePassXC database in your configuration file if any. See here for details.
-
To test this template, use
chezmoi execute-template
with the--init
and--promptString
flags:cat ~/.local/share/chezmoi/.chezmoi.toml.tmpl | chezmoi execute-template --init --promptString gpgrecipient='<RECIPIENT>'
-
Generate dot files:
chezmoi apply
-
Install:
winget install --id Microsoft.VisualStudioCode -l 'D:\Apps\VSCode'
-
Add installation folder (e.g. D:\Apps\VSCode\bin) to
$Path
. -
Use settings sync to get settings.
Tip
If you run into the error Another instance of Code is running as administrator
, you can resolve this by setting VS Code to always run as admin.
- Install from https://nodejs.org/en/download/.
- Change installation path for modules by setting
$NODE_PATH
Hugo is an open-source static site generator.
-
Install:
winget install Hugo.Hugo -l D:\apps\Hugo
-
Add installation folder to
$Path
.
See wsl.md.
winget install Docker.DockerDesktop
When using WSL2 with Docker Desktop, a new distro called docker-desktop-data
is created, which is also where all your image layers are stored.
-
Go to the Releases page and download the binary (
docker-credential-wincred
) that works for you. Put that binary in your$PATH
, so Docker can find it. -
Set the
credsStore
option in your~/.docker/config.json
file with the suffix of the program you want to use (wincred
).{ "credsStore": "wincred" }
Create a function based on instructions here:
function Move-WslDistro {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[ValidateScript(
{ $_ -in $(wsl --list -q | Where-Object { $_.Trim() -ne '' }) },
ErrorMessage = 'Please specify the name of a WSL distro.'
)]
[string] $Distro,
[string] $ExportPath
)
$tarFile = "D:/temp/$Distro.tar"
wsl --export $Distro $tarFile
wsl --unregister $Distro
wsl --import $Distro $ExportPath $tarFile --version 2
}
Now, shut down WSL and call this function to move distros for docker-desktop
and docker-desktop-data
:
wsl --shutdown
Move-WslDistro -Distro docker-desktop-data -ExportPath D:/wsl/Docker/data
Move-WslDistro -Distro docker-desktop -ExportPath D:/wsl/Docker/distro
When you are satisfied that this is working, you can delete tar files.
docker run -it --rm --privileged --pid=host justincormack/nsenter1
Optimize-VHD -Path D:\wsl\Docker\data\ext4.vhdx -Mode Full
Docker Scout is a set of software supply chain features integrated into Docker's user interfaces and command line interface (CLI).
It comes bundled with Docker Desktop but if you wish to use a different version, please follow these instructions.
winget install wagoodman.dive -l D:\Apps\CLI
winget install JesseDuffield.Lazydocker -l D:\Apps\CLI
WezTerm is a powerful cross-platform terminal emulator and multiplexer.
-
Install:
winget install wez.wezterm -l D:\Apps\WezTerm
-
(Optional) Add installation folder to
$Path
.
- https://wezfurlong.org/wezterm/quickselect.html
- https://wezfurlong.org/wezterm/copymode.html
- https://wezfurlong.org/wezterm/config/launch.html
- https://wezfurlong.org/wezterm/config/default-keys.html
- https://wezfurlong.org/wezterm/config/lua/general.html#making-your-own-lua-modules
See here for more details. As of the time this was written, the version of interest for Hadoop was 3.3.6.
-
Install Hadoop and create
$HADOOP_HOME
:pushd ~/Downloads $version = '3.3.6' Invoke-WebRequest "https://dlcdn.apache.org/hadoop/common/hadoop-$version/hadoop-$version.tar.gz" -OutFile "hadoop-$version.tar.gz" -Verbose # https://stackoverflow.com/a/2903532 7z e "hadoop-$version.tar.gz" && 7z x "hadoop-$version.tar" -o"D:/Apps" Remove-Item "hadoop-$version.tar*" # Download Hadoop native IO binary gh download "https://github.com/cdarlint/winutils/tree/master/hadoop-$version/bin" # Copy files to bin folder. Add -L to do dry-run robocopy ".\hadoop-$version\bin" "D:\Apps\hadoop-$version\bin" Remove-Item ".\hadoop-$version\bin" -Recurse popd [System.Environment]::SetEnvironmentVariable('HADOOP_HOME', "D:\Apps\hadoop-$version", 'User')
-
Add
%HADOOP_HOME%\bin
to$Path
.
Download and install from https://developer.nvidia.com/cuda-downloads. It is over 3 GB so if you don't have enough disk space on C:, install on a different drive.
You should see an environment variable $CUDA_PATH
created whose value is the install path.
Download installer from https://developer.nvidia.com/cudnn-downloads.
Install latest release from https://github.com/ggerganov/llama.cpp/releases or build locally. For the latter, the PowerShell scripts in this GitHub repo are useful.
- To use UTF-8 mode on Windows, set environment variable
$PYTHONUTF8
to 1. - To prevent installing using base python, set
$PIP_REQUIRE_VIRTUALENV
totrue
1.
- To resolve error
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)>
, install https://letsencrypt.org/certs/lets-encrypt-r3.der (source).
In order to build certain sdist packages, you need to install latest version of VS Build Tools (source).
-
Before installing, set environment variables if you don't want to use default locations:
[Environment]::SetEnvironmentVariable('UV_INSTALL_DIR', 'D:\Apps\uv', 'User') [Environment]::SetEnvironmentVariable('UV_CACHE_DIR', 'D:\.cache\uv', 'User') [Environment]::SetEnvironmentVariable('UV_TOOL_BIN_DIR', 'D:\Apps\uv\tools', 'User')
-
Also, set
$UV_LINK_MODE
tocopy
to avoid annoying warnings:warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance. If the cache and target directories are on different filesystems, hardlinking may not be supported. If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.
-
(Optional) Set
$UV_FROZEN
to1
ortrue
to avoiduv run
updating lock file.⚠️ Doing so, causesuv lock -U --dry-run
to fail. -
Install
uv
and set up shell completion:irm https://astral.sh/uv/install.ps1 | iex uv generate-shell-completion powershell | Out-File ~\Documents\PowerShell\Scripts\ArgumentCompleters\uv.ps1 # Ensure that the tool executable directory is on the `PATH` uv tool update-shell
-
Use
uv self update
to updateuv
-
Install tools:
uv tool radian # For R uv tool install ipython uv tool install ruff uv tool install virtualenv uv tool install cookiecutter uv tool install mypy uv tool install pipdeptree uv tool install yamllint # <https://pypi.org/project/tox-uv/> uv tool install tox --with tox-uv # <https://pypi.org/project/pre-commit-uv/> uv tool install pre-commit --with pre-commit-uv --force-reinstall uv tool
-
Use
uv tool upgrade --all
to upgrade tools. -
Use
uv tool dir
to list directory where tools are installed. -
Use
uv tool dir --bin
to list directory where tools' executables are installed.
Run tool using uv tool run <tool>
or uvx <tool>
.
-
Create a project in current directory (pass
--lib
if library else--app
):uv init -p 3.12.7 --author-from none --name $project --no-workspace --build-backend setuptools --python-preference managed --app
This will create a virtual environment,
pyproject.toml
and other files.Alternatively, you can use
cookiecutter
to create from a template. -
Add dependencies: Add dependency
foo
(adds to.venv
andpyproject.toml
):uv add foo
Specify optional dependencies just as like you do for
pip install
:uv add 'httpx[zstd]'
You can add constraints for version, etc. with dependency specifiers, formerly know as PEP 508:
uv add 'starlette<0.41.1' # Need quotes with '>' or '<' uv add numpy==2.0.2 uv add foo~=1.0.1
Add dev dependency
mypy
(adds to.venv
and totool.uv
section inpyproject.toml
):uv add mypy --dev
Add optional dependency (adds to
.venv
and toproject.optional-dependencies
section inpyproject.toml
):uv add httpx --optional network
☝️ This is mostly useful for libraries.
-
Sync
.venv
with lockfile:uv sync
. Pass--frozen
to avoid updating the lockfile. -
Update package:
uv lock --upgrade-package <pkg>
. To upgrade a single package to a specific version:uv lock --upgrade-package <package>==<version>
. -
To see what packages would change without updating lockfile:
uv lock -U --dry-run
. -
Update all packages:
uv lock --upgrade
. -
Export package info to requirements.txt:
uv pip compile --annotation-style line pyproject.toml | Out-File requirements.txt
. 💡 If you don't specify--annotation-style line
, it usessplit
which may produce multiple lines per package showing its dependents. -
Verify installed packages have compatible dependencies:
uv pip check
. -
Use
uv run
to run commands in the project environment:uv run python -m spacy info
.- To run a script:
uv run example.py
. - Specify .env file to use:
--env-file .env
.
- To run a script:
⚠️ Be careful not to useuvx
to run a command corresponding to a tool with same name, e.g.mypy
or you will be running in the wrong virtual environment!
Please do the following to install models, e.g. for en_core_web_sm-3.8.0
:
uv add "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl"
For more information, see here.
No GPU version on Windows. See instructions.
See here for instructions on installing PyTorch.
To get CUDA version installed on your machine, inspect the output of the following command:
nvidia-smi
To install CUDA-enabled version, see here.
Install (in uv project):
uv add --group dev jupyterlab
Install following extensions:
- plotlywidget
- @jupyterlab/latex
- @ryantam626/jupyterlab_code_formatter
uv add --group dev jupyterlab-latex
uv run jupyter labextension install plotlywidget jupyterlab_code_formatter
View extensions:
uv run jupyter labextension list
nbQA lets you run mypy and other linters and formatters on Jupyter Notebooks.
uv add --group dev nbqa
Usage: uv run nbqa <tool> <args>
, e.g. uv run nbqa mypy ./src/foo
.
Make sure that you configure environment variables for API keys.
- Create API key at https://dashboard.cohere.com/api-keys.
- Set
$COHERE_API_KEY
to API key.
- Create token at https://replicate.com/account/api-tokens.
- Set
$REPLICATE_API_TOKEN
to API token.
- Get API Key from https://wandb.ai/settings and set
$WANDB_API_KEY
.
To override the directory used to store prompt templates, etc., set $LLM_USER_PATH
(source):
[System.Environment]::SetEnvironmentVariable('LLM_USER_PATH', 'D:\llm', 'User')
Add plugins:
uv run llm install gpt4 llm-claude-3
- Get API Key from https://platform.openai.com/api-keys and set
$OPENAI_API_KEY
.
Get access token from https://huggingface.co/settings/tokens.
Set following environment variables:
-
Set
$HF_HOME
to configure where huggingface_hub will locally store data. In particular, your token and the cache will be stored in this folder. -
Set
$HF_TOKEN
to configure the User Access Token to authenticate. If set, this value will overwrite the token stored on the machine (in$HF_HOME/token
). -
Set
$HF_HUB_DOWNLOAD_TIMEOUT
to define the number of seconds to wait for server response when downloading a file. If the request times out, a TimeoutError is raised.
To enable faster downloads:
uv add hf_transfer
$env:HF_HUB_ENABLE_HF_TRANSFER = 1
Once installed, check that huggingface_hub works properly by running the following command:
uv run python -c "from huggingface_hub import model_info; print(model_info('gpt2'))"
This command will fetch information from the Hub about the gpt2
model. Output should look like this:
ModelInfo(id='openai-community/gpt2', author='openai-community', sha='607a30d783dfa663caf39e06633721c8d4cfcd7e', created_at=datetime.datetime(2022, 3, 2, 23, 29, 4, tzinfo=datetime.timezone.utc), last_modified=datetime.datetime(2024, 2, 19, 10, 57, 45, tzinfo=datetime.timezone.utc), private=False, disabled=False, downloads=12735669, downloads_all_time=None, gated=False, gguf=None, inference=None, likes=2327, library_name='transformers', tags=['transformers', 'pytorch', 'tf', 'jax', 'tflite', 'rust', 'onnx', 'safetensors', 'gpt2', 'text-generation', 'exbert', 'en', 'doi:10.57967/hf/0039', 'license:mit', 'autotrain_compatible', 'text-generation-inference', 'endpoints_compatible', 'region:us'], pipeline_tag='text-generation', mask_token=None, card_data={'base_model': None, 'datasets': None, 'eval_results': None, 'language': 'en', 'library_name': None, 'license': 'mit', 'license_name': None, 'license_link': None, 'metrics': None, 'model_name': None, 'pipeline_tag': None, 'tags': ['exbert']}, widget_data=[{'text': 'My name is Julien and I like to'}, {'text': 'My name is Thomas and my main'}, {'text': 'My name is Mariama, my favorite'}, {'text': 'My name is Clara and I am'}, {'text': 'My name is Lewis and I like to'}, {'text': 'My name is Merve and my favorite'}, {'text': 'My name is Teven and I am'}, {'text': 'Once upon a time,'}], model_index=None, config={'architectures': ['GPT2LMHeadModel'], 'model_type': 'gpt2', 'tokenizer_config': {}}, transformers_info=TransformersInfo(auto_model='AutoModelForCausalLM', custom_class=None, pipeline_tag='text-generation', processor='AutoTokenizer'), trending_score=None, siblings=[RepoSibling(rfilename='.gitattributes', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='64-8bits.tflite', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='64-fp16.tflite', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='64.tflite', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='README.md', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='config.json', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='flax_model.msgpack', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='generation_config.json', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='merges.txt', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='model.safetensors', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='onnx/config.json', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='onnx/decoder_model.onnx', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='onnx/decoder_model_merged.onnx', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='onnx/decoder_with_past_model.onnx', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='onnx/generation_config.json', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='onnx/merges.txt', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='onnx/special_tokens_map.json', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='onnx/tokenizer.json', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='onnx/tokenizer_config.json', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='onnx/vocab.json', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='pytorch_model.bin', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='rust_model.ot', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='tf_model.h5', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='tokenizer.json', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='tokenizer_config.json', size=None, blob_id=None, lfs=None), RepoSibling(rfilename='vocab.json', size=None, blob_id=None, lfs=None)], spaces=['open-llm-leaderboard/open_llm_leaderboard', 'microsoft/HuggingGPT', 'Gustavosta/MagicPrompt-Stable-Diffusion', 'shi-labs/Versatile-Diffusion', 'optimum/llm-perf-leaderboard', 'yizhangliu/Grounded-Segment-Anything', 'microsoft/Promptist', 'h2oai/h2ogpt-chatbot', 'aliabid94/AutoGPT', 'Manmay/tortoise-tts', 'Yntec/ToyWorld', 'jadechoghari/OpenMusic', 'h2oai/h2ogpt-chatbot2', 'wangrongsheng/ChatPaper', 'OFA-Sys/OFA-Image_Caption', 'Intel/low_bit_open_llm_leaderboard', 'eduagarcia/open_pt_llm_leaderboard', 'm-ric/beam_search_visualizer', 'exbert-project/exbert', 'OpenMotionLab/MotionGPT', 'ShiwenNi/ChatReviewer', 'Yntec/HuggingfaceDiffusion', 'doevent/Stable-Diffusion-prompt-generator', 'open-llm-leaderboard/blog', 'flax-community/image-captioning', 'BAAI/open_cn_llm_leaderboard', 'Yntec/PrintingPress', 'treadon/prompt-fungineer-355M', 'nateraw/lavila', 'yizhangliu/Text-to-Image', 'BadToBest/EchoMimic', 'fffiloni/EchoMimic', 'gsaivinay/open_llm_leaderboard', 'TMElyralab/MuseTalk', 'deepklarity/poster2plot', 'FrankZxShen/so-vits-svc-models-ba', 'maxmax20160403/sovits5.0', 'Nymbo/Compare-6', 'EleutherAI/magma', 'akhaliq/CLIP_prefix_captioning', 'OFA-Sys/OFA-Visual_Grounding', 'phenomenon1981/MagicPrompt-Stable-Diffusion', 'Yntec/ToyWorldXL', 'OFA-Sys/OFA-vqa', 'aubmindlab/Arabic-NLP', 'Gustavosta/MagicPrompt-Dalle', 'OFA-Sys/OFA-Generic_Interface', 'johko/capdec-image-captioning', 'ShiwenNi/ChatResponse', 'hkunlp/Binder', 'SeaLLMs/SeaLLM-Chat', 'bipin/image2story', 'Omnibus/Chatbot-Compare', 'LilyF/Generate_Text_and_Audio', 'Yntec/blitz_diffusion', 'society-ethics/model-card-regulatory-check', 'Nick088/Audio-SR', 'CISCai/gguf-editor', 'Catmeow/AI_story_writing', 'hahahafofo/image2text_prompt_generator', 'ethanchern/Anole', 'ICML2022/OFA', 'thirdai/BOLT2.5B', 'FrankZxShen/so-vits-svc-models-pcr', 'mshukor/UnIVAL', 'sohaibcs1/Image-to-Text-Summary', 'aliabid94/GPT-Golf', 'Hello-SimpleAI/chatgpt-detector-ling', 'llizhx/TinyGPT-V', 'lfoppiano/document-qa', 'fireredteam/FireRedTTS', 'TencentARC/ImageConductor', 'RitaParadaRamos/SmallCapDemo', 'liyucheng/selective_context', 'sasha/BiasDetection', 'phenixrhyder/NSFW-ToyWorld', 'gsarti/pecore', 'BoomerangGirl/MagicPrompt-Stable-Diffusion', 'architext/Architext_deployed', 'kmacdermid/RpgRoomGenerator', 'SeViLA/SeViLA', 'AnimaLab/bias-test-gpt-pairs', 'optimum/auto-benchmark', 'GTBench/GTBench', 'sonalkum/GAMA', 'John6666/Diffusion80XX4sg', 'stanfordnlp/Backpack-Demo', 'shangdatalab-ucsd/LDB', 'abdullahmeda/detect-ai-text', 'oceansweep/tldw', 'zeno-ml/chatbot-report', 'luis112/text-generation-webui', 'Kaludi/Stable-Diffusion-Prompt-Generator_App', 'freQuensy23/LLMhistory', 'Vikhrmodels/small-shlepa-lb', 'prometheus-eval/BiGGen-Bench-Leaderboard', 'dromerosm/gpt-info-extraction', 'hahahafofo/prompt_generator', 'ccolas/TastyPiano', 'sasha/WinoBiasCheck'], safetensors=SafeTensorsInfo(parameters={'F32': 137022720}, total=137022720))
To create an API key head to the setting pages. Then click Create API Key.
-
Download and install R from CRAN website. Alternatively,
winget install RProject.R
. -
Add <InstallPath>\bin\x64 to
$PATH
. -
Default folder of .RProfile and .REnviron is ~\Documents which leads to issues if OneDrive moves this folder to ~\OneDrive\Documents 😦. So, best to set environment variables:
[System.Environment]::SetEnvironmentVariable('R_ENVIRON_USER', '~\.Renviron', 'User') [System.Environment]::SetEnvironmentVariable('R_PROFILE_USER', '~\.Rprofile', 'User')
-
To avoid the issue of C: running out of disk space, set
$R_LIBS
to a different path, e.g.D:\packages
. -
Set
$GITHUB_PAT
to GitHub PAT obtained. This is necessary for avoiding rate-limit issues when installing packages from GitHub using theremotes
package.
-
Check output of
.libPaths()
and if there is a folder with old R version number, copy its contents to new folder with correct R version number. -
Update packages for new R version:
update.packages(ask=FALSE, checkBuilt=TRUE)
-
Delete package install location with old R version number if any.
(Source)
winget install Posit.RStudio
💡 Install location is usually C:\RTools but if you have limited disk space, change folder during installation. Installer will set $RTOOLS<VER>_HOME
automatically, e.g. if you set install path for RTools 4.4 to D:\rtools44
, then this path will be value for $RTOOLS44_HOME
.
- Download and run R Build tools.
- Add bin folder in install path to
$PATH
-- this can be done by editing .Renviron:PATH="${RTOOLS44_HOME}\usr\bin;${PATH}"
.
-
To install packages from
r-universe
:install.packages("universe") # For dev version: # install.packages("universe", repos = "https://ropensci.r-universe.dev")
-
Use
universe::add()
to opt-in to a package repository (this will modify youroptions('repos')
list).universe::add("ropensci")
-
Install packages in Packages.csv.
-
In .RProfile, set
options(spark.install.dir = "D:/Apps/Spark")
-
Install
sparklyr
:install.packages("sparklyr")
-
Check available versions:
library(sparklyr) spark_versions()
-
Install required version:
spark_install("3.5.0", "3")
-
Set
$SPARK_HOME
to bin folder, i.e. D:\Apps\Spark\spark-3.3.2-bin-hadoop3\bin.
install.packages("cmdstanr")
cmdstanr::check_cmdstan_toolchain(fix = TRUE)
cmdstanr::install_cmdstan(dir = "D:/Apps", overwrite = TRUE, cores = 6)
cmdstanr::set_cmdstan_path() # D:/Apps/cmdstan-2.24.1
From the project's README.md:
radian is an alternative console for the R program with multiline editing and rich syntax highlight.
Installation steps:
- Install
radian
:uv tool install radian
. - Set
$R_BINARY
to <InstallPath>\bin\x64\R.exe. This is needed forradian
to work properly.
- Install
languageserver
andhttpgd
in R:install.packages(c("languageserver", "httpgd"))
. - Install the R extension for Visual Studio Code.
- Set up
radian
as R console in VS Code. - Install VSCode-R-Debugger package:
remotes::install_github(ref = "v0.5.2", "ManuelHentschel/vscDebugger")
.
See here for more details.
- Install R package
IRKernel
:install.packages("IRkernel")
. - Activate venv environment for a uv project with Jupyter installed:
. .\.venv\Scripts\Activate.ps1
if in root directory. 💡 VS Code automatically executes this if you open a PowerShell terminal AFAICT. - Use
jupyter kernelspec list
to get location of existing kernels. If you see a path corresponding to$Appdata\jupyter\kernels\ir
, then R kernel is already installed. - Launch
radian
in environment's shell:radian
oruv run radian
(use project's version). - In radian:
IRkernel::installspec()
.
Alternatively, you can copy files from
IRKernel
package installation directory's kernelspec subfolder to$Appdata\jupyter\kernels\ir
.
Now if you launch jupyterlab (uv run jupyter lab
), you should see a R kernel and be able to select it for your notebook.
This is available from GitHub.
- Download latest release from https://github.com/catboost/catboost/releases.
- Install:
install.packages(repo = NULL, type = "source", r"{C:\Users\Ajay\Downloads\catboost-R-windows-x86_64-1.2.2.tgz}")
.
See here.
Quarto is a replacement for RMarkdown that also works with Python.
To install:
-
Download installer from https://github.com/quarto-dev/quarto-cli/releases and run.
-
Add installation path (D:\Apps\Quarto\bin) to
$PATH
if not already available. -
RStudio ships with its owb version of Quarto + Pandoc. To use Quarto and its bundled version of Pandoc, add the following to your .Renviron file:
QUARTO_PATH="D:/Apps/quarto/bin/quarto.cmd" RSTUDIO_PANDOC="D:/Apps/quarto/bin/tools"
To support rendering of PDF documents that include SVG files, automatically converting them to PDF images in Quarto 1.3+, install rsvg-convert
from https://github.com/miyako/console-rsvg-convert and add to$PATH
.
(Optional) tinytex is a lightweight alternative to MikTeX:
quarto install tinytex
You can use OpenBLAS to speed up linear algebra operations but use at your own risk! Instructions below are modified from this SO post and https://medium.com/@FredHo42/using-intel-mkl-library-on-r-4-0-641dc0c3c06b.
- Download latest version of OpenBLAS from https://github.com/OpenMathLib/OpenBLAS/releases.
- Copy
Rlapack.dll
andRblas.dll
from./bin/x64
in R installation folder to safe location. - Now create 2 copies of
libopenblas.dll
namedRlapack.dll
andRblas.dll
and copy them to folder from step 1. - If you run into problems, you can revert back to the original DLLs.
Check performance:
Before
> system.time(svd(matrix(runif(10000*2000), 10000, 2000), nu=0, nv=0))
user system elapsed
43.50 0.09 44.06
After
> system.time(svd(matrix(runif(10000*2000), 10000, 2000), nu=0, nv=0))
user system elapsed
20.72 1.20 5.30
-
Install Visual Studio Community 2022:
winget install Microsoft.VisualStudio.2022.Community
This will also install .NET 8 SDK.
-
Install templates for
dotnet new
:dotnet new install "Boxed.Templates" dotnet new install "Amazon.Lambda.Templates" dotnet new install "NUnit3.DotNetNew.Template"
-
Set environment variables related to runtime configuration for compilation:
[System.Environment]::SetEnvironmentVariable('DOTNET_TieredPGO', 1, 'User')
💡 Enabled by default in .NET 8 so no longer needed after upgrading to .NET 8.
-
Disable telemetry:
[System.Environment]::SetEnvironmentVariable('DOTNET_CLI_TELEMETRY_OPTOUT', 1, 'User') [System.Environment]::SetEnvironmentVariable('DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT', 1, 'User')
-
Change directory for NuGet packages
[System.Environment]::SetEnvironmentVariable('NUGET_PACKAGES', 'D:\NuGet\packages', 'Machine')
-
Install NuGet:
winget install Microsoft.NuGet
. -
Add installation path to
$Path
.
-
Install LinqPad 8:
winget install --id LINQPad.LINQPad.8 -l 'D:\Apps\LINQPad8\'
-
Install Nuget Package Explorer:
winget install --id 9WZDNCRDMDM3
-
Install MSBuild Structured Log Viewer:
winget install --id KirillOsenkov.MSBuildStructuredLogViewer
-
Install NSwagStudio:
winget install --id RicoSuter.NSwagStudio
-
Install PerfView:
winget install Microsoft.PerfView -l D:\Apps\PerfView
Install following tools:
dotnet tool install -g benchmarkdotnet.tool
dotnet tool install -g coverlet.console
dotnet tool install -g diffenginetray
dotnet tool install -g dotnet-counters
dotnet tool install -g dotnet-depends
dotnet tool install -g dotnet-monitor
dotnet tool install -g dotnet-outdated-tool
dotnet tool install -g dotnet-reportgenerator-globaltool
dotnet tool install -g dotnet-sos
dotnet tool install -g dotnet-stack
dotnet tool install -g dotnet-stryker
dotnet tool install -g dotnet-trace
dotnet tool install -g microsoft.dotnet-httprepl
dotnet tool install -g microsoft.dotnet-interactive
dotnet tool install -g minver-cli
dotnet tool install -g roslynator.dotnet.cli
dotnet tool install -g snitch
dotnet tool install -g upgrade-assistant
# https://learn.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-telemetry?tabs=powershell#how-to-opt-out
[System.Environment]::SetEnvironmentVariable('DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT', '1', 'User')
-
Download MiKTeX command-line installer from https://miktex.org/download.
-
Extract miktexsetup_standalone.exe and set current directory to its folder location.
-
Run the following command to download MiKTeX into a local package repository:
. .\miktexsetup_standalone.exe --verbose --local-package-repository=D:\miktex-repository --package-set=basic download
-
Next, run:
$installFolder = 'D:\Apps\Miktex' $dataFolder = 'D:\ProgramData\Miktex' . .\miktexsetup_standalone.exe --common-config=$dataFolder --common-data=$dataFolder --common-install=$installFolder --local-package-repository=D:\miktex-repository --modify-path --package-set=basic --shared=yes --user-config="$env:APPDATA\MiKTeX" --user-data="$env:LOCALAPPDATA\MiKTeX" --print-info-only install
-
Output should look like this:
setup task: install from local package repository local package repository: D:\miktex-repository package set: basic install for all users?: yes portable? : no use registry?: yes modify path?: yes program folder name: MiKTeX common install root: D:\Apps\Miktex common config root: "D:\ProgramData\Miktex" common data root: "D:\ProgramData\Miktex" user config root: C:\Users\Ajay\AppData\Roaming\MiKTeX user data root: C:\Users\Ajay\AppData\Local\MiKTeX
-
If the output looks OK, remove
--print-info-only
from above CLI command and run to install MikTex. -
Add
$installFolder\bin\x64\
to$Path
.
If you encounter an error about a missing Qt plugin, uninstall and reinstall miktex-qt6-bin-x64
:
miktex --admin packages remove miktex-qt6-bin-x64
miktex --admin packages install miktex-qt6-bin-x64
latexindent is used to format LaTeX in the VS Code extension LaTeX-Workshop.
Warning
The script that ships with MikTex requires a Perl installation but even after trying to install Perl (in standard and custom location), it still did not work.
Download latest version from here and make sure install folder is in $Path
.
Tectonic is a modern TeX/LaTeX engine written in Rust 🦀
Grab latest binary from GitHhub repo and make sure installation folder is in $Path
.
chktex can be installed from CTAN to lint LaTeX files.
Note
It seems that the configuration file chktexrc
is installed in <MikTex Install Folder>/chktex
.
See miktex_packages.txt for list of packages to install.
GHCup is the main installer for Haskell. Setting up Haskell on Windows is still painful but less so than before GHCup came around.
- If you wish to specify the installation root directory for ghcup, you can set
$GHCUP_INSTALL_BASE_PREFIX
2 (user-level environment variable). If not set, you can pass install directory choice to the install script or the script will prompt you if it doesn't find a drive with > 5 GB free space to install on.
-
Download install script:
cd ~\Downloads\ && Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -OutFile bootstrap-haskell.ps1
Warning
Although the website says to run it directly, I think it's a good idea to review the script first and possibly customize invocation as the script has several parameters and the default values may not work for you.
-
Run script in non-admin powershell:
# Hash from https://github.com/msys2/msys2-installer/releases/download/2023-07-18/msys2-base-x86_64-20230718.sfx.exe.sha256 . .\bootstrap-haskell.ps1 -InstallStack -InStallHLS -InstallDir D:\Apps -Msys2Version '20230718' -Msys2Hash 'ab9b9a25e92d0c71136c79eeac954f1ce023341224de8d81401439f38c8b9232'
Caution
This did not work when specifying msys
details. I got an error about file hash not being equal though that was not the case 😦
This section is based on the following links:
- https://www.haskell.org/ghcup/install/#windows_1
- https://github.com/keithfancher/haskell-notes/blob/master/haskell-notes.md#getting-started
- https://gist.github.com/lsmor/bb632565cd96be9da589b6e91f80f9ba
-
Assuming you plan to install
msys
toD:\msys64
andghcup.exe
toD:\Apps\ghcup\bin
, set the following environment variables first:Env Variable Value Notes GHCUP_INSTALL_BASE_PREFIX
D:\Apps Defaults to $HOME
CABAL_DIR
D:\Apps\cabal If set, all cabal-install
content files will be stored as subdirectories of this directory, including the configuration file ifCABAL_CONFIG
is unset. See here.CABAL_CONFIG
$USERPROFILE
\.config\cabal\configPath for global configuration file. GHCUP_MSYS2
D:\msys64 Has to point to the root of an existing MSYS2 installation STACK_ROOT
D:\sr This is where stack
stores important files. See here.GITHUB_TOKEN
GitHub PAT. See GitHub Token for details. Used by stack
to authenticate when using GitHub REST API. See here.
Important
You also need to add D:\Apps\ghcup\bin
to $Path
.
You also need to make sure $HOME
is set if you want to save .ghci
there.
-
Download ghcup binary from https://github.com/haskell/ghcup-hs/releases, e.g. latest version as of the time, this was written is 1.2.0, so download https://github.com/haskell/ghcup-hs/releases/download/v0.1.20.0/x86_64-mingw64-ghcup-0.1.20.0.exe.
-
Rename binary to
ghcup.exe
and copy toD:\Apps\ghcup\bin
. -
Create config file in
D:\Apps\ghcup\bin
3:ghcup config init
. -
If your metadata is stale, then you can update your config to point to a recent metadata yaml:
ghcup config set url-source https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-vanilla-0.0.8.yaml
-
Download latest version from https://github.com/msys2/msys2-installer/releases/.
-
Install the self extracting archive to D:\msys64:
.\msys2-base-x86_64-20230718.sfx.exe -y -oD:\
-
Launch
D:\Mmsyss64\msys2.exe
as this does some initialization steps. If you don't, you may get this error when you try to run the next step:warning: Public keyring not found; have you run 'pacman-key --init'?
. -
Update msys2:
ghcup run -m -- pacman --noconfirm -Syuu ghcup run -m -- pacman --noconfirm -S --needed curl autoconf mingw-w64-x86_64-pkgconf ghcup run -m -- pacman --noconfirm -S ca-certificates
Also, refer to this.
-
Set up msys2 shell:
- Run
ghcup run -m -- sed -i -e 's/db_home:.*$/db_home: windows/' /etc/nsswitch.conf
to make the `$HOME`` in your msys2 shell match the one from windows. - Make a desktop shortcut from
D:\msys64\msys2_shell.cmd
, which will allow you to start a proper msys2 shell:New-Item -ItemType SymbolicLink -Path ~\Desktop\Msys2 -Value D:\msys64\msys2_shell.cmd
(requires elevated shell). - Run
ghcup run -m -- sed -i -e "s/#MSYS2_PATH_TYPE=.*/MSYS2_PATH_TYPE=inherit/" /d/msys64/msys2.ini
- Run
ghcup run -m -- sed -i -e "s/rem set MSYS2_PATH_TYPE=inherit/set MSYS2_PATH_TYPE=inherit/" /d/msys64/msys2_shell.cmd
- Run
-
Install ghc:
ghcup install ghc --set recommended
-
Edit config files as needed. The
ghci.conf
file in$AppData\ghc
can be used for turning on favorite options (e.g.:set +s
), and defining useful macros.$HOME/.ghci
can be used as a startup script. See here for good ideas.
-
Install:
ghcup install cabal
-
Edit config file:
extra-include-dirs: D:\msys64\mingw64\include extra-lib-dirs: D:\msys64\mingw64\lib -- Would also need install folder if cabal installed in stand-alone folder: D:\cabal\bin extra-prog-path: D:\ghcup\bin;D:\msys64\mingw64\bin;D:\msys64\usr\bin
-
Edit Stack's global configuration file which should be located at
${STACK_ROOT}\config.yaml
, e.g.D:/sr/config.yaml
4:# The target directory for stack build --copy-bins and stack install. local-bin-path: D:/stack # Stack 'programs' directory, where tools like GHC get installed. local-programs-path: D:/stack skip-msys: true # https://www.haskell.org/ghcup/install/#vscode-integration system-ghc: true install-ghc: false extra-path: - 'D:\msys64\usr\bin' - 'D:\msys64\mingw64\bin' extra-include-dirs: - 'D:\msys64\mingw64\include' extra-lib-dirs: - 'D:\msys64\mingw64\lib'
-
If you wish to add your config file to your dot files repo, do the following:
# Create symlink to actual config file New-Item -Path ~\.stack\config.yaml -Value D:\sr\config.yaml -ItemType SymbolicLink -Force chezmoi add --follow --template ~/.stack/config.yaml
Warning
chezmoi re-add
will not pick up updates to the original config.yaml
. You will need to add it again via chezmoi add ...
if there are any updates 😦
-
Run
ghcup install stack latest
. -
Make sure that the value of
local-bin-path
(if not set, value is~\AppData\Roaming\local\bin
) is in$PATH
as that is wherestack install
installs generated binaries (source). -
In
$STACK_ROOT\global-project\stack.yaml
, specify resolver corresponding to the version of GHC you installed. This info can be obtained from https://www.stackage.org e.g. for GHC 9.4.8, this should be:resolver: lts-21.22
-
On Windows, GDB can be installed to debug an executable with
ghcup run -m -- pacman -S gdb
.
Checks:
-
Output of
stack path --stack-root
should match$STACK_ROOT
. -
Output of
stack path --local-bin
should be in$PATH
-
Sanity checks:
where.exe stack stack path stack exec -- which ghc stack exec sh
💡 Do not use
stack runghc
with a local package. Usestack exec
instead.5
-
Choose the latest version of HLS that is compatible with the version of GHC installed.
-
Install:
# ghcup install hls latest ghcup install hls 2.6.0.0
-
If you want to explicitly configure your project build, install
implicit-hie
to auto-generate a stack or cabal multi component hie.yaml file:# If $pwd is not a stack project, will install for global project! stack install implicit-hie
Usage:
gen-hie > hie.yaml
-
To enable local documentation on hover, add the following to global
$STACK_ROOT\config.yaml
, or project'sstack.yaml
:ghc-options: '$everything': -haddock
Install hlint
or grab binary from repo:
stack install hlint
Haskell Syntax Highlighting (justusadam.language-haskell adds syntax highlighting for Haskell and Cabal files.
Haskell for VS Code (haskell.haskell) is powered by the Haskell Language Server.
Setup:
-
Make sure your
setting.json
has this setting:"haskell.manageHLS": "GHCup"
-
Install one of the formatters below:
# Rerun if GHC version changes! stack install ormolu stack install brittany
Haskell GHCi Debug Adapter Phoityne (phoityne.phoityne-vscode) provides debugging support. See website for how to configure launch.json
to debug Haskell code.
Prerequisites:
Install haskell-dap, ghci-dap, haskell-debug-adapter:
$ stack update
$
$ stack install haskell-dap ghci-dap haskell-debug-adapter
-```
**Usage:**
:bulb: If you use `Debug: Add Configuration...` command in VS Code and select `haskell-debug-adapter`, it will create a `launch.json` for you with 2 configurations - one using `stack` and the other using `cabal`. The former can be changed to run `app/Main.hs` instead of `test/Spec.hs` (also, need to remove `--test` from `ghciCmd`). The latter does not work.
```powershell
stack update
# Rerun if GHC version changes!
stack install haskell-dap ghci-dap haskell-debug-adapter
Lambda Black is optimized for Haskell.
If you encounter an error like "cannot satisfy -package-id...", you need to clean, build and restart LSP. You can add this to .vscode/task.json
:
{
"group": "build",
"type": "shell",
"label": "haskell clean & build",
"command": "stack clean && stack build"
},
{
"label": "rebuild and reload LSP",
"command": "${command:haskell.commands.restartServer}",
"dependsOn": [
"haskell clean & build"
]
}
Additionally, you may need to create a hie.yaml
file in the project's root directory looking like this:
cradle:
stack:
Links:
- haskell/haskell-language-server#735
- haskell/haskell-ide-engine#1616
- haskell/haskell-language-server#1822
pngquant is a command-line utility and a library for lossy compression of PNG images.
Download latest version.
-
Install following apps:
winget install --id VideoLAN.VLC winget install --id ImageMagick.ImageMagick winget install --id Mp3tag.Mp3tag winget install --id Citrix.Workspace winget install --id Postman.Postman winget install --id chrisant996.Clink winget install --id 7zip.7zip winget install --id Graphviz.Graphviz -l 'D:\Apps\Graphviz' winget install --id Kitware.CMake -l 'D:\Apps\CMake' winget install --id WinSCP.WinSCP -l 'D:\Apps\WinSCP\' winget install Microsoft.Sysinternals.ProcessExplorer winget install eza-community.eza - l D:\Apps\CLI
-
Add installation folders to
$Path
:$path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') $path += ';C:\Program Files\7-Zip;D:\Apps\Graphviz;D:\Apps\CMake;D:\Apps\WinSCP' [System.Environment]::SetEnvironmentVariable('Path', $path, 'Machine')
Footnotes
-
See https://daniel.feldroy.com/posts/til-2023-12-forcing-pip-to-use-virtualenv for details. ↩
-
Whichever value you use will be set by the script as
$GHCUP_INSTALL_BASE_PREFIX
. ↩ -
The online documentation says location is
~/.ghcup/config.yaml
which is not the case. ↩ -
If you execute a
stack
command before your config file is set up correctly, it will attempt to download GHC, msys2 which is not what we want 😲 -
https://www.reddit.com/r/haskell/comments/a6st8j/comment/ebyyb8n/. ↩