Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
AMBS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
AMBS
Commits
ff208674
Commit
ff208674
authored
3 years ago
by
Michael Langguth
Browse files
Options
Downloads
Patches
Plain Diff
Set-up installation script for virtual environment without usage of container.
parent
df74b2e8
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
video_prediction_tools/env_setup/install_venv.sh
+86
-0
86 additions, 0 deletions
video_prediction_tools/env_setup/install_venv.sh
video_prediction_tools/env_setup/requirements_nocontainer.txt
+0
-0
0 additions, 0 deletions
...o_prediction_tools/env_setup/requirements_nocontainer.txt
with
86 additions
and
0 deletions
video_prediction_tools/env_setup/install_venv.sh
0 → 100644
+
86
−
0
View file @
ff208674
#!/usr/bin/env bash
#
# __authors__ = Bing Gong, Michael Langguth
# __date__ = '2022_02_28'
# __last_update__ = '2022_02_28' by Michael Langguth
#
# **************** Description ****************
# This auxiliary script sets up the virtual environment OUTSIDE singularity container.
# **************** Description ****************
# set some basic variables
BASE_DIR
=
"
$(
pwd
)
"
VENV_DIR
=
$1
VENV_NAME
=
"
$(
basename
"
${
VENV_DIR
}
"
)
"
VENV_BASE
=
"
$(
dirname
"
${
VENV_DIR
}
"
)
"
WORKING_DIR
=
"
$(
dirname
"
${
VENV_BASE
}
"
)
"
VENV_REQ
=
${
BASE_DIR
}
/requirements_nocontainer.txt
# sanity checks
# check if directory to virtual environment is parsed
if
[
-z
"
$1
"
]
;
then
echo
"ERROR: Provide a name to set up the virtual environment."
return
fi
# check if virtual environment is not already existing
if
[
-d
"
$1
"
]
;
then
echo
"ERROR: Target directory of virtual environment
${
1
}
already exists. Chosse another directory path."
return
fi
# check for requirement-file
if
[
!
-f
"
${
VENV_REQ
}
"
]
;
then
echo
"ERROR: Cannot find requirement-file '
${
VENV_REQ
}
' to set up virtual environment."
return
fi
# get Python-version
PYTHON_VERSION
=
$(
python3
-c
'import sys; version=sys.version_info[:2]; print("{0}.{1}".format(*version))'
)
# create or change to base directory for virtual environment (i.e. where the virtualenv-module is placed)
if
!
[[
-d
"
${
VENV_BASE
}
"
]]
;
then
mkdir
"
${
VENV_BASE
}
"
# Install virtualenv in this directory
echo
"Installing virtualenv under
${
VENV_BASE
}
..."
pip
install
--target
=
"
${
VENV_BASE
}
/"
virtualenv
# Change into the base-directory of virtual environments...
cd
"
${
VENV_BASE
}
"
||
return
else
# Change into the base-directory of virtual environments...
cd
"
${
VENV_BASE
}
"
||
return
if
!
python
-m
virtualenv
--version
>
/dev/null
;
then
echo
"ERROR: Base directory for virtual environment exists, but virtualenv-module is unavailable."
exit
fi
echo
"Virtualenv is already installed."
fi
# Set-up virtual environment in base directory for virtual environments
python3
-m
virtualenv
"
${
VENV_NAME
}
"
# Activate virtual environment and install required packages
echo
"Activating virtual environment
${
VENV_NAME
}
to install required Python modules..."
ACT_VENV
=
"
${
VENV_DIR
}
/bin/activate"
source
"
${
VENV_DIR
}
/bin/activate"
# set PYTHONPATH...
export
PYTHONPATH
=
${
WORKING_DIR
}
/virtual_envs/
${
VENV_NAME
}
/lib/python
${
PYTHON_VERSION
}
/site-packages:
$PYTHONPATH
export
PYTHONPATH
=
${
WORKING_DIR
}
:
$PYTHONPATH
export
PYTHONPATH
=
${
WORKING_DIR
}
/utils:
$PYTHONPATH
export
PYTHONPATH
=
${
WORKING_DIR
}
/model_modules:
$PYTHONPATH
export
PYTHONPATH
=
${
WORKING_DIR
}
/postprocess:
$PYTHONPATH
# ... also ensure that PYTHONPATH is appended when activating the virtual environment...
echo
'export PYTHONPATH='
${
WORKING_DIR
}
'/virtual_envs/'
${
VENV_NAME
}
'/lib/python'
${
PYTHON_VERSION
}
'/site-packages:$PYTHONPATH'
>>
${
ACT_VENV
}
echo
'export PYTHONPATH='
${
WORKING_DIR
}
':$PYTHONPATH'
>>
${
ACT_VENV
}
echo
'export PYTHONPATH='
${
WORKING_DIR
}
'/utils:$PYTHONPATH'
>>
${
ACT_VENV
}
echo
'export PYTHONPATH='
${
WORKING_DIR
}
'/model_modules:$PYTHONPATH'
>>
${
ACT_VENV
}
echo
'export PYTHONPATH='
${
WORKING_DIR
}
'/postprocess:$PYTHONPATH'
>>
${
ACT_VENV
}
# ... install requirements
pip
install
--no-cache-dir
-r
"
${
VENV_REQ
}
"
# get back to basic directory
cd
"
${
BASE_DIR
}
"
||
exit
This diff is collapsed.
Click to expand it.
video_prediction_tools/env_setup/requirements_no
n_HPC
.txt
→
video_prediction_tools/env_setup/requirements_no
container
.txt
+
0
−
0
View file @
ff208674
File moved
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment