jreiberkyle / jupyterscad

Render and interactively visualize 3D objects described in solidpython2 within a Jupyter notebook.
Other
3 stars 2 forks source link

ImportError: cannot import name 'find_loader' from 'importlib' #37

Open Daafip opened 3 days ago

Daafip commented 3 days ago

Expected behavior Render of my scad code First of all nice work, i first found the original solid package, then see that youre developing a new one. I had some issues getting started.

Actual behavior (describe the problem) I get an import error

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
File c:\Users\david\anaconda3\envs\pyscad2\Lib\site-packages\IPython\core\formatters.py:925, in IPythonDisplayFormatter.__call__(self, obj)
    [923](file:///C:/Users/david/anaconda3/envs/pyscad2/Lib/site-packages/IPython/core/formatters.py:923) method = get_real_method(obj, self.print_method)
    [924](file:///C:/Users/david/anaconda3/envs/pyscad2/Lib/site-packages/IPython/core/formatters.py:924) if method is not None:
--> [925](file:///C:/Users/david/anaconda3/envs/pyscad2/Lib/site-packages/IPython/core/formatters.py:925)     method()
    [926](file:///C:/Users/david/anaconda3/envs/pyscad2/Lib/site-packages/IPython/core/formatters.py:926)     return True

File c:\Users\david\anaconda3\envs\pyscad2\Lib\site-packages\solid2\core\object_base\object_base_impl.py:25, in RenderMixin._ipython_display_(self)
     [23](file:///C:/Users/david/anaconda3/envs/pyscad2/Lib/site-packages/solid2/core/object_base/object_base_impl.py:23) def _ipython_display_(self):
     [24](file:///C:/Users/david/anaconda3/envs/pyscad2/Lib/site-packages/solid2/core/object_base/object_base_impl.py:24)     from IPython import get_ipython, display
---> [25](file:///C:/Users/david/anaconda3/envs/pyscad2/Lib/site-packages/solid2/core/object_base/object_base_impl.py:25)     from importlib import find_loader
     [27](file:///C:/Users/david/anaconda3/envs/pyscad2/Lib/site-packages/solid2/core/object_base/object_base_impl.py:27)     def is_notebook():
     [28](file:///C:/Users/david/anaconda3/envs/pyscad2/Lib/site-packages/solid2/core/object_base/object_base_impl.py:28)         return get_ipython().__class__.__name__ == 'ZMQInteractiveShell'

ImportError: cannot import name 'find_loader' from 'importlib' (c:\Users\david\anaconda3\envs\pyscad2\Lib\importlib\__init__.py)

Minimum, Complete, Viable Code Sample A "Minimal, Complete and Verifiable Example" will make it much easier for maintainers to help you. See http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports

from jupyterscad import view
# import openscad
from solid2 import cube
model = cube(4)

model

Additional context I created a new environment, it is 3.12.4 (so maybe too new?) Can't find what you tested it on as it says python >3.7.

Daafip commented 3 days ago

Edit: I see now on the pypi page its listed upuntill 3.11. I tried a new conda environment with 3.9 but im getting some issues there where it conflictss with the normal jupyter installation when i run pip install jupyterscad Any suggestions? whats the latest version of python you know to work?

jeff-dh commented 3 days ago
Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib import find_loader
>>> 

https://docs.python.domainunion.de/3.10/library/importlib.html#importlib.find_loader

importlib.find_loader(name, path=None)
[...]
    Deprecated since version 3.4: Use importlib.util.find_spec() instead.
Daafip commented 3 days ago

Ostheer:avoid use of importlib.find_loader (https://github.com/jeff-dh/SolidPython/pull/60[)](https://github.com/jeff-dh/SolidPython/commit/42ec0bfca6d3ec6d4b3c61614163107520a281a7) 42ec0bf

6 months ago

Ah its already in main, just not in the latest python release

jeff-dh commented 3 days ago

https://github.com/jeff-dh/SolidPython/issues/70