nipy / PySurfer

Cortical neuroimaging visualization in Python
https://pysurfer.github.io/
BSD 3-Clause "New" or "Revised" License
243 stars 97 forks source link

How to install pysurfer on Ubuntu 18.04? #254

Closed dfsp-spirit closed 5 years ago

dfsp-spirit commented 6 years ago

What is the recommended way to install pysurfer under Ubuntu 18.04? I tried

pip install pysurfer mayavi

The command completed without errors, but when I run the demo scripts (e.g., python plot_simple.py), I only get an empty VTK window for a split second, then the window closes again and the following message is displayed before the script terminates:

python ~/develop/comp_neuro_science/python_visualization_pysurfer/plot_basics.py 
Basic Visualization
===================

Initialize a basic visualization session.

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  10 (X_UnmapWindow)
  Resource id in failed request:  0x4200018
  Serial number of failed request:  53
  Current serial number in output stream:  55

What am I doing wrong? Should I install from a cloned repo using setup.py instead?

dfsp-spirit commented 6 years ago

I would like to add that I can run the Mayavi examples without problem. E.g., the spherical harmonics example displays perfectly.

Another thread here suggested to add an import mayavi line to the top of pysurfer demo scripts like plot_simple.py under Ubuntu, but that does not have any (visible) effect for me. It still crashes with the message from my last post.

larsoner commented 6 years ago

You deleted the bit about VTK classes that was in your original message, was that invalid?

What is vtk.VTK_VERSION_STRING?

One potential simple problem is that you do python whatever.py instead of python -i whatever.py, so the script simply executes and exits.

If you still get crashes, put import faulthandler; faulthandler.enable() at the top of whatever script you're running. (And if you're on Python 2, you'll want to pip install --user faulthandler first.)

dfsp-spirit commented 5 years ago

Nevermind, this issue was caused by a mix of packages from pip and conda it seems. You can close this.

(I deleted the VTK message part when I got that part resolved.)

I checked it on a fresh virtual machine installation and I can confirm that PySurfer works under Ubuntu 18.04, conda is not even required. I created a virtual environment and then installed via pip.

larsoner commented 5 years ago

Glad you got it working!