Skip to content

Commit cdb4ffe

Browse files
mwaskomlarsoner
authored andcommitted
Updates to install information (#247)
* 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
1 parent d79a650 commit cdb4ffe

File tree

3 files changed

+53
-93
lines changed

3 files changed

+53
-93
lines changed

.circleci/config.yml

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22
jobs:
33
build:
44
docker:
5-
- image: circleci/python:3.6-stretch
5+
- image: circleci/python:3.6-jessie
66
steps:
77
# Get our data and merge with upstream
88
- checkout
@@ -19,32 +19,28 @@ jobs:
1919
- restore_cache:
2020
keys:
2121
- data-cache
22+
- pip-cache
2223

23-
- run: echo "export SUBJECTS_DIR=$HOME/subjects" >> $BASH_ENV
24+
# Fix libgcc_s.so.1 pthread_cancel bug:
25+
# https://github.com/ContinuumIO/anaconda-issues/issues/9190#issuecomment-386508136
26+
# https://github.com/golemfactory/golem/issues/1019
27+
- run: sudo apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 qt5-default
28+
- run: echo "export SUBJECTS_DIR=~/subjects" >> $BASH_ENV
29+
- run: echo "export PATH=~/.local/bin:$PATH" >> $BASH_ENV
30+
- run: echo "export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4200.1" >> $BASH_ENV
31+
# Spin up Xvfb
2432
- run: echo "export DISPLAY=:99" >> $BASH_ENV
2533
- 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;
26-
# Get latest Anaconda running
27-
- run: echo "export PATH=~/miniconda/envs/mne/bin:~/miniconda/bin:$PATH" >> $BASH_ENV
28-
- run:
29-
command: |
30-
wget -q http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O ~/miniconda.sh;
31-
chmod +x ~/miniconda.sh;
32-
~/miniconda.sh -b -p ~/miniconda;
33-
- run:
34-
command: |
35-
conda update --yes --quiet conda;
36-
conda env create --quiet -f environment.yml;
37-
38-
- run: pip install sphinx numpydoc https://api.github.com/repos/sphinx-gallery/sphinx-gallery/zipball/master
39-
# This is a CircleCI-specific fix -- for some reason 5.9.2 is problematic
40-
# here but not on Travis, we get:
41-
#
42-
# libgcc_s.so.1 must be installed for pthread_cancel to work
43-
# Aborted
44-
#
45-
- run: pip install --upgrade --no-deps pyqt5>=5.10
46-
- run: python -c "from mayavi import mlab; import matplotlib.pyplot as plt; mlab.figure(); plt.figure()"
47-
- run: python setup.py develop
34+
# Python env
35+
- 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
36+
- run: pip install -U --user --progress-bar off mayavi
37+
- save_cache:
38+
key: pip-cache
39+
paths:
40+
- "~/.cache/pip"
41+
- run: python setup.py develop --user
42+
# Check libs
43+
- run: LIBGL_DEBUG=verbose python -c "from mayavi import mlab; import matplotlib.pyplot as plt; mlab.figure(); plt.figure()"
4844
- run: echo $SUBJECTS_DIR
4945
- run:
5046
command: |
@@ -56,11 +52,6 @@ jobs:
5652
rm fsaverage_min.zip;
5753
fi;
5854
- run: ls $SUBJECTS_DIR
59-
- run:
60-
command: |
61-
if [[ $(cat build.txt) == "html_dev" ]] || [[ $(cat build.txt) == "html_stable" ]]; then
62-
SUBJECTS_DIR=~/mne_data/MNE-sample-data/subjects python -c "import mne; mne.datasets._download_all_example_data()";
63-
fi;
6455
- 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
6556

6657
- store_artifacts:

doc/install.rst

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,33 @@
55
Installing and Getting Started
66
==============================
77

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

1010
pip install pysurfer
1111

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

14-
pip install -U pysurfer
14+
pip install -U --no-deps pysurfer
1515

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

19-
pip install -U pysurfer[save_movie]
18+
pip install pysurfer[save_movie]
2019

2120
If you'd like to install the development version, you have two options. You can
22-
use pip::
21+
install straight from github::
2322

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

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

29-
python setup.py install
30-
31-
If you don't have pip, you can also install PySurfer with easy_install_, or use
32-
easy_install to get pip.
28+
pip install .
3329

3430
Dependencies
3531
~~~~~~~~~~~~
3632

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

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

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

47-
Some functions also make use of the Python Imaging Library (PIL_), although
48-
it's not mandatory.
49-
50-
An easy option to set up this environment is the Anaconda_ distribution, which
51-
is free and ships with many of the required packages. If you use Anaconda,
52-
you'll need to install Mayavi separately. This can be done using the ``conda``
53-
command::
54-
55-
conda install mayavi
56-
57-
You'll also need to install nibabel, which can be done using ``pip`` as above.
58-
59-
Another option for getting set up is the Enthough Canopy_ environment, which is
60-
similar to Anaconda and free for academic use.
44+
Some input/output functions also make use of the Python Imaging Library (PIL_)
45+
and ``imageio``, although they are not mandatory.
6146

6247
Getting started
6348
~~~~~~~~~~~~~~~
6449

50+
Because PySurfer relies on some complicated dependencies (Mayavi, VTK and a GUI
51+
library), it can be more difficult to get started with than is the case with
52+
other Python libraries. Consider using the Anaconda_ distribution
53+
or Enthough Canopy_ environment. The difficulty on these
54+
platforms is generally getting Mayavi and VTK installed; see their
55+
installation instructions for information.
56+
6557
PySurfer generally works out of the box on Linux systems. Getting started on
66-
OSX can be a bit more difficult. We have had success using the Anaconda
67-
distribution with the additional step of setting the environment variable
68-
``QT_API`` to ``pyqt``::
58+
OSX may be trickier. We have had success using the Anaconda distribution with
59+
the additional step of setting the environment variables ``QT_API`` and ``ETS_TOOLKIT``, e.g.::
6960

7061
export QT_API=pyqt
62+
export ETS_TOOLKIT=qt4
7163

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

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

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

8175
%gui qt
8276

setup.py

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,9 @@
3535
VERSION = version
3636

3737

38-
def check_dependencies():
39-
# nibabel and mayavi are in install_requires
40-
needed_deps = ["numpy", "scipy", "matplotlib"]
41-
missing_deps = []
42-
for dep in needed_deps:
43-
try:
44-
__import__(dep)
45-
except ImportError:
46-
missing_deps.append(dep)
47-
48-
if missing_deps:
49-
missing = ", ".join(missing_deps)
50-
raise ImportError("Missing dependencies: %s" % missing)
51-
52-
5338
if __name__ == "__main__":
5439
if os.path.exists('MANIFEST'):
5540
os.remove('MANIFEST')
56-
57-
import sys
58-
if not (len(sys.argv) >= 2 and ('--help' in sys.argv[1:] or
59-
sys.argv[1] in ('--help-commands',
60-
'--version',
61-
'egg_info',
62-
'clean'))):
63-
check_dependencies()
64-
6541
setup(name=DISTNAME,
6642
maintainer=MAINTAINER,
6743
include_package_data=True,
@@ -76,9 +52,8 @@ def check_dependencies():
7652
classifiers=['Intended Audience :: Science/Research',
7753
'Intended Audience :: Developers',
7854
'Programming Language :: Python :: 2.7',
79-
'Programming Language :: Python :: 3.3',
80-
'Programming Language :: Python :: 3.4',
81-
'Programming Language :: Python :: 3.5',
55+
'Programming Language :: Python :: 3.6',
56+
'Programming Language :: Python :: 3.7',
8257
'License :: OSI Approved',
8358
'Programming Language :: Python',
8459
'Topic :: Software Development',
@@ -91,6 +66,6 @@ def check_dependencies():
9166
platforms='any',
9267
packages=['surfer', 'surfer.tests'],
9368
scripts=['bin/pysurfer'],
94-
install_requires=['nibabel >= 1.2', 'mayavi'],
69+
install_requires=['numpy', 'scipy', 'matplotlib', 'nibabel >= 1.2', 'mayavi'],
9570
extras_require={'save_movie': ['imageio >= 1.5']},
9671
)

0 commit comments

Comments
 (0)