pythreejs
pythreejs copied to clipboard
pythreejs breaks jupyter lab
(venv) ~: jupyter labextension list
JupyterLab v0.35.5
Known labextensions:
app dir: /usr/share/jupyter/lab
jupyter-threejs v2.0.3 enabled OK
(venv) ~: jupyter lab
[I 04:09:19.805 LabApp] Writing notebook server cookie secret to /run/user/1001/jupyter/notebook_cookie_secret
[W 04:09:20.765 LabApp] All authentication is disabled. Anyone who can connect to this server will be able to run code.
[I 04:09:20.840 LabApp] JupyterLab extension loaded from /usr/local/lib/python3.5/dist-packages/jupyterlab
[I 04:09:20.840 LabApp] JupyterLab application directory is /usr/share/jupyter/lab
[W 04:09:20.940 LabApp] JupyterLab server extension not enabled, manually loading...
[I 04:09:21.007 LabApp] JupyterLab extension loaded from /usr/local/lib/python3.5/dist-packages/jupyterlab
[I 04:09:21.007 LabApp] JupyterLab application directory is /usr/share/jupyter/lab
[I 04:09:21.008 LabApp] Serving notebooks from local directory: /home/atagliasacchi
[I 04:09:21.008 LabApp] The Jupyter Notebook is running at:
[I 04:09:21.008 LabApp] http://localhost:8888/
[I 04:09:21.008 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
But when you open the URL:

And in terminal, these errors appear:
[I 04:09:24.522 LabApp] 302 GET / (::1) 1.14ms
[E 04:09:51.649 LabApp] Uncaught exception GET /lab/api/themes/@jupyterlab/theme-light-extension/index.css (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/lab/api/themes/@jupyterlab/theme-light-extension/index.css', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 2528, in get
yield self.flush()
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 994, in flush
start_line, self._headers, chunk, callback=callback)
File "/usr/local/lib/python3.5/dist-packages/tornado/http1connection.py", line 412, in write_headers
data += self._format_chunk(chunk)
File "/usr/local/lib/python3.5/dist-packages/tornado/http1connection.py", line 424, in _format_chunk
"Tried to write more data than Content-Length")
tornado.httputil.HTTPOutputError: Tried to write more data than Content-Length
[E 04:09:51.651 LabApp] Cannot send error response after headers written
[E 04:09:51.720 LabApp] Uncaught exception GET /lab/api/themes/@jupyterlab/theme-light-extension/index.css (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/lab/api/themes/@jupyterlab/theme-light-extension/index.css', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 2528, in get
yield self.flush()
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 994, in flush
start_line, self._headers, chunk, callback=callback)
File "/usr/local/lib/python3.5/dist-packages/tornado/http1connection.py", line 412, in write_headers
data += self._format_chunk(chunk)
File "/usr/local/lib/python3.5/dist-packages/tornado/http1connection.py", line 424, in _format_chunk
"Tried to write more data than Content-Length")
tornado.httputil.HTTPOutputError: Tried to write more data than Content-Length
[E 04:09:51.720 LabApp] Cannot send error response after headers written
[E 04:09:51.791 LabApp] Uncaught exception GET /lab/api/themes/@jupyterlab/theme-light-extension/index.css (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/lab/api/themes/@jupyterlab/theme-light-extension/index.css', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 2528, in get
yield self.flush()
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 994, in flush
start_line, self._headers, chunk, callback=callback)
File "/usr/local/lib/python3.5/dist-packages/tornado/http1connection.py", line 412, in write_headers
data += self._format_chunk(chunk)
File "/usr/local/lib/python3.5/dist-packages/tornado/http1connection.py", line 424, in _format_chunk
"Tried to write more data than Content-Length")
tornado.httputil.HTTPOutputError: Tried to write more data than Content-Length
[E 04:09:51.791 LabApp] Cannot send error response after headers written
[E 04:09:51.860 LabApp] Uncaught exception GET /lab/api/themes/@jupyterlab/theme-light-extension/index.css (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/lab/api/themes/@jupyterlab/theme-light-extension/index.css', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 2528, in get
yield self.flush()
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 994, in flush
start_line, self._headers, chunk, callback=callback)
File "/usr/local/lib/python3.5/dist-packages/tornado/http1connection.py", line 412, in write_headers
data += self._format_chunk(chunk)
File "/usr/local/lib/python3.5/dist-packages/tornado/http1connection.py", line 424, in _format_chunk
"Tried to write more data than Content-Length")
tornado.httputil.HTTPOutputError: Tried to write more data than Content-Length
[E 04:09:51.860 LabApp] Cannot send error response after headers written
[E 04:09:51.929 LabApp] Uncaught exception GET /lab/api/themes/@jupyterlab/theme-light-extension/index.css (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/lab/api/themes/@jupyterlab/theme-light-extension/index.css', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 2528, in get
yield self.flush()
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 994, in flush
start_line, self._headers, chunk, callback=callback)
File "/usr/local/lib/python3.5/dist-packages/tornado/http1connection.py", line 412, in write_headers
data += self._format_chunk(chunk)
File "/usr/local/lib/python3.5/dist-packages/tornado/http1connection.py", line 424, in _format_chunk
"Tried to write more data than Content-Length")
tornado.httputil.HTTPOutputError: Tried to write more data than Content-Length
[E 04:09:51.929 LabApp] Cannot send error response after headers written
[I 04:09:52.051 LabApp] Node v11.14.0
[E 04:09:52.065 LabApp] Uncaught exception GET /lab/api/themes/@jupyterlab/theme-light-extension/index.css (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/lab/api/themes/@jupyterlab/theme-light-extension/index.css', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 2528, in get
yield self.flush()
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 994, in flush
start_line, self._headers, chunk, callback=callback)
File "/usr/local/lib/python3.5/dist-packages/tornado/http1connection.py", line 412, in write_headers
data += self._format_chunk(chunk)
File "/usr/local/lib/python3.5/dist-packages/tornado/http1connection.py", line 424, in _format_chunk
"Tried to write more data than Content-Length")
tornado.httputil.HTTPOutputError: Tried to write more data than Content-Length
[E 04:09:52.067 LabApp] Cannot send error response after headers written
[I 04:09:52.561 LabApp] Build is up to date
[I 04:09:53.265 LabApp] Kernel started: 2038ba0e-9180-49ac-8042-8cd249b73dda
[I 04:09:54.550 LabApp] Adapting to protocol v5.1 for kernel 2038ba0e-9180-49ac-8042-8cd249b73dda
[I 04:09:54.550 LabApp] Adapting to protocol v5.1 for kernel 2038ba0e-9180-49ac-8042-8cd249b73dda
Clearing browser cache helped here (but no rendering is visible yet)
Clearing browser cache helped here (but no rendering is visible yet)
Not sure if I follow. Did clearing the cache make lab look normal again (and did it fix the errors in the server terminal)?
Yes, clearing the cache made it look normal, but when you execute the cell no graphics is displayed (while with notebooks it does)
How can one figure out how to resolve this?
Do you have the @jupyter-widgets/jupyterlab-manager extension installed on lab? That tends to be a common missed point (can probably also be added to readme).
Assuming this was fixed due to lack of response, closing. If there is still something unresolved here, please comment and I'll reopen as appropriate.
Not quite, just did not have time recently. Let me try this morning
Alright, gave it another try today (on a new server):
pip install jupyter
sudo jupyter labextension install jupyter-threejs
In a jupyter notebook, the following below produces the desired output:

While in jupyter lab it is not showing anything:

Snippet used (same ipynb file for both modes)
from pythreejs import *
import numpy as np
ball = Mesh(geometry=SphereGeometry(radius=1, widthSegments=32, heightSegments=24),
material=MeshLambertMaterial(color='red'),
position=[2, 1, 0])
c = PerspectiveCamera(position=[0, 5, 5], up=[0, 1, 0],
children=[DirectionalLight(color='white', position=[3, 5, 1], intensity=0.5)])
scene = Scene(children=[ball, c, AmbientLight(color='#777777')])
renderer = Renderer(camera=c,
scene=scene,
controls=[OrbitControls(controlling=c)])
display(renderer)
What is the output of jupyter labextension list?
(python3) /mnt/erebus/dev/cvxnet: jupyter labextension list
JupyterLab v0.35.6
Known labextensions:
app dir: /usr/local/share/jupyter/lab
@jupyterlab/celltags v0.1.4 enabled OK
@jupyterlab/git v0.5.0 enabled OK
jupyter-threejs v2.1.1 enabled OK
nbdime-jupyterlab v0.6.1 enabled OK
Ah, just saw again your note above, so looked it up and installed (I'll submit a pull request for the main readme if this is necessary)
sudo jupyter labextension install @jupyter-widgets/jupyterlab-manager
A change in the failure you get :)

Do you have any errors in the browser console (typically via Ctrl + Shift + J, or F12).
Oh yes, plenty :)

Try to upgrade your Python pythreejs package (via conda or pip), as well as updating the labextension (jupyter labextension update --all).
pip install pythreejs --upgrade
(python3) /mnt/erebus/dev/cvxnet: pip install pythreejs --upgrade
Requirement already up-to-date: pythreejs in /home/atagliasacchi/Envs/python3/lib/python3.5/site-packages (2.1.1)
(python3) /mnt/erebus/dev/cvxnet: sudo jupyter labextension update --all
Node v11.15.0
Extension 'nbdime-jupyterlab' already up to date
Extension '@jupyterlab/git' already up to date
Extension 'jupyter-threejs' already up to date
Extension '@jupyterlab/celltags' already up to date
Extension '@jupyter-widgets/jupyterlab-manager' already up to dat
And while the above does not show versions, here they are
(python3) /mnt/erebus/dev/cvxnet: jupyter labextension list
JupyterLab v0.35.6
Known labextensions:
app dir: /usr/local/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager v0.38.1 enabled OK
@jupyterlab/celltags v0.1.4 enabled OK
@jupyterlab/git v0.6.0 enabled OK
jupyter-threejs v2.1.1 enabled OK
nbdime-jupyterlab v0.6.1 enabled OK
Result of cell execution is the same:
Error displaying widget
Hmm, seems to be an issue with the latest patch release of ipywidgets (https://github.com/jupyter-widgets/ipywidgets/issues/2491). It should be fixed once that issue is resolved and released.
Fingers crossed that's the case :) Let me know when you get the chance to test.
On Wed, Jul 10, 2019, 2:52 PM Vidar Tonaas Fauske [email protected] wrote:
Hmm, seems to be an issue with the latest patch relelase of ipywidgets ( jupyter-widgets/ipywidgets#2491 https://github.com/jupyter-widgets/ipywidgets/issues/2491). It should be fixed once that issue is resolved and released.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jupyter-widgets/pythreejs/issues/268?email_source=notifications&email_token=ABCF4PIT3Z35TFBCTPJYV4TP6XLSLA5CNFSM4HLW7O2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZTLOQI#issuecomment-510048065, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCF4PKR6NHR723IFK3BPJ3P6XLSLANCNFSM4HLW7O2A .
The issue with ipywidgets has been resolved, but there is now an issue with lab left to resolve this. Currently on vacation, so at least 2 weeks until I get to look at it. Note that upgrading to lab 1.0 should fix this issue.