Conflict vmtk with OpenGL/Mesa in NVIDIA graphics card

Hi Dears 3DSlicer and VMTK Developers and Users

At first I must mention that I stated my problem at vmtk-mailing-list unfortunately I do not get any guidance; Maybe I’m in a hurry. :blush:
Anyway I state my problem. I hope that you guide me.

I installed vmtk using Anaconda with the following commands:

sn@sn-P41T-D3P:~$ python --version
Python 2.7.17rc1
sn@sn-P41T-D3P:~$
sn@sn-P41T-D3P:~$ conda install anaconda-client
...
sn@sn-P41T-D3P:~$ conda update conda anaconda-client
...
sn@sn-P41T-D3P:~$ conda config --set restore_free_channel true
...
sn@sn-P41T-D3P:~$ conda create -n myVMTK -c vmtk python=3.6 itk vtk vmtk
...
sn@sn-P41T-D3P:~$ conda activate myVMTK
(myVMTK) sn@sn-P41T-D3P:~$ python --version
Python 3.6.1 :: Continuum Analytics, Inc.
(myVMTK) sn@sn-P41T-D3P:~$

After doing it, I want to view Aorta_voi.mha file in vmtk-tutorials with the following command:

(myVMTK) sn@sn-P41T-D3P:~$ cd vmtk-tutorials/
(myVMTK) sn@sn-P41T-D3P:~/vmtk-tutorials$ vmtkimagereader -ifile Aorta_voi.mha --pipe vmtkimageviewer
Automatic piping vmtkimagereader
Parsing options vmtkimagereader
    InputFileName = Aorta_voi.mha
Explicit piping vmtkimagereader
Input vmtkimagereader members:
    Id = 0
    Disabled = 0
    Format =
    GuessFormat = 1
    UseITKIO = 1
    Image = 0
    InputFileName = Aorta_voi.mha
    InputFilePrefix =
    InputFilePattern =
    DataExtent = [-1, -1, -1, -1, -1, -1]
    HeaderSize = 0
    DataSpacing = [1.0, 1.0, 1.0]
    DataOrigin = [0.0, 0.0, 0.0]
    DesiredOrientation = native
    DataByteOrder = littleendian
    DataScalarType = float
    FileDimensionality = 3
    Flip = [0, 0, 0]
    AutoOrientDICOMImage = 1
    ImageOutputFileName =
Executing vmtkimagereader ...
Spacing 0.878906 0.878906 1.500090
Origin 156.445000 24.609400 0.000000
Dimensions 157 393 34
Done executing vmtkimagereader.
Output vmtkimagereader members:
    Id = 0
    Image = vtkImageData
    RasToIjkMatrixCoefficients = [1.137778101412438, -0.0, 0.0, -177.99969507546882, -0.0, 1.137778101412438, -0.0, -28.000036408899245, 0.0, -0.0, 0.6666266690665227, -0.0, -0.0, 0.0, -0.0, 1.0]
    XyzToRasMatrixCoefficients = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]

Automatic piping vmtkimageviewer
    Image = vmtkimagereader-0.Image
Parsing options vmtkimageviewer
Explicit piping vmtkimageviewer
Input vmtkimageviewer members:
    Id = 0
    Disabled = 0
    Image = vtkImageData
    ImageInputFileName =
    ArrayName =
    vmtkRenderer = None
    WindowLevel = [0.0, 0.0]
    Display = 1
    Margins = 0
    TextureInterpolation = 1
    ContinuousCursor = 0
    ImageOutputFileName =
Executing vmtkimageviewer ...
ERROR: In ../Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 797
vtkOSOpenGLRenderWindow (0x2138a60): GL version 2.1 with the gpu_shader4 extension is not supported by your graphics driver but is required for the new OpenGL rendering backend. Please update your OpenGL driver. If you are using Mesa please make sure you have version 10.6.5 or later and make sure your driver in Mesa supports OpenGL 3.2.

(myVMTK) sn@sn-P41T-D3P:~/vmtk-tutorials$

As mentioned above, I get error message about OpenGL and Mesa.

I must mentioned that I have Ubuntu 19.4 (Ubuntu Eoan Ermine).

sn@sn-P41T-D3P:~$ uname --all
Linux sn-P41T-D3P 5.3.0-18-generic #19-Ubuntu SMP Tue Oct 8 20:14:06 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
sn@sn-P41T-D3P:~$

As mentioned in the following web page, I think that it is occurred due to “Conflict MESA with NVIDIA card”.
Title: How to: Mesa on ubuntu 19.04 - Ask Ubuntu
Address: https://askubuntu.com/questions/1135653/how-to-mesa-on-ubuntu-19-04

As mentioned in this site that:
"Proprietary graphics drivers (e.g. Nvidia GeForce driver and Catalyst) replace all of Mesa, providing their own implementation of a graphics API."

Then I switch from nvidia to Nouveau as mentioned in the following web page:
Address: How to switch from nvidia to nouveau drivers on ubuntu 18.04 - Ask Ubuntu
Title: https://askubuntu.com/questions/1032357/how-to-switch-from-nvidia-to-nouveau-drivers-on-ubuntu-18-04

Befor doing it:

(base) sn@sn-P41T-D3P: ~$ glxinfo | grep "OpenGL version"
OpenGL version string: 3.3.0 NVIDIA 340.107
(base) sn@sn-P41T-D3P: ~$

After doing it (switching):

(base) sn@sn-P41T-D3P: ~$ glxinfo | grep "OpenGL version"
OpenGL version string: 3.3 (Compatibility Profile) Mesa 19.2.1
(base) sn@sn-P41T-D3P:~$

However, this error still exists and I get same error.
Please guide me.
Thank a lot.
Shahrokh.

Does Slicer run correctly on this computer? You can then install VMTK by installing SlicerVMTK extension and do all necessary visualization in Slicer.

Thanks a lot for your guidance. Yes I can run 3dslicer without problem but I want to use vmtk commands in the terminal, then I must install vmtk.

I think that my problem is occurred by the version of Anaconda. I installed Anaconda 2019.07 with Python 3.7.

Do you also confirm that this prevents vmtk installation?

You can use vmtk Python classes from PythonSlicer Python console or Slicer’s built-in Python console. I cannot help with Anaconda build system issues.