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

No canvas output #82

Closed
acejacek opened this issue Apr 1, 2020 · 8 comments
Closed

No canvas output #82

acejacek opened this issue Apr 1, 2020 · 8 comments

Comments

@acejacek
Copy link

acejacek commented Apr 1, 2020

I can't get any output. For example, this piece of code:

from ipycanvas import Canvas

canvas = Canvas(width=200, height=200)
canvas.fill_rect(25, 25, 100, 100)
canvas.clear_rect(45, 45, 60, 60)
canvas.stroke_rect(50, 50, 50, 50)
canvas

the only output I'm getting is:

Canvas(height=200, width=200)

I'm running than on MacOS, with brewed Python 3.7 and latest Jupyter. All installed according to the book, without Anaconda. No errors thrown, nothing to debug. All modules present, node v13, all are there waiting. Tested on multiple browsers too (Safari, Chrome, Firefox).

I'm totally clueless. I'm new in the game, so maybe I'm doing a trivial error, but Google can't help me.

@martinRenou
Copy link
Collaborator

martinRenou commented Apr 2, 2020

Thanks for opening an issue.

  • Are you using Jupyter Notebook or JupyterLab? If using JupyterLab, please don't forget to run jupyter labextension install @jupyter-widgets/jupyterlab-manager ipycanvas
  • Did you install ipycanvas with conda? If yes, please re-install it doing conda install -c conda-forge ipycanvas=0.4.3. Something went wrong with the latest conda package, I am working on fixing it.

Otherwise, please provide the output of the following commands:

which jupyter
jupyter nbextension list
jupyter labextension list

@acejacek
Copy link
Author

acejacek commented Apr 2, 2020

Hi,
I reinstalled everything from the scratch (making a deep puge of everything python-related), and now ipycanvas works perfectly.
Thanks for all!

@acejacek acejacek closed this as completed Apr 2, 2020
@martinRenou
Copy link
Collaborator

Happy to hear that it works! Don't hesitate to open other issues if you have any questions.

@MiguelCorti
Copy link

Hi! Didn't want to open a new issue as the problem I'm having seems very similar to this one, but I can't seem to solve it :(

I'm using Jupyter Notebook (no JupyterLab) without Anaconda. I'm using python 3.8.2 and installed ipycanvas 0.5.0 using pip. But I'm getting no output from canvas. I'm trying to run the following code from the the ipycanvas docs:

from ipycanvas import Canvas

canvas = Canvas(width=200, height=200)

canvas.fill_rect(25, 25, 100, 100)
canvas.clear_rect(45, 45, 60, 60)
canvas.stroke_rect(50, 50, 50, 50)

canvas

The output is blank, but looking at my console (where jupyter server is running) I see the following output:

[W 10:57:08.758 NotebookApp] 404 GET /static/ipycanvas.js?v=20200903105459 (127.0.0.1) 1.01ms referer=http://localhost:8888/notebooks/trab_1.ipynb

And inspecting the browser console I see several errors as well:
image
I think it may be relevant to note that I'm using WSL with Ubuntu 20.04 as well.

Using ipycanvas on Jupyter Notebook through MyBinder gave me the exact same issue, but I was able to solve it running !jupyter labextension install @jupyter-widgets/jupyterlab-manager ipycanvas

As I don't have jupyter lab installed locally, I don't know what else to do.

Thanks! I can open a new issue if it seems appropiate.

@martinRenou
Copy link
Collaborator

Hey!

Can you run the following command in a terminal and show me the output:

jupyter nbextension list

@MiguelCorti
Copy link

Sure, sorry for taking long! I missed your comment...

Here is the output:
image

@martinRenou
Copy link
Collaborator

Try running:

jupyter nbextension install --py --symlink --sys-prefix ipycanvas
jupyter nbextension enable --py --sys-prefix ipycanvas

This should not actually be needed. But it might fix your issue.

@MiguelCorti
Copy link

Thanksssssss, that worked! A friend of mine was having the same issue (using only notebook and pycanvas), will pass the knowledge on. Also, I had some problems with permissions when running both these commands, so I actually ran:

jupyter nbextension install --py --symlink --sys-prefix ipycanvas --user
jupyter nbextension enable --py ipycanvas

Added --user on the first command and removed --sys-prefix from the second one.

Everything seems to be working normally now. Thanks a lot!

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

3 participants