Skip to content

Commit

Permalink
Updates to install information (#247)
Browse files Browse the repository at this point in the history
* Updates to install information

Closes #246

* FIX: pip command

* FIX: install_requires

* DOC: Anaconda

* FIX: no-deps

* FIX: Reorder

* FIX: CircleCI

* FIX: export

* FIX: Deps
  • Loading branch information
mwaskom authored and larsoner committed Jul 12, 2018
1 parent d79a650 commit cdb4ffe
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 93 deletions.
49 changes: 20 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: circleci/python:3.6-stretch
- image: circleci/python:3.6-jessie
steps:
# Get our data and merge with upstream
- checkout
Expand All @@ -19,32 +19,28 @@ jobs:
- restore_cache:
keys:
- data-cache
- pip-cache

- run: echo "export SUBJECTS_DIR=$HOME/subjects" >> $BASH_ENV
# Fix libgcc_s.so.1 pthread_cancel bug:
# https://github.com/ContinuumIO/anaconda-issues/issues/9190#issuecomment-386508136
# https://github.com/golemfactory/golem/issues/1019
- run: sudo apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 qt5-default
- run: echo "export SUBJECTS_DIR=~/subjects" >> $BASH_ENV
- run: echo "export PATH=~/.local/bin:$PATH" >> $BASH_ENV
- run: echo "export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4200.1" >> $BASH_ENV
# Spin up Xvfb
- run: echo "export DISPLAY=:99" >> $BASH_ENV
- run: /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render -noreset;
# Get latest Anaconda running
- run: echo "export PATH=~/miniconda/envs/mne/bin:~/miniconda/bin:$PATH" >> $BASH_ENV
- run:
command: |
wget -q http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O ~/miniconda.sh;
chmod +x ~/miniconda.sh;
~/miniconda.sh -b -p ~/miniconda;
- run:
command: |
conda update --yes --quiet conda;
conda env create --quiet -f environment.yml;
- run: pip install sphinx numpydoc https://api.github.com/repos/sphinx-gallery/sphinx-gallery/zipball/master
# This is a CircleCI-specific fix -- for some reason 5.9.2 is problematic
# here but not on Travis, we get:
#
# libgcc_s.so.1 must be installed for pthread_cancel to work
# Aborted
#
- run: pip install --upgrade --no-deps pyqt5>=5.10
- run: python -c "from mayavi import mlab; import matplotlib.pyplot as plt; mlab.figure(); plt.figure()"
- run: python setup.py develop
# Python env
- run: pip install -U --user --progress-bar off numpy scipy matplotlib vtk PyQt5 sip PyQt5-sip nibabel sphinx numpydoc pillow imageio https://api.github.com/repos/sphinx-gallery/sphinx-gallery/zipball/master
- run: pip install -U --user --progress-bar off mayavi
- save_cache:
key: pip-cache
paths:
- "~/.cache/pip"
- run: python setup.py develop --user
# Check libs
- run: LIBGL_DEBUG=verbose python -c "from mayavi import mlab; import matplotlib.pyplot as plt; mlab.figure(); plt.figure()"
- run: echo $SUBJECTS_DIR
- run:
command: |
Expand All @@ -56,11 +52,6 @@ jobs:
rm fsaverage_min.zip;
fi;
- run: ls $SUBJECTS_DIR
- run:
command: |
if [[ $(cat build.txt) == "html_dev" ]] || [[ $(cat build.txt) == "html_stable" ]]; then
SUBJECTS_DIR=~/mne_data/MNE-sample-data/subjects python -c "import mne; mne.datasets._download_all_example_data()";
fi;
- run: cd doc && sphinx-build -D plot_gallery=1 -D sphinx_gallery_conf.filename_pattern=^\(\(?\!plot_fmri_activation_volume\|plot_morphometry\|plot_label\.py\|plot_probabilistic_label\|plot_resting_correlations\|plot_transparent_brain\|rotate_animation\|save_movie\|save_views\).\)*\$ -b html -d _build/doctrees . _build/html

- store_artifacts:
Expand Down
66 changes: 30 additions & 36 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,33 @@
Installing and Getting Started
==============================

Installing PySurfer is quite simple with pip_::
PySurfer can be installed with pip_. Note that the package name on PyPi is different from the library name that you import::

pip install pysurfer

If you already have PySurfer installed, you can also use pip to update it::

pip install -U pysurfer
pip install -U --no-deps pysurfer

If you would like to save movies of time course data, also include the
optional dependency `imageio` with::
If you would like to save movies of time course data, it is necessary to include the optional dependency ``imageio`` with::

pip install -U pysurfer[save_movie]
pip install pysurfer[save_movie]

If you'd like to install the development version, you have two options. You can
use pip::
install straight from github::

pip install git+git://github.com/nipy/pysurfer.git#egg=pysurfer
pip install https://api.github.com/repos/nipy/PySurfer/zipball/master

Or you can clone the `git repository <https://github.com/nipy/PySurfer>`_ and
install from the source directory::
install from your local source directory::

python setup.py install

If you don't have pip, you can also install PySurfer with easy_install_, or use
easy_install to get pip.
pip install .

Dependencies
~~~~~~~~~~~~

PySurfer requires Python 2.7, and it does not work on Python 3.
PySurfer works on Python 2.7 and 3.6+.
(Older Python 3 versions will probably work, but are not tested.)

To use PySurfer, you will need to have the following Python packages:

Expand All @@ -44,39 +41,36 @@ To use PySurfer, you will need to have the following Python packages:
* mayavi_
* matplotlib_

Some functions also make use of the Python Imaging Library (PIL_), although
it's not mandatory.

An easy option to set up this environment is the Anaconda_ distribution, which
is free and ships with many of the required packages. If you use Anaconda,
you'll need to install Mayavi separately. This can be done using the ``conda``
command::

conda install mayavi

You'll also need to install nibabel, which can be done using ``pip`` as above.

Another option for getting set up is the Enthough Canopy_ environment, which is
similar to Anaconda and free for academic use.
Some input/output functions also make use of the Python Imaging Library (PIL_)
and ``imageio``, although they are not mandatory.

Getting started
~~~~~~~~~~~~~~~

Because PySurfer relies on some complicated dependencies (Mayavi, VTK and a GUI
library), it can be more difficult to get started with than is the case with
other Python libraries. Consider using the Anaconda_ distribution
or Enthough Canopy_ environment. The difficulty on these
platforms is generally getting Mayavi and VTK installed; see their
installation instructions for information.

PySurfer generally works out of the box on Linux systems. Getting started on
OSX can be a bit more difficult. We have had success using the Anaconda
distribution with the additional step of setting the environment variable
``QT_API`` to ``pyqt``::
OSX may be trickier. We have had success using the Anaconda distribution with
the additional step of setting the environment variables ``QT_API`` and ``ETS_TOOLKIT``, e.g.::

export QT_API=pyqt
export ETS_TOOLKIT=qt4

If you're using Canopy, you need to do something similar with the
``ETS_TOOLKIT`` variable::
The values you set should match the GUI library you are using.

export ETS_TOOLKIT=qt4
You may wish to consult the `Mayavi installation docs
<http://docs.enthought.com/mayavi/mayavi/installation.html>`_ if you are having
trouble getting things working.

If you want to use PySurfer interactively, you should do so in ipython_. After
starting ipython (either in the terminal, qtconsole, or notebook), you have to
activate the correct GUI backend, which is probably qt::
If you are using PySurfer interactively in IPython_/Jupyter, you should
activate one of the GUI event loops so that the Mayavi window runs in a
separate process. After starting IPython (either in the terminal, qtconsole, or
notebook), you have to activate the correct GUI backend, which is probably qt::

%gui qt

Expand Down
31 changes: 3 additions & 28 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,9 @@
VERSION = version


def check_dependencies():
# nibabel and mayavi are in install_requires
needed_deps = ["numpy", "scipy", "matplotlib"]
missing_deps = []
for dep in needed_deps:
try:
__import__(dep)
except ImportError:
missing_deps.append(dep)

if missing_deps:
missing = ", ".join(missing_deps)
raise ImportError("Missing dependencies: %s" % missing)


if __name__ == "__main__":
if os.path.exists('MANIFEST'):
os.remove('MANIFEST')

import sys
if not (len(sys.argv) >= 2 and ('--help' in sys.argv[1:] or
sys.argv[1] in ('--help-commands',
'--version',
'egg_info',
'clean'))):
check_dependencies()

setup(name=DISTNAME,
maintainer=MAINTAINER,
include_package_data=True,
Expand All @@ -76,9 +52,8 @@ def check_dependencies():
classifiers=['Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'License :: OSI Approved',
'Programming Language :: Python',
'Topic :: Software Development',
Expand All @@ -91,6 +66,6 @@ def check_dependencies():
platforms='any',
packages=['surfer', 'surfer.tests'],
scripts=['bin/pysurfer'],
install_requires=['nibabel >= 1.2', 'mayavi'],
install_requires=['numpy', 'scipy', 'matplotlib', 'nibabel >= 1.2', 'mayavi'],
extras_require={'save_movie': ['imageio >= 1.5']},
)

0 comments on commit cdb4ffe

Please sign in to comment.