enthought / chaco

Chaco is a Python package for building interactive and custom 2-D plots.
http://docs.enthought.com/chaco/
Other
292 stars 99 forks source link

Chaco demonstration fails macOS Python 3.7 #836

Closed JohnMarohn closed 1 year ago

JohnMarohn commented 1 year ago

Problem Description:

Chaco demonstration in "Application-oriented plotting" in http://docs.enthought.com/chaco/user_manual/chaco_tutorial.html fails in macOS 12.5.1 running Python 3.7.13.

Reproduction Steps:

Install traitsui, traits, mayavi using conda and install chaco using pip. Conda chooses Python 3.7 to meet all the conflicting requirements.

conda create -n enthought python traitsui, traits, mayavi conda activate enthought pip install chaco

This installation results in the following package versions

chaco 5.0.0 pypi_0 pypi enable 5.3.1 pypi_0 pypi pyface 7.3.0 py37hecd8cb5_1
traits 6.2.0 py37h9ed2024_0
traitsui 7.2.1 pyhd3eb1b0_0

The following import fails

python -c "from chaco.api import Plot"

with the error message

Traceback (most recent call last): File "", line 1, in File "/Users/jam99/opt/anaconda3/envs/enthought/lib/python3.7/site-packages/chaco/api.py", line 314, in from .plots.horizon_plot import BandedMapper File "/Users/jam99/opt/anaconda3/envs/enthought/lib/python3.7/site-packages/chaco/plots/horizon_plot.py", line 14, in from enable.api import transparent_color_trait File "/Users/jam99/opt/anaconda3/envs/enthought/lib/python3.7/site-packages/enable/api.py", line 200, in from .enable_traits import ( File "/Users/jam99/opt/anaconda3/envs/enthought/lib/python3.7/site-packages/enable/enable_traits.py", line 18, in from enable.trait_defs.kiva_font_trait import KivaFont File "/Users/jam99/opt/anaconda3/envs/enthought/lib/python3.7/site-packages/enable/trait_defs/kiva_font_trait.py", line 13, in from pyface.font import Font as PyfaceFont ModuleNotFoundError: No module named 'pyface.font'

Expected behavior:

The import should work without error.

OS, Python version:

macOS 12.5.1 Python 3.7.13

JohnMarohn commented 1 year ago

Hypothesized that installing traits, traitui, and mayavi using conda but installing chaco by pip was causing problems. Bite the bullet and carry out the installation using the Enthought Deployment Manager (EDM). Running macOS 12.5.1. To verify the EDM installation

$ edm --version
EDM 3.4.0 from /opt/edm/bin/../libexec/edm (cpython 3.6.13)

Create a new environment called enthought with the desired packages installed

$ edm install traits, traitsui, mayavi, chaco, pandas -e enthought

Switch to the new environment, verify the installation, and exit.

$ edm shell -e enthought
$ python --version
Python 3.6.13 -- Enthought, Inc. (x86_64)
$ python -c "import traits; import traitsui; import chaco; import mayavi"
$ python -c "from chaco.api import Plot"
$ exit

The import thing to note is that running from chaco.api import Plot in the new environment now succeeds.

In conclusion, installing chaco (and traits, traitui, mayavi) using the Enthought Deployment Manager seemed to solve the problem.