Installing additional Python packages


Arbitrary third-party Python packages can be added to the MeVisLab Python environment using pip (package installer tool for Python).

The recommended way to install Python packages is through the PythonPip module in MeVisLab. The help to this module also describes some limitations regarding the installation of packages that are using C extensions.

[Note]Note

On Windows, if you installed MeVisLab in the default location, you need to be administrator to install Python packages.

You should do this with a freshly started MeVisLab, since DLLs loaded from used Python packages can't be updated.

Installing Python packages from the command line

It is also possible to install Python packages from the command line. You need to use the Python executable delivered with the MeVisLab installation for this.

Example instructions for installing PyTorch on Windows

  1. Open a command prompt as administrator

  2. Go to: <installation_directory>\Packages\MeVis\ThirdParty\Python.

    If you have only one MeVisLab version installed you should be able to do

    cd %MLAB_ROOT%\MeVis\ThirdParty\Python
  3. Run one of the following commands:

    • Newest CPU-only version:

      MeVisPython -m pip install torch torchvision 
    • PyTorch 1.10.0 for CUDA 10.2 (adapt to your desired version):

      MeVisPython -m pip install torch==1.10.0+cu102 torchvision==0.11.1+cu102 -f https://download.pytorch.org/whl/cu102/torch_stable.html
  4. If your network environment requires a proxy use the --proxy argument. E.g.

    MeVisPython -m pip install --proxy http://<proxy_location>:<proxy_port> torch torchvision 

    Or set the http_proxy and https_proxy environment variables to the same effect.

[Note]Note

You can execute the same installation instructions with the PythonPip module by copying everything after "install" in the above instructions into the top-most input field.

Example instructions for installing PyTorch on Linux

  1. The instructions for Linux are very similar to Windows. The default installation folder usually just doesn't need administrator rights.

  2. Go to: <installation_directory>/Packages/MeVis/ThirdParty/Python/Release/bin.

    (This only installs this for the Release mode of MeVisLab. If needed, you can repeat the steps also the in the Debug directory: <installation_directory>/Packages/MeVis/ThirdParty/Python/Debug/bin.

  3. Run command:

    ./MeVisPython -m pip install torch torchvision 

    (The only difference to Windows is prepending "./" to execute MeVisPython from the current directory.

  4. If you need to use a proxy, the required environment variables are perhaps already set, otherwise the same instructions as for Windows apply.