Skip to content
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

Choco on windows, Python38, example does not work #831

Open
Jonas231 opened this issue Jun 10, 2022 · 4 comments
Open

Choco on windows, Python38, example does not work #831

Jonas231 opened this issue Jun 10, 2022 · 4 comments
Assignees

Comments

@Jonas231
Copy link

Jonas231 commented Jun 10, 2022

Hello,
I have this problem (the code had worked before, but now it does not work anymore):

Problem Description

When I execute the below python code example from your documentation page. I get this error message:

File "C:\Users\herbst\raypier_optics\test_chaco.py", line 10, in <module>
    from chaco.api import Plot, ArrayPlotData

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\chaco\api.py", line 343, in <module>
    from chaco.overlays.api import (

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\chaco\overlays\api.py", line 63, in <module>
    from chaco.overlays.layers.api import (

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\chaco\overlays\layers\api.py", line 11, in <module>
    from .status_layer import ErrorLayer, StatusLayer, WarningLayer

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\chaco\overlays\layers\status_layer.py", line 17, in <module>
    from enable.savage.svg.document import SVGDocument

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\enable\savage\svg\document.py", line 27, in <module>
    from . import css

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\enable\savage\svg\css\__init__.py", line 10, in <module>
    from .transform import transformList

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\enable\savage\svg\css\transform.py", line 18, in <module>
    from enable.savage.svg.pathdata import number, maybeComma

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\enable\savage\svg\pathdata.py", line 117, in <module>
    lineTo = Group(Command("L") + Arguments(coordinatePairSequence))

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\enable\savage\svg\pathdata.py", line 29, in Command
    return CaselessPreservingLiteral(char)

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\enable\savage\svg\pathdata.py", line 43, in __init__
    self.name = "'%s'" % matchString

AttributeError: can't set attribute

Reproduction Steps:
I used "pip install chaco" and "pip install --upgrade chaco" to install chaco.

from numpy import linspace, sin
from traits.api import HasTraits, Instance
from traitsui.api import View, Item
from chaco.api import Plot, ArrayPlotData
from enable.api import ComponentEditor

class LinePlot(HasTraits):
    plot = Instance(Plot)

    traits_view = View(
        Item('plot', editor=ComponentEditor(), show_label=False),
        width=500,
        height=500,
        resizable=True,
        title="Chaco Plot",
    )

    def _plot_default(self):
        x = linspace(-14, 14, 100)
        y = sin(x) * x**3
        plotdata = ArrayPlotData(x=x, y=y)

        plot = Plot(plotdata)
        plot.plot(("x", "y"), type="line", color="blue")
        plot.title = "sin(x) * x^3"
        return plot

if __name__ == "__main__":
    LinePlot().configure_traits()

Expected behavior:

I had hoped the example would work

OS, Python version: [Enter OS name and Python version]
Python 3.8.12 , Windows 10

Best regards,
Jonas

@Jonas231
Copy link
Author

These are the versions that I am using:
chaco 5.0.0 1 dbanas
enable 5.2.1 py38h4da3286_2 dbanas

@JohnMarohn
Copy link

The same Chaco demo crashes in macOS too.

Traceback (most recent call last):
File "chaco_test.py", line 4, in
from chaco.api import Plot, ArrayPlotData
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'

@JohnMarohn
Copy link

JohnMarohn commented Sep 17, 2022

Fails in Python 3.7 on macOS too.

macOS 12.5.1
Python 3.7.13

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

Installation method:

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

To reproduce the error, it is enough to try to import Plot from the chaco api

python -c "from chaco.api import Plot"

which gives the error

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'

@homosapien-lcy homosapien-lcy self-assigned this Mar 16, 2023
@corranwebster
Copy link
Contributor

I can't reproduce with current main branch of Chaco, but there have been a number of improvements towards installing using pip.

For the PyfaceFont issue, it looks like your version of Pyface is too old - try Pyface 7.4.x (you will need to wait until the next Chaco release to work with Pyface 8.0+)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants