Installation Instructions for the PhoSim Visualizer

The PhoSim visualizer requires the installation of the python package mayavi, which can be difficult. The following is the instructions for Linux. (Instructions for MacOS will come later.)

Visualizer Troubleshooting ( Tested on Ubuntu 18 and 20) 

• Create conda environment to install mayavi with python 3.7 (Other python versions might work but not tested)

conda create -y -n phosim_pyenv python=3.7 

conda activate phosim_pyenv

• Install the required packages for visualizer (numpy, mayavi ,PyQt5 and astropy). 

pip install numpy

pip install mayavi

pip install PyQt5

pip install astropy

If this fails see Additional Points section.

• We also need to set the following variables 

export ETS_TOOLKIT=qt4

export QT_API=pyqt5

You might need to put these in bashrc so that these are automatically set every time you boot your PC

• Now install phosim in this environment. Installing PhoSim in a different environment and then activating this environment will not work. You might also need to activate this environment every time you want phosim vizualizer to work To test your installation do the following 



./phosim examples/star -c examples/nobackground --visualize

Additional Points(if the above is not working):

• Sometimes the above fails because the vtk version installed when installing mayavi is too new. Try the following instead of step 2. You might also need to install numba

  pip install numpy

  pip install numba==0.53

   pip install PyQt5  

   pip install VTK==8.1.2

   pip install mayavi

pip install astropy