Usage
It is also possible to run the toolbox on a VDI (Virtual Desktop Infrastructure) to process video files remotely by either using the browser or your private machine (recommended).
According to your needs, you can:
- Set up a virtual environment and install the toolbox on the VDI
- Use a pre-installed virtual environment in the Felles Drive
Set up a virtual environment and install the toolbox on the VDI
Creating a virtual environment
Open a terminal on the VDI and verify that Python is installed by checking its version.
python –V
The version of Python should be displayed as follow if it is correctly installed on the VDI.
If not, you can download the Ananconda distribution and follow the installation guidelines. You cannot install Python as it will require some Admin authorization.
Next, create a virtual environment, decide upon a directory where you want to place it, and run the venv module as a script with the directory path.
python –m venv my-toolbox
This will create the
my-toolbox
directory if it doesn’t exist, and also create directories inside it containing a copy of the Python interpreter and various supporting files. By default, your virtual machine Desktop is located in the M: drive. However, if your terminal opens in another drive, it is preferable to change the directory to it by typing m: in the terminal.
Once you’ve created a virtual environment, you may activate it.
my-toolbox\Scripts\activate.bat
Activating the virtual environment will change your terminal to show what virtual environment you’re using, and modify the environment so that running
python
will get you that particular version and installation of Python. For example:
(my-toolbox) M:> python Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32 >>>
Install the MGT-python package with pip
Now you can install, upgrade, and remove packages using a program called pip. By default pip will install packages from the Python Package Index
You can install the latest version of the musicalgestures package with pip:
pip install musicalgestures
Install Jupyter Notebook
Finally, you can either work through the terminal or install the Jupyter Notebook package.
pip install jupyter notebook
After installing the package, you just need to type jupyter notebook in the terminal to automatically start a notebook session in your browser.
Use a pre-installed virtual environment in the Felles Drive
Accessing the Felles Drive
The Felles drive is located in the "lagringshotell" which is UiO's network-attached storage (NAS) where we store research data. It is secure for green, yellow, and red data (color classification guide and storage guide). Access differs depending on how you are connected to the network. This is a secure drive so permissions must be given for new users. Contact Kayla for help with access.
Activate the virtual environment in the Felles Drive
To activate the virtual environment in the Felles Drive you need to change the directory to the R: drive (Felles Drive) by typing r: in the terminal. Then, you can access the project folder.
cd project
Once there, you may activate the virtual environment with the toolbox pre-installed.
MGT-python\Scripts\activate.bat
Finally, you can either type jupyter notebook in the command line (if you want to work using a notebook) and create a new folder for your project.
Or continue in the terminal by creating a new folder for your project, and type python.
mkdir my_project