artiq/install-with-conda.py

43 lines
1.7 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",
"artiq-board-kc705-nist_clock",
"artiq-board-kasli-mitll"
]
# 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
import tempfile
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-18 00:51:47 +08:00
run("conda config --prepend channels https://m-labs.hk/artiq/conda")
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.
run("conda install -y -n {CONDA_ENV_NAME} -c https://m-labs.hk/artiq/conda {package}"
.format(CONDA_ENV_NAME=CONDA_ENV_NAME, package=package))