artiq/install-with-conda.py

46 lines
2.0 KiB
Python
Raw Normal View History

# This script installs ARTIQ using the conda packages built by the new Nix/Hydra system.
2019-05-07 17:25:26 +08:00
# It needs to be run in the root (base) conda environment with "python install-with-conda.py"
2019-02-20 11:24:25 +08:00
# It supports Linux and Windows, but Linux users should consider using the higher-quality
# Nix package manager instead of Conda.
# EDIT THIS:
# The name of the conda environment to create
CONDA_ENV_NAME = "artiq"
2019-07-18 00:51:47 +08:00
# The conda packages to download and install.
CONDA_PACKAGES = [
2019-07-18 00:51:47 +08:00
"artiq",
# Only install board packages if you plan to reflash the board.
# The two lines below are just examples and probably not what you want.
# Select the packages that correspond to your board, or remove them
# if you do not intend to reflash the board.
2019-07-18 00:51:47 +08:00
"artiq-board-kc705-nist_clock",
"artiq-board-kasli-wipm"
]
# Set to False if you have already set up conda channels
ADD_CHANNELS = True
2019-07-04 20:04:32 +08:00
# PROXY: If you are behind a web proxy, configure it in your .condarc (as per
2019-07-18 00:51:47 +08:00
# the conda manual).
2019-07-04 20:04:32 +08:00
# You should not need to modify the rest of the script below.
import os
def run(command):
r = os.system(command)
if r != 0:
raise SystemExit("command '{}' returned non-zero exit status: {}".format(command, r))
if ADD_CHANNELS:
run("conda config --prepend channels m-labs")
2019-07-19 16:11:03 +08:00
run("conda config --prepend channels https://conda.m-labs.hk/artiq-beta")
run("conda config --append channels conda-forge")
2019-07-18 00:51:47 +08:00
# Creating the environment first with python 3.5 hits fewer bugs in conda's broken dependency solver.
run("conda create -y -n {CONDA_ENV_NAME} python=3.5".format(CONDA_ENV_NAME=CONDA_ENV_NAME))
for package in CONDA_PACKAGES:
# Do not activate the environment yet - otherwise "conda install" may not find the SSL module anymore on Windows.
# Installing into the environment from the outside works around this conda bug.
2019-07-19 16:11:03 +08:00
run("conda install -y -n {CONDA_ENV_NAME} -c https://conda.m-labs.hk/artiq-beta {package}"
2019-07-18 00:51:47 +08:00
.format(CONDA_ENV_NAME=CONDA_ENV_NAME, package=package))