Closed hainm closed 5 years ago
Hi,
Can you give more detail about your environment? I could not reproduce this with xeus-python 0.22 (nor with the current master) on Linux with ipywidgets 7.5.1 and Google Chrome.
Hi,
Macos with ipywidgets 7.5.1 and Google Chrome, latest xeus-python from conda-forge.
The simple example above still shows the widget regardless of the error in JS.
I am not sure I understand this issue... The JavaScript code is the same whether you are using IPython or xeus-python. I really don't understand where it could come from.
Are sure you don't have this error with IPython as well?
I also can't reproduce this. Using ipywidgets 7.5.1, xeus-python master, and Chromium.
With macos?
On Ubuntu 18.04.3
I don't see the error in JS console on my centos7 either. I think it's macos-related.
Returning null (macos) causes lots of troubles in nglview (and may be others too). For example, this chunk of code works fine in IPython in both macos and linux
var stage_params = this.model.get("_ngl_full_stage_parameters")
if (!("backgroundColor" in stage_params)){
stage_params["backgroundColor"] = "white"
}
But I have to add || {}
to initialize the _ngl_full_stage_parameters
dict.
# HERE IS THE DIFF
var stage_params = this.model.get("_ngl_full_stage_parameters") || {};
if (!("backgroundColor" in stage_params)){
stage_params["backgroundColor"] = "white"
}
nglview user also got the same issue with the null stage_params
above
https://github.com/arose/nglview/issues/844#issuecomment-523545757
I'll have a closer look. It might be related to the way we serialize the state of the widget.
thanks, I have another macos-related issue: https://github.com/QuantStack/xeus-python/issues/129
I looked at the content of the message and _dom_classes
is an empty list...
Which version of nlohmann::json do you have installed?
Which version of nlohmann::json do you have installed?
How do I check this? I only install xeus-python, ipywidges via conda
.
I will report the version tonight since I don't have my mac now.
You can check by doing conda list | grep nlohmann_json
It could be related to nlohmann_json, but I'm not 100% sure. It is here that the list trait gets serialized: https://github.com/QuantStack/xeus-python/blob/master/src/xutils.cpp#L245.
Ideally, you could check (in the Chrome dev tools) the websocket message that you receive on the page, see if _dom_classes
is null or not.
You can check by doing conda list | grep nlohmann_json
is this only for macos? Above returns nothing on my linux machine.
You can check by doing conda list | grep nlohmann_json
there is no such a program in both linux and macos. Was it statically linked to xeus-python?
@martinRenou Finally I have a chance to use my Macos. the _dom_classes
is null.
Oh yes sorry it makes sense that you don't have it if you installed using conda.
I am going to try and test on a Macos machine today, so please don't do the following if you don't have time:
Could you try compiling xeus-python locally and changing src/xutils.cpp
at the very end of the file:
void adl_serializer<py::object>::to_json(json& j, const py::object& obj)
{
j = detail::to_json_impl(obj);
std::cout << "To JSON: " << j.dump() << std::endl;
}
Also line 244 of this same file:
if (py::isinstance<py::tuple>(obj) || py::isinstance<py::list>(obj))
{
auto out = json::array();
std::cout << "Empty array to JSON: " << out.dump() << std::endl;
for (const py::handle& value : obj)
{
out.push_back(to_json_impl(value));
}
return out;
}
Don't forget to include iostream at the beginning of the file:
#include <iostream>
And see what gets printed in the console when running
from ipywidgets import *
Text("hello")
from the notebook
I am not able to replicate your issue either on our Mac machine and on the TravisCI... Can you show me the output of conda list
?
My output:
# packages in environment at /Users/martinrenou/miniconda3/envs/test:
#
# Name Version Build Channel
appnope 0.1.0 py37_1000 conda-forge
attrs 19.1.0 py_0 conda-forge
backcall 0.1.0 py_0 conda-forge
bleach 3.1.0 py_0 conda-forge
bzip2 1.0.8 h01d97ff_0 conda-forge
ca-certificates 2019.6.16 hecc5488_0 conda-forge
certifi 2019.6.16 py37_1 conda-forge
dbus 1.13.6 h2f22bb5_0 conda-forge
decorator 4.4.0 py_0 conda-forge
defusedxml 0.5.0 py_1 conda-forge
entrypoints 0.3 py37_1000 conda-forge
expat 2.2.5 h6de7cb9_1003 conda-forge
gettext 0.19.8.1 h46ab8bc_1002 conda-forge
glib 2.58.3 h9d45998_1002 conda-forge
icu 64.2 h6de7cb9_1 conda-forge
ipykernel 5.1.2 py37h5ca1d4c_0 conda-forge
ipython 7.7.0 py37h5ca1d4c_0 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
ipywidgets 7.5.1 py_0 conda-forge
jedi 0.13.3 py37_0 conda-forge
jinja2 2.10.1 py_0 conda-forge
jpeg 9c h1de35cc_1001 conda-forge
jsonschema 3.0.2 py37_0 conda-forge
jupyter 1.0.0 py_2 conda-forge
jupyter_client 5.3.1 py_0 conda-forge
jupyter_console 6.0.0 py_0 conda-forge
jupyter_core 4.4.0 py_0 conda-forge
libcxx 8.0.1 0 conda-forge
libcxxabi 8.0.1 0 conda-forge
libffi 3.2.1 h6de7cb9_1006 conda-forge
libiconv 1.15 h01d97ff_1005 conda-forge
libpng 1.6.37 h2573ce8_0 conda-forge
libsodium 1.0.17 h01d97ff_0 conda-forge
markupsafe 1.1.1 py37h1de35cc_0 conda-forge
mistune 0.8.4 py37h1de35cc_1000 conda-forge
nbconvert 5.6.0 py_0 conda-forge
nbformat 4.4.0 py_1 conda-forge
ncurses 6.1 h0a44026_1002 conda-forge
notebook 6.0.1 py37_0 conda-forge
openssl 1.1.1c h01d97ff_0 conda-forge
pandoc 2.7.3 0 conda-forge
pandocfilters 1.4.2 py_1 conda-forge
parso 0.5.1 py_0 conda-forge
pcre 8.41 h0a44026_1003 conda-forge
pexpect 4.7.0 py37_0 conda-forge
pickleshare 0.7.5 py37_1000 conda-forge
pip 19.2.3 py37_0 conda-forge
prometheus_client 0.7.1 py_0 conda-forge
prompt_toolkit 2.0.9 py_0 conda-forge
ptyprocess 0.6.0 py_1001 conda-forge
pygments 2.4.2 py_0 conda-forge
pyqt 5.9.2 py37h2a560b1_2 conda-forge
pyrsistent 0.15.4 py37h01d97ff_0 conda-forge
python 3.7.3 h93065d6_1 conda-forge
python-dateutil 2.8.0 py_0 conda-forge
pyzmq 18.0.2 py37hee98d25_2 conda-forge
qt 5.9.7 h8cf7e54_3 conda-forge
qtconsole 4.5.4 py_0 conda-forge
readline 8.0 hcfe32e1_0 conda-forge
send2trash 1.5.0 py_0 conda-forge
setuptools 41.2.0 py37_0 conda-forge
sip 4.19.8 py37h0a44026_1000 conda-forge
six 1.12.0 py37_1000 conda-forge
sqlite 3.29.0 hb7d70f7_0 conda-forge
terminado 0.8.2 py37_0 conda-forge
testpath 0.4.2 py_1001 conda-forge
tk 8.6.9 h2573ce8_1002 conda-forge
tornado 6.0.3 py37h01d97ff_0 conda-forge
traitlets 4.3.2 py37_1000 conda-forge
wcwidth 0.1.7 py_1 conda-forge
webencodings 0.5.1 py_1 conda-forge
wheel 0.33.6 py37_0 conda-forge
widgetsnbextension 3.5.1 py37_0 conda-forge
xeus 0.22.0 h770b8ee_2 conda-forge
xeus-python 0.4.0 py37h770b8ee_0 conda-forge
xz 5.2.4 h1de35cc_1001 conda-forge
zeromq 4.3.2 h6de7cb9_2 conda-forge
zlib 1.2.11 h01d97ff_1005 conda-forge
hi, here is mine:
# packages in environment at /Users/haichit/miniconda3/envs/nglview-xeus:
#
# Name Version Build Channel
appnope 0.1.0 pypi_0 pypi
attrs 19.1.0 pypi_0 pypi
backcall 0.1.0 pypi_0 pypi
bleach 3.1.0 pypi_0 pypi
ca-certificates 2019.6.16 hecc5488_0 conda-forge
certifi 2019.6.16 py36_1 conda-forge
cryptopp 7.0.0 h0a44026_1003 conda-forge
decorator 4.4.0 pypi_0 pypi
defusedxml 0.6.0 pypi_0 pypi
entrypoints 0.3 pypi_0 pypi
ipykernel 5.1.2 pypi_0 pypi
ipython 7.7.0 pypi_0 pypi
ipython-genutils 0.2.0 pypi_0 pypi
ipywidgets 7.5.1 pypi_0 pypi
jedi 0.13.3 py36_0 conda-forge
jinja2 2.10.1 pypi_0 pypi
jsonschema 3.0.2 pypi_0 pypi
jupyter-client 5.3.1 pypi_0 pypi
jupyter-core 4.5.0 pypi_0 pypi
libcxx 4.0.1 hcfea43d_1
libcxxabi 4.0.1 hcfea43d_1
libedit 3.1.20181209 hb402a30_0
libffi 3.2.1 h475c297_4
libsodium 1.0.17 h01d97ff_0 conda-forge
markupsafe 1.1.1 pypi_0 pypi
mistune 0.8.4 pypi_0 pypi
nbconvert 5.6.0 pypi_0 pypi
nbformat 4.4.0 pypi_0 pypi
ncurses 6.1 h0a44026_1
nglview 2.7.1 dev_0 <develop>
notebook 6.0.0 pypi_0 pypi
numpy 1.17.0 pypi_0 pypi
openssl 1.1.1c h01d97ff_0 conda-forge
pandocfilters 1.4.2 pypi_0 pypi
parso 0.5.1 py_0 conda-forge
pexpect 4.7.0 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pip 19.2.2 py36_0
prometheus-client 0.7.1 pypi_0 pypi
prompt-toolkit 2.0.9 pypi_0 pypi
ptyprocess 0.6.0 pypi_0 pypi
pygments 2.4.2 py_0 conda-forge
pyrsistent 0.15.4 pypi_0 pypi
python 3.6.9 h359304d_0
python-dateutil 2.8.0 pypi_0 pypi
pyzmq 18.1.0 pypi_0 pypi
readline 7.0 h1de35cc_5
send2trash 1.5.0 pypi_0 pypi
setuptools 41.0.1 py36_0
six 1.12.0 pypi_0 pypi
sqlite 3.29.0 ha441bb4_0
terminado 0.8.2 pypi_0 pypi
testpath 0.4.2 pypi_0 pypi
tk 8.6.8 ha441bb4_0
tornado 6.0.3 pypi_0 pypi
traitlets 4.3.2 pypi_0 pypi
wcwidth 0.1.7 pypi_0 pypi
webencodings 0.5.1 pypi_0 pypi
wheel 0.33.4 py36_0
widgetsnbextension 3.5.1 pypi_0 pypi
xeus 0.18.1 h04f5b5a_1000 conda-forge
xeus-python 0.1.3 py36_0 QuantStack
xz 5.2.4 h1de35cc_4
zeromq 4.2.5 hfc679d8_4 conda-forge
zlib 1.2.11 h1de35cc_3
the problem is xeus-python 0.1.3 py36_0 QuantStack
, you should install xeus-python
(last version is 0.5 now) form conda-forge, I think it will solve your issue.
Good catch!! That should be the issue.
OMG, I see. By the way, I guess your website needs to be updated: https://xeus-python.readthedocs.io/en/latest/installation.html#with-conda
Ah indeed, I forgot to add the install commands, thanks for catching this!
Could you make it work with conda install -c conda-forge xeus-python
?
I will try that tonight since I am still at work. Cheers.
hi all, I could close this case now, the latest xeus-python in conda-forge does help.
thank you.
hi,
Please see very simple example
In the JS console. I see error:
line 731:
_this.update_classes([], _this.model.get('_dom_classes'));
In IPython, I think_this.model.get('_dom_classes')
returns an empty list in this case.