-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathinstall.ps1
76 lines (61 loc) · 1.88 KB
/
install.ps1
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
$mini_conda_url="https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe"
echo "Path:"
echo $env:Path
$VENV="comcat"
# Is conda installed?
If ((Get-Command "conda" -ErrorAction SilentlyContinue) -eq $null){
echo "No conda detected, installing miniconda..."
echo "Install directory: $HOME/miniconda"
Invoke-WebRequest -Uri $mini_conda_url -OutFile ".\condainstall.exe"
Start-Process -FilePath ".\condainstall.exe" -PassThru -Wait -ArgumentList "/S /AddToPath=1"
}Else{
echo "conda detected, installing $VENV environment..."
}
# So that the path is updated
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")
$conda_path = Write-Output $env:CONDA_PREFIX
$env:Path += ";$conda_path"
conda --version
echo "PATH:"
echo $env:PATH
echo ""
# Start in conda base environment
echo "Activate base virtual environment"
conda activate base
# Remove existing libcomcat environment if it exists
conda remove -y -n $VENV --all
# Package list:
$package_list=
"python>=3.6",
"impactutils",
"ipython",
"jupyter",
"numpy",
"obspy",
"pyproj",
"pandas",
"pip",
"pytest",
"pytest-cov",
"vcrpy",
"xlrd",
"xlwt",
"openpyxl",
"xlsxwriter"
# Create a conda virtual environment
echo "Creating the $VENV virtual environment:"
echo "conda create -y -n $VENV -c conda-forge --channel-priority $package_list"
conda create -y -n $VENV -c conda-forge --channel-priority $package_list
# Bail out at this point if the conda create command fails.
# Clean up zip files we've downloaded
If (-NOT ($?) ) {
Write-Output "Failed to create conda environment. Resolve any conflicts, then try again."
return False
}
# Activate the new environment
echo "Activating the $VENV virtual environment"
conda activate $VENV
# This package
echo "Installing libcomcat..."
pip install -e .