widgetti / ipyreact

React for ipywidgets that just works. No webpack, no npm, no hassle
BSD 3-Clause "New" or "Revised" License
104 stars 8 forks source link

File not found: xxxx/ipyreact/basic.tsx #46

Closed TermeHansen closed 6 months ago

TermeHansen commented 7 months ago

I fail to import ipyreact. I have tried both from conda and with pip installs on python 3.9, 3.10 and 3.11. All yield the same - what am I doing wrong, or is there a bug currently with anywidget?

minimal environment made from:

$ conda create --name reactpip python=3.11
$ conda activate reactpip
$ pip install ipyreact

import

$ python
Python 3.11.6 | packaged by conda-forge | (main, Oct  3 2023, 10:40:35) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipyreact
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "xxxx/miniforge3/envs/reactpip/lib/python3.11/site-packages/ipyreact/__init__.py", line 8, in <module>
    from .widget import ReactWidget
  File "xxxx/miniforge3/envs/reactpip/lib/python3.11/site-packages/ipyreact/widget.py", line 22, in <module>
    class ReactWidget(anywidget.AnyWidget):
  File "xxxx/miniforge3/envs/reactpip/lib/python3.11/site-packages/traitlets/traitlets.py", line 965, in __new__
    return super().__new__(mcls, name, bases, classdict, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "xxxx/miniforge3/envs/reactpip/lib/python3.11/site-packages/anywidget/widget.py", line 70, in __init_subclass__
    file_contents = try_file_contents(getattr(cls, key))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "xxxx/miniforge3/envs/reactpip/lib/python3.11/site-packages/anywidget/_util.py", line 248, in try_file_contents
    raise FileNotFoundError(f"File not found: {path}")
FileNotFoundError: File not found: xxx/miniforge3/envs/reactpip/lib/python3.11/site-packages/ipyreact/basic.tsx
TermeHansen commented 7 months ago

It must be related to this PR that came with 0.7.1 of anywidget https://github.com/manzt/anywidget/pull/345

Downgrading anywidget to 0.7.0 "fixes" this for now...