-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Out-of-sequence Viewer imports #467
Comments
Strangely, after purging both Mayavi and Matplotlib from the machine and re-installing through the conda package manager, neither are explicitly listed in the >>> print pkg_resources.working_set.entries
[
'',
'$ANACONDA/lib/python2.7/site-packages/Cython-0.22.1.egg',
'$ANACONDA/lib/python2.7/site-packages/scikit_fmm-0.0.6.egg',
'$ANACONDA/lib/python2.7/site-packages/mock-1.3.0.egg',
'$ANACONDA/lib/python2.7/site-packages/nose-1.3.7.egg',
'$ANACONDA/lib/python2.7/site-packages/pyparsing-2.0.3.egg',
'$ANACONDA/lib/python2.7/site-packages/python_dateutil-2.4.2.egg',
'$ANACONDA/lib/python2.7/site-packages/six-1.9.0.egg',
'$ANACONDA/lib/python2.7/site-packages/funcsigs-0.4.egg',
'$ANACONDA/lib/python2.7/site-packages/pbr-1.3.0.egg',
'$ANACONDA/lib/python2.7/site-packages/pylsmlib-0.1.egg',
'$ANACONDA/lib/python2.7/site-packages/traclinks-0.1.dev20150922.egg',
'$ANACONDA/lib/python2.7/site-packages/tqdm-1.0.egg',
'~/Downloads/fipy',
'$ANACONDA',
'$ANACONDA/lib/python27.zip',
'$ANACONDA/lib/python2.7',
'$ANACONDA/lib/python2.7/plat-linux2',
'$ANACONDA/lib/python2.7/lib-tk',
'$ANACONDA/lib/python2.7/lib-old',
'$ANACONDA/lib/python2.7/lib-dynload',
'~/.local/lib/python2.7/site-packages',
'$ANACONDA/lib/python2.7/site-packages/Sphinx-1.3.1.egg',
'$ANACONDA/lib/python2.7/site-packages/setuptools-18.3.2.egg',
'$ANACONDA/lib/python2.7/site-packages',
'$ANACONDA/lib/python2.7/site-packages/wx-3.0-gtk2',
'$ANACONDA/lib/python2.7/site-packages/IPython/extensions'
] This suggests that both viewers would be found in the |
Fixed by #469 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The generic Viewer constructor (defined in
fipy/viewers/__init__.py
) works as advertised -- it imports the first viewer it discovers that can handle the variable's dimensionality -- but perhaps not as expected, i.e. Matplotlib before Mayavi.In setup.py, the entry_points are ordered (matplotlib, mayavi), and the FiPy documentation implies that MatplotlibViewer should be called unless the problem is 3-D. However, the Viewer() constructor uses
pkg_resources.iter_entry_points
, which places no guarantees on the order in which entry points are yielded. Its documentation (https://pythonhosted.org/setuptools/pkg_resources.html#entry-points) suggests entry points are yielded in the order they are found onsys.path
, which is environment- and system-dependent.This issue cropped up (and is reproducible) on two Linux machines with FiPy installed in conda environments using Python 2.7. If both matplotlib (1.4.3) and mayavi (4.4.0) are installed using the conda package manager, the mayavi entry point is yielded first:
In this order, even 1-D examples open Mayavi to display results. This occurs despite the correct sequence in setup.py and the entry_points.txt it generates:
On these machines, removing mayavi from the conda environment and re-installing it through the operating system's package manager (i.e., dpkg) resolves the problem, but in the clumsiest possible way.
The text was updated successfully, but these errors were encountered: