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

Ipyreact not working in classic Jupyter Notebook #41

Closed kolibril13 closed 1 year ago

kolibril13 commented 1 year ago

Environment setup:

python3.11 -m venv .venv && source .venv/bin/activate
pip install notebook
pip install ipyreact
jupyter notebook

When I now try running this example

import ipyreact

class MyExampleWidget(ipyreact.ReactWidget):
    _esm = """
    import * as React from "react";

    export default function MyButton() {
        return < button > X < /button> 
    };"""

MyExampleWidget()

in a classic notebook, I get this error:

image
kolibril13 commented 1 year ago

I managed to solve this issue 🎉

The problem was that I had another jupyter notebook installation in /opt/homebrew/bin that I was not aware of. I uninstalled the brew one and now jupyter notebook is linked to the correct jupyter notebook installation in the virtual environment. what a bug.🐞

maartenbreddels commented 1 year ago

welcome to jupyter with multiple environment :-D

You've earned some experience points along the way, and you can call yourself a wizard now :)

kolibril13 commented 1 year ago

and you can call yourself a wizard now :)

image