py5coding / py5generator

Meta-programming project that creates the py5 library code.
https://py5coding.org/
GNU General Public License v3.0
52 stars 13 forks source link

Jupyter Notebook difficulty #236

Closed villares closed 1 year ago

villares commented 1 year ago

Hi, sorry to take your time with this. I must be doing something wrong :(

I activated a conda env, lauched jupyter lab and tried this on a py5bot kernel cell:

size(200, 200)
background(255, 255, 0)
rect(50, 50, 100, 100)

image

Terminal:

villares@L340 ~]$ conda activate py5
(py5) [villares@L340 ~]$ jupyter lab
[W 2023-02-13 17:51:06.863 ServerApp] The module 'jupyterlab_code_formatter' could not be found (No module named 'jupyterlab_code_formatter'). Are you sure the extension is installed?
[I 2023-02-13 17:51:06.880 ServerApp] jupyterlab | extension was successfully linked.
[I 2023-02-13 17:51:06.891 ServerApp] nbclassic | extension was successfully linked.
[W 2023-02-13 17:51:07.141 ServerApp] The module 'jupyterlab_code_formatter' could not be found (No module named 'jupyterlab_code_formatter'). Are you sure the extension is installed?
[I 2023-02-13 17:51:07.141 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-02-13 17:51:07.198 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-02-13 17:51:07.199 LabApp] JupyterLab extension loaded from /home/villares/miniconda3/envs/py5/lib/python3.8/site-packages/jupyterlab
[I 2023-02-13 17:51:07.199 LabApp] JupyterLab application directory is /home/villares/miniconda3/envs/py5/share/jupyter/lab
[I 2023-02-13 17:51:07.203 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-02-13 17:51:07.207 ServerApp] nbclassic | extension was successfully loaded.
[I 2023-02-13 17:51:07.207 ServerApp] Serving notebooks from local directory: /home/villares
[I 2023-02-13 17:51:07.207 ServerApp] Jupyter Server 1.18.1 is running at:
[I 2023-02-13 17:51:07.207 ServerApp] http://localhost:8888/lab?token=816824319214319aa07ef5942322495326b4979f913fd711
[I 2023-02-13 17:51:07.207 ServerApp]  or http://127.0.0.1:8888/lab?token=816824319214319aa07ef5942322495326b4979f913fd711
[I 2023-02-13 17:51:07.207 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-02-13 17:51:07.232 ServerApp] 

    To access the server, open this file in a browser:
        file:///home/villares/.local/share/jupyter/runtime/jpserver-85669-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=816824319214319aa07ef5942322495326b4979f913fd711
     or http://127.0.0.1:8888/lab?token=816824319214319aa07ef5942322495326b4979f913fd711
[W 2023-02-13 17:51:11.785 ServerApp] 404 GET /jupyterlab_code_formatter/version?1676321471307 (127.0.0.1) 42.57ms referer=http://localhost:8888/lab
[I 2023-02-13 17:51:12.005 LabApp] Build is up to date
[W 2023-02-13 17:51:12.145 ServerApp] 404 GET /api/contents/Untitled1.ipynb?content=0&1676321471957 (127.0.0.1): file or directory does not exist: 'Untitled1.ipynb'
[W 2023-02-13 17:51:12.145 ServerApp] file or directory does not exist: 'Untitled1.ipynb'
[W 2023-02-13 17:51:12.145 ServerApp] 404 GET /api/contents/Untitled1.ipynb?content=0&1676321471957 (127.0.0.1) 1.44ms referer=http://localhost:8888/lab
[I 2023-02-13 17:51:27.500 ServerApp] Creating new notebook in 
[I 2023-02-13 17:51:28.246 ServerApp] Kernel started: 24899830-df6d-42e5-9055-26a83bad16e6
[Py5BotApp] ERROR | No such comm target registered: jupyter.widget.control
[Py5BotApp] WARNING | No such comm: 8036653d-5f6e-4d9e-a3fe-dc839477f7d1

UPDATE - On a plain Python kernel, import py5 went without warnings, I wrote a small sketch, then on py5.run_sketch() I had this:

Java exception thrown by Sketch.runSketch:
java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-19-openjdk/lib/libfontmanager.so: /usr/lib/libharfbuzz.so.0: undefined symbol: FT_Get_Transform
villares commented 1 year ago

I have tried on a different env and it works. I have just to figure how to install the kernels they are refusing to install but at least py5 works!

update: yeah, everything works!

hx2A commented 1 year ago

Hmmm, is this a Java 19 issue, where Java 19 expects certain libraries to be installed on your computer but for whatever reason were not present? For that environment, if you make it use Java 17 instead, does it work correctly?

villares commented 1 year ago

You would have to help me test that hypothesis... I'm afraid I can't dive into this right now... Maybe in a few weeks!

hx2A commented 1 year ago

Sure thing! Let me know when you are ready. An easy way to approach this is to use the JAVA_HOME variable and have it point at various installations on your machine.