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
5c872c4f
Commit
5c872c4f
authored
3 years ago
by
Michael Langguth
Browse files
Options
Downloads
Patches
Plain Diff
Create a script to set-up the virtual environment inside a TF1.15 singularity containe.
parent
3438ccb4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
video_prediction_tools/env_setup/install_venv_container.sh
+57
-0
57 additions, 0 deletions
video_prediction_tools/env_setup/install_venv_container.sh
with
57 additions
and
0 deletions
video_prediction_tools/env_setup/install_venv_container.sh
0 → 100644
+
57
−
0
View file @
5c872c4f
#
# __authors__ = Bing Gong, Michael Langguth
# __date__ = '2021_10_28'
# __last_update__ = '2021_10_28' by Michael Langguth
#
# **************** Description ****************
# This auxiliary script sets up the virtual environment within a singularity container.
# **************** Description ****************
# sanity checks
# check if we are running in a container
if
[
-z
"
${
SINGULARITY_NAME
}
"
]
;
then
echo
"ERROR: install_venv_container.sh must be called within a running singularity container."
exit
fi
# check if directory to virtual environment is parsed
if
[[
-z
"
$1
"
]]
;
then
echo
"ERROR: Provide a name to set up the virtual environment."
exit
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."
exit
fi
# check for requirement-file
if
[
!
-d
"
${
BASE_DIR
}
/requirements_container.txt"
]
;
then
echo
"ERROR: Cannot find requirement-file
${
BASE_DIR
}
/requirements_container.txt to set up virtual environment."
exit
fi
BASE_DIR
=
`
pwd
`
VENV_BASE
=
$1
VENV_NAME
=
"
$(
dirname
"
$ENV_SETUP_DIR
"
)
"
VENV_DIR
=
${
VENV_BASE
}
/
${
VENV_NAME
}
# create basic target directory for virtual environment
mkdir
"
${
VENV_BASE
}
"
# Install virtualenv in this directory
pip
install
--target
=
"
${
VENV_BASE
}
/"
virtualenv
# Change into the directory...
cd
"
${
VENV_BASE
}
"
||
exit
# .. to set-up virtual environment therein
python
-m
virtualenv
-p
/usr/bin/python
--system-site-packages
"
${
VENV_NAME
}
"
# Activate virtual environment and install required packages
echo
"Actiavting virtual environment
${
ENV_DIR
}
to install required Python modules..."
source
"
${
VENV_DIR
}
/bin/activate"
pip
install
-r
"
${
BASE_DIR
}
/requirements_container.txt"
# get back to basic directory
cd
"
${
BASE_DIR
}
"
||
exit
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