This repository was archived by the owner on Mar 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathscript.sh
More file actions
69 lines (61 loc) · 2.13 KB
/
Copy pathscript.sh
File metadata and controls
69 lines (61 loc) · 2.13 KB
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
#!/bin/bash
if command -v conda >/dev/null 2>&1 ; then
echo "Miniconda is already installed on this system."
else
# Download the latest version of Miniconda for Linux
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
# Install Miniconda
bash ~/miniconda.sh -b -p $HOME/miniconda
# Add Miniconda to PATH
conda_dir="/mnt/nfs_share/nfs_share/miniconda"
# Create a backup of the existing bashrc file
cp ~/.bashrc ~/.bashrc.backup
# Append the conda initialization code to the bashrc file
echo "# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup=\"\$('$conda_dir/bin/conda' 'shell.bash' 'hook' 2> /dev/null)\"
if [ \$? -eq 0 ]; then
eval \"\$__conda_setup\"
else
if [ -f \"$conda_dir/etc/profile.d/conda.sh\" ]; then
. \"$conda_dir/etc/profile.d/conda.sh\"
else
export PATH=\"$conda_dir/bin:\$PATH\"
fi
fi
unset __conda_setup
# <<< conda initialize <<<" >> ~/.bashrc
# Source the updated bashrc file to apply the changes
source ~/.bashrc
echo "Miniconda has been installed."
fi
source ~/miniconda/bin/activate
# Define the environment name
env_name="ray"
# Check if the environment is already present in conda
if conda env list | grep -q $env_name; then
echo "$env_name is already present in conda."
else
conda create -y --name ray
conda activate ray
# Check if requirements.txt exists
if [ ! -f requirements.txt ]; then
echo "ERROR: requirements.txt file not found"
exit 1
fi
# Install packages from requirements.txt
pip install -U 'ray[default]'
echo "Installing packages from requirements.txt..."
conda install -y --file requirements.txt
conda install -y pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
# Check if installation was successful
if [ $? -eq 0 ]; then
echo "Packages successfully installed"
else
echo "ERROR: Package installation failed"
exit 1
fi
fi
rm script.sh
rm miniconda.sh
source miniconda/bin/activate