-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_dep_run.sh
executable file
·129 lines (108 loc) · 3.27 KB
/
install_dep_run.sh
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
# Initialize a flag to track if all dependencies are already installed
all_dependencies_installed=true
# Install pyenv
install_pyenv() {
echo "Installing pyenv..."
curl https://pyenv.run | bash
}
# Install Python 3.9 using pyenv
setup_python_env() {
echo "Setting up Python 3.9 environment..."
pyenv install 3.9
pyenv local 3.9
python -m venv .env
source .env/bin/activate
echo "Python 3.9 environment setup complete. Run $ deactivate to deactivate the virtual environment. Run $ source .env/bin/activate to activate the virtual environment."
}
install_python() {
# Install pyenv
install_pyenv
# Add pyenv to path
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
# Setup Python environment
setup_python_env
}
# Check if pyenv is installed and setup python 3.9
if ! command -v pyenv &> /dev/null
then
all_dependencies_installed=false
install_python
else
echo "pyenv is already installed. Setting up a Python 3.9 environment for the folder..."
all_dependencies_installed=false
setup_python_env
fi
if rustup component list --installed | grep -q rust-src; then
rustup component remove rust-src
fi
rustup component add rust-src
# Check Rust
if ! command -v rustc &> /dev/null; then
echo "Rust not found, installing Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup toolchain remove stable
rustup toolchain install stable
# Check if Rust installation was successful
if ! command -v rustc &> /dev/null; then
echo "Rust installation failed."
exit 1
fi
all_dependencies_installed=false
else
echo "Rust is already installed."
fi
# Check if cargo binstall is installed
if ! command -v cargo-binstall &> /dev/null
then
echo "cargo-binstall not found, installing ..."
cargo install cargo-binstall
all_dependencies_installed=false
fi
# Check if cargo-nextest is installed
if ! command -v cargo-nextest &> /dev/null
then
echo "nextest toolchain not found, installing ..."
yes | cargo binstall cargo-nextest --secure
all_dependencies_installed=false
fi
# Check if cargo-risczero is installed
if ! command -v cargo-risczero &> /dev/null
then
echo "risczero toolchain not found, installing ..."
yes | cargo binstall cargo-risczero
cargo risczero install
all_dependencies_installed=false
fi
# Check Scarb
if ! command -v scarb &> /dev/null
then
echo "Scarb not found, installing Scarb..."
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh
all_dependencies_installed=false
fi
# Check gtime
if ! command -v gtime &> /dev/null
then
echo "gtime not found, installing gtime..."
brew install gnu-time
all_dependencies_installed=false
fi
# Check jq
if ! command -v jq &> /dev/null
then
echo "jq not found, installing jq..."
sudo apt-get install jq
all_dependencies_installed=false
fi
# Install Rust jupyter kernel
source $HOME/.cargo/env
cargo install evcxr_jupyter
evcxr_jupyter --install
# Check if all dependencies were already installed
if [ "$all_dependencies_installed" = true ]; then
echo "All dependencies (Python 3.9, Rust, and Scarb) are already installed."
fi