Pysurfer can be a bit tough to install because the dependencies (e.g., Mayavi) can be tricky to get right. Further, the documentation, at the time of this writing, states that Pysurfer only works with Python 2.7. This is not entirely the case, as Pysurfer does in fact work with Python 3. Here, I've documented the installation steps to get Pysurfer working with Python 3 on OSX (I'm guessing these steps also hold for Linux; not sure about Windows).
Before we begin, you'll need conda installed to create a virtual environment, and you will also need Freesurfer installed on your computer (follow the installation steps for your operating system, as is, here).
Then, let's set up our conda
environment. We'll want to specify Python 3.6 and install some dependencies:
$ conda create -n pysurfer python=3.6 pip mkl numpy scipy matplotlib "pyqt>=5.9" "vtk>8" pygments traits traitsui pyface
Now let's activate the pysurfer
environment, install the remaining dependencies, and finally pysurfer itself:
$ source activate pysurfer
$ pip install mayavi nibabel imageio
$ pip install pysurfer
Once this is done, fire up your python terminal and test out your installation (based on this example):
from surfer import Brain
brain = Brain(subject_id='fsaverage', hemi='lh', surf='inflated')
You should see a brain open up in a new window. With that, you're set!
Special thanks to @rmarkello for coming up with these steps. We hope that these instructions can help save some time and headaches!