Example 1: Installing PyTorch using the PythonPip module
Introduction
The module PythonPip
allows you to install additional Python packages to be used in MeVisLab.
The module either allows to install packages into the global MeVisLab installation directory, or into your defined user package. We will use the user package directory, because then the installed packages remain available in your packages even if you uninstall or update MeVisLab. In addition to that, no administrative rights are necessary if you did install MeVisLab for all users.
PythonPip
module requires administrative rights if you do not install into a user package. In addition to that, the installed packages are removed when uninstalling MeVisLab.Steps to do
The PythonPip module
Add a PythonPip
module to your workspace.
Double-click the module and inspect the panel.
The panel shows all currently installed Python packages including their version and the MeVisLab package they are saved in. You can see a warning that the target package is set to read-only in case you are selecting a MeVisLab package. Changing to one of your user packages (see Example 2.1: Package creation for details) makes the warning disappear.
PythonPip
module can be found in Example 4: Install additional Python packages via PythonPip module.Install torch and torchvision
For our tutorials, we need to install torch and torchvision. Enter torch torchvision into the Command textbox and press Install.
Continuing with CUDA support:
Command
torch torchvision --index-url https://download.pytorch.org/whl/cu117
If you are behind a proxy server, you may have to set the HTTP_PROXY and HTTPS_PROXY environment variables to the hostname and port of your proxy. These are used by pip when accessing the internet.
Alternatively you can also add a parameter to pip install command: –proxy https://proxy:port
After clicking Install, the pip console output opens and you can follow the process of the installation.
After the installation was finished with exit code 0, you should see the new packages in the PythonPip
module.
Summary
- PyTorch can be installed using the
PythonPip
module. - There are different versions available (CPU and GPU) depending on the hardware that is used
- Additional steps have to be taken depending on the version one wishes to install
- The module displays newly installed packages as soon as the installation was successful