AutodeskAILab / occwl

Lightweight Pythonic wrapper around pythonocc
46 stars 9 forks source link

conda package requirements pin specific ipykernel version #21

Open deGravity opened 2 years ago

deGravity commented 2 years ago

The current conda packages requirements are:

ipykernel 6.3.1.*, ipython, jupyter, matplotlib, networkx, numpy, pydeprecate, pyqt >=5, pyside2 >=5, python >=3.7, pythonocc-core 7.5.1.*, pythreejs, wxpython >=4

This creates unresolvable dependencies when anything else in an environment requires a kernel newer than 6.3.1.x, and is actually unresolvable with the default anaconda channel since it does not provide any 6.3.1.* kernels.

Is it possible to modify the conda requirements to be ipykernel >= 6.3.1 instead?

I guess this could also become a problem with the wildcard definition of the pythonocc-core dependency as well, but that's much less common.

pradeep-pyro commented 2 years ago

@JoeLambourne Any thoughts on this? If I remember correctly you have experience using occwl and ipython.

JoeLambourne commented 2 years ago

@deGravity

Hello Ben!! Welcome to occwl. We should talk some time. I'm a big fan or your work.

The restriction is there because we had some issues with the JupyterViewer. See PR #2 We were getting an error message ValueError: Out of range float values are not JSON compliant

The issue first appeared in ipykernel 6.4.1. This was the testing we did at the time

ipykernel                 6.4.1 Error
ipykernel                 6.3.1  Working
ipykernel                 6.2.0  Working

The full stack trace is here

ValueError                                Traceback (most recent call last)
/var/folders/p3/zs5cp__j0dj28_zy3cn35wt80000gp/T/ipykernel_33188/167476584.py in <module>
      1 viewer = JupyterViewer()
      2 viewer.display(solid)
----> 3 viewer.show()

xxxx/occwl/src/occwl/jupyter_viewer.py in show(self)
    365         Show the viewer
    366         """
--> 367         self._renderer.Display()

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/OCC/Display/WebGl/jupyter_renderer.py in Display(self, position, rotation)
    824         self._controller = OrbitControls(controlling=self._camera,
    825                                          target=camera_target,
--> 826                                          target0=camera_target)
    827         # Update controller to instantiate camera position
    828         self._camera.zoom = camera_zoom

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/pythreejs/controls/OrbitControls_autogen.py in __init__(self, controlling, **kwargs)
     27     def __init__(self, controlling=None, **kwargs):
     28         kwargs['controlling'] = controlling
---> 29         super(OrbitControls, self).__init__(**kwargs)
     30 
     31     _model_name = Unicode('OrbitControlsModel').tag(sync=True)

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/pythreejs/controls/Controls_autogen.py in __init__(self, **kwargs)
     28 
     29     def __init__(self, **kwargs):
---> 30         super(Controls, self).__init__(**kwargs)
     31 
     32     _model_name = Unicode('ControlsModel').tag(sync=True)

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/pythreejs/_base/Three.py in __init__(self, **kwargs)
     15 
     16     def __init__(self, **kwargs):
---> 17         super(ThreeWidget, self).__init__(**kwargs)
     18         self.on_msg(self._on_potential_ret_val)
     19 

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/ipywidgets/widgets/widget.py in __init__(self, **kwargs)
    413 
    414         Widget._call_widget_constructed(self)
--> 415         self.open()
    416 
    417     def __del__(self):

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/ipywidgets/widgets/widget.py in open(self)
    436                 args['comm_id'] = self._model_id
    437 
--> 438             self.comm = Comm(**args)
    439 
    440     @observe('comm')

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/ipykernel/comm/comm.py in __init__(self, target_name, data, metadata, buffers, **kwargs)
     55             if self.primary:
     56                 # I am primary, open my peer.
---> 57                 self.open(data=data, metadata=metadata, buffers=buffers)
     58             else:
     59                 self._closed = False

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/ipykernel/comm/comm.py in open(self, data, metadata, buffers)
     92                               data=data, metadata=metadata, buffers=buffers,
     93                               target_name=self.target_name,
---> 94                               target_module=self.target_module,
     95                               )
     96             self._closed = False

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/ipykernel/comm/comm.py in _publish_msg(self, msg_type, data, metadata, buffers, **keys)
     69             parent=self.kernel.get_parent("shell"),
     70             ident=self.topic,
---> 71             buffers=buffers,
     72         )
     73 

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/jupyter_client/session.py in send(self, stream, msg_or_type, content, parent, ident, buffers, track, header, metadata)
    828         if self.adapt_version:
    829             msg = adapt(msg, self.adapt_version)
--> 830         to_send = self.serialize(msg, ident)
    831         to_send.extend(buffers)
    832         longest = max([len(s) for s in to_send])

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/jupyter_client/session.py in serialize(self, msg, ident)
    702             content = self.none
    703         elif isinstance(content, dict):
--> 704             content = self.pack(content)
    705         elif isinstance(content, bytes):
    706             # content is already packed, as in a relayed message

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/jupyter_client/session.py in json_packer(obj)
     97         default=json_default,
     98         ensure_ascii=False,
---> 99         allow_nan=False,
    100     )
    101 

~/miniconda3/envs/myoccwlenv/lib/python3.7/site-packages/zmq/utils/jsonapi.py in dumps(o, **kwargs)
     23     Keyword arguments are passed along to :py:func:`json.dumps`.
     24     """
---> 25     return json.dumps(o, **kwargs).encode("utf8")
     26 
     27 

~/miniconda3/envs/myoccwlenv/lib/python3.7/json/__init__.py in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
    236         check_circular=check_circular, allow_nan=allow_nan, indent=indent,
    237         separators=separators, default=default, sort_keys=sort_keys,
--> 238         **kw).encode(obj)
    239 
    240 

~/miniconda3/envs/myoccwlenv/lib/python3.7/json/encoder.py in encode(self, o)
    197         # exceptions aren't as detailed.  The list call should be roughly
    198         # equivalent to the PySequence_Fast that ''.join() would do.
--> 199         chunks = self.iterencode(o, _one_shot=True)
    200         if not isinstance(chunks, (list, tuple)):
    201             chunks = list(chunks)

~/miniconda3/envs/myoccwlenv/lib/python3.7/json/encoder.py in iterencode(self, o, _one_shot)
    255                 self.key_separator, self.item_separator, self.sort_keys,
    256                 self.skipkeys, _one_shot)
--> 257         return _iterencode(o, 0)
    258 
    259 def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,

ValueError: Out of range float values are not JSON compliant

Looks like the source of the issue is here https://github.com/jupyter-widgets/pythreejs/issues/366

It looks like the fix has only just been merged. We need to find which version of ipykernel will work again.

JoeLambourne commented 1 year ago

Hi @deGravity,

FYI, I just removed the ipykernel dependency as it looks like other people were also having problems. See #26. I'm going to close this. If you have time to test then please re-open if you have problems.

Also worth noting... Some STEP files include transforms which manifest themselves on in the locator of Open Cascade entities. This can mean that if you access surfaces with Face.surface() or Face.specific_surface() directly then there was the risk that the axis, locator and 3d points evaluated from that surface were not in the correct place in model space. To ensure that these problems aren't invisible bugs in people's code, we added asserts to these functions which check the transforms are identity. If you run into these issues then let us know.