Snippets

Glotzer Group Plato Dependency Installation Tips

Updated by Matthew Spellings

File README.md Modified

  • Ignore whitespace
  • Hide word diff
 
 ```shell
 jupyter nbextension enable --py --sys-prefix widgetsnbextension
-```
+```
+
+### Vispy and Qt
+
+Vispy can use a number of python qt wrapper backends. If you're using PySide, for example, you will need to install qt version 4 instead of 5 using your OS package manager or conda.
Updated by Matthew Spellings

File README.md Modified

  • Ignore whitespace
  • Hide word diff
 Install jupyter and its dependencies, forcing it to be installed within the environment (an externally-installed jupyter may not have the kernel set up to work inside the virtual environment, for example); note that vispy doesn't currently work with ipywidgets 7 or greater:
 
 ```shell
-pip install -I jupyter ipywidgets==6.0.0                                                                                  
+pip install -I jupyter ipywidgets==6.0.0
+jupyter nbextension enable --py --sys-prefix widgetsnbextension
 ```
 
 Finally, install plato and any other dependencies:
Updated by Matthew Spellings

File README.md Modified

  • Ignore whitespace
  • Hide word diff
 ```shell
 mkdir -p ~/env
 python -m venv --system-site-packages ~/env/plato
+# this line is needed each time you wish to use the packages installed here
 source ~/env/plato/bin/activate
 ```
 
 
 ```shell
 pip install matplotlib vispy plato-draw
+```
+
+### Possible additional steps for jupyter notebooks
+
+The instructions above should suffice for environments that began with a "clean slate." If other installations of any of the components exist, however, they can sometimes interfere with finding the correct versions that were just installed by these instructions. As a first step, make sure that the just-installed version of the python packages are found using something like this inside a notebook:
+
+```python
+import sys
+print(sys.executable)
+
+import importlib
+for name in ['ipywidgets', 'widgetsnbextension', 'vispy', 'plato']:
+    m = importlib.import_module(name)
+    print('{}: {}'.format(name, m.__file__))
+```
+
+If a python executable that is not the one inside the virtualenv is found, you may need to remove an old kernel specification:
+
+```shell
+jupyter kernelspec remove python3
+python -m ipykernel install --sys-prefix
+```
+
+If the ipywidgets javascript is still not found correctly, you may have an old or external version of ipywidgets; in that case, just enable the updated kernel extension:
+
+```shell
+jupyter nbextension enable --py --sys-prefix widgetsnbextension
 ```
Updated by Julia Dshemuchadse

File README.md Modified

  • Ignore whitespace
  • Hide word diff
 
 ## Pip installation (virtualenv)
 
-If We **strongly** encourage the use of virtual environments with plato as opposed to installing into your home directory (`python setup.py install --user` or `pip install -e`). This is because of how easy it is to mix inconsistent versions of jupyter kernels, ipywidgets, the notebook extension, and vispy if you have cruft from other installations lying around. This method will use the system site-packages directory as a base, in case you want to use versions of (for example) `pyside`, `numpy`, `tensorflow`, or other packages that are installed by your package manager. First set up the environment:
+We **strongly** encourage the use of virtual environments with plato as opposed to installing into your home directory (`python setup.py install --user` or `pip install -e`). This is because of how easy it is to mix inconsistent versions of jupyter kernels, ipywidgets, the notebook extension, and vispy if you have cruft from other installations lying around. This method will use the system site-packages directory as a base, in case you want to use versions of (for example) `pyside`, `numpy`, `tensorflow`, or other packages that are installed by your package manager. First set up the environment:
 
 ```shell
 mkdir -p ~/env
Updated by Matthew Spellings

File README.md Modified

  • Ignore whitespace
  • Hide word diff
 Finally, install plato and any other dependencies:
 
 ```shell
-pip install matplotlib plato-draw
+pip install matplotlib vispy plato-draw
 ```
  1. 1
  2. 2
  3. 3
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.