-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprepare_env.sh
More file actions
73 lines (62 loc) · 2.21 KB
/
Copy pathprepare_env.sh
File metadata and controls
73 lines (62 loc) · 2.21 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
70
71
72
#!/bin/bash
EDSR_DIR=$PWD
# when script is run from the enhanced-edsr project directory (as expected), let's create the python virtual environment in its parent directory, above the enhanced-edsr folder
ENV_PARENT_DIR_BASENAME=`basename $EDSR_DIR`
if [[ "$ENV_PARENT_DIR_BASENAME" != *"enhanced-edsr"* ]]; then
echo "Please run this script after changing directory into this enhanced-edsr folder"
exit -1
fi
ENV_PARENT_DIR=`dirname $EDSR_DIR`
ENV_DIR=$ENV_PARENT_DIR/venv_edsr
if [[ ! -d $ENV_DIR ]]; then
echo "Creating python virtual environment: ${ENV_DIR}"
if [[ -z `which python3.12` ]]; then
echo "ERROR: python3 is not found. please install python then rerun this script"
exit -1
fi
if [[ -z `which pip3.12` ]]; then
echo "ERROR: pip3 is not found. please install pip3 then rerun this script"
exit -1
fi
python3.12 -m pip install --upgrade pip
python3.12 -m venv $ENV_DIR
if [ $? -ne 0 ]; then
echo "ERROR: python virtualenv module did not succeed. please install virtualenv then rerun this script"
exit -1
fi
fi
if [[ ! -d $ENV_DIR ]]; then
echo "ERROR: Creating python virtual environment was unsuccessful"
echo "exiting"
exit -1
fi
echo "Activating virtual environment: $ENV_DIR"
source $ENV_DIR/bin/activate
echo "Installing BasicSR requirements"
pushd $EDSR_DIR/BasicSR
pip3.12 install -r requirements.txt
if [ $? -ne 0 ]; then
echo "ERROR: installing BasicSR dependencies was unsuccessful. please fix and then rerun this script"
exit -1
fi
popd
FFMPEG_BIN=`which ffmpeg`
if [ $? -ne 0 ]; then
echo "Could not find ffmpeg binary. Pulling ffmpeg 8.0 from github source, and attempting to build it"
git clone https://github.com/FFmpeg/FFmpeg.git
pushd FFmpeg
git checkout -b n.8.0 tags/n8.0
./configure
make -j
sudo make install
popd
fi
echo ""
echo ""
echo "Creation of virtual environment for EDSR succeeded."
echo "Run \"source $ENV_DIR/bin/activate\" in your environment before working with EDSR"
FFMPEG_BIN=`which ffmpeg`
if [ $? -ne 0 ]; then
echo "Could not find ffmpeg binary. Please consider installing ffmpeg if using the make_dataset.sh script for dataset preparation."
fi
echo "Exiting with SUCCESS"