This repo holds a fully standalone python 3.6 virtual environment for executing jobs requiring python3 on Optimus Bamboo shared agents. A "standard" python3 virtual environment still has some dependencies on the python3 installation used to create it.
Differences to a "standard" python3 virtual environment:
- made using
--copiesoption rather than the typical symlinks on linux - includes libpython library
- includes lib/python3.6 folders
- includes activate_ld (modified from activate script) to set LD_LIBRARY_PATH and PYTHONPATH, and adjust hard-wired #! paths in venv scripts
If running under Bamboo shared agent the virtual environment must be activated by executing:
python-venv-centos/env/bin/activate_ld
This will set the relevant environment variables so that python will only resolve needed libraries and modules from within the virtual environment.
- Install python3.x
- Create a new virtual environment in the usual manner, but using the
--copiesoption:python3 -m venv --copies env - Copy the runtime library and python3.x library into the virtual environment (example assumes python3 installed in usual location):
$ cp /lib64/libpython3.6m.so.1.0 env/lib $ cp -r /lib64/python3.6 /env/lib $ cd env/lib $ ln -s libpython3.6m.so.1.0 libpython3.6m.so - Install a copy of activate_ld in the env/bin folder
mv env/bin/activate env/bin/activate-ORIG (cd env/bin; ln -s activate_ld activate)