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

Pydantic error when launching napari via installed constructor bundle #80

Closed
ctrueden opened this issue Jul 18, 2023 · 5 comments · Fixed by #77
Closed

Pydantic error when launching napari via installed constructor bundle #80

ctrueden opened this issue Jul 18, 2023 · 5 comments · Fixed by #77

Comments

@ctrueden
Copy link

ctrueden commented Jul 18, 2023

I installed the napari-0.4.18 Linux constructor bundle. When I try to run the installed napari-0.4.18 directly, here's what I see:

$ ~/.local/napari-0.4.18/envs/napari-0.4.18/bin/napari
/home/curtis/.local/napari-0.4.18/envs/napari-0.4.18/lib/python3.9/site-packages/scipy/__init__.py:155: UserWarning: A NumPy version >=1.18.5 and <1.25.0 is required for this version of SciPy (detected version 1.25.0
  warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
Traceback (most recent call last):
  File "/home/curtis/.local/napari-0.4.18/envs/napari-0.4.18/bin/napari", line 6, in <module>
    from napari.__main__ import main
  File "/home/curtis/.local/napari-0.4.18/envs/napari-0.4.18/lib/python3.9/site-packages/napari/__main__.py", line 17, in <module>
    from napari.utils.translations import trans
  File "/home/curtis/.local/napari-0.4.18/envs/napari-0.4.18/lib/python3.9/site-packages/napari/utils/__init__.py", line 2, in <module>
    from napari.utils.colormaps import Colormap
  File "/home/curtis/.local/napari-0.4.18/envs/napari-0.4.18/lib/python3.9/site-packages/napari/utils/colormaps/__init__.py", line 2, in <module>
    from napari.utils.colormaps.colormap import Colormap
  File "/home/curtis/.local/napari-0.4.18/envs/napari-0.4.18/lib/python3.9/site-packages/napari/utils/colormaps/colormap.py", line 9, in <module>
    from napari.utils.events import EventedModel
  File "/home/curtis/.local/napari-0.4.18/envs/napari-0.4.18/lib/python3.9/site-packages/napari/utils/events/__init__.py", line 17, in <module>
    from napari.utils.events.evented_model import EventedModel
  File "/home/curtis/.local/napari-0.4.18/envs/napari-0.4.18/lib/python3.9/site-packages/napari/utils/events/evented_model.py", line 66, in <module>
    class EventedMetaclass(main.ModelMetaclass):
  File "/home/curtis/.local/napari-0.4.18/envs/napari-0.4.18/lib/python3.9/site-packages/pydantic/_migration.py", line 289, in wrapper
    raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
AttributeError: module 'pydantic._migration' has no attribute 'ModelMetaclass'

The napari 0.4.18 I have installed into a regular conda environment (not via the constructor installer) launches successfully.

It seems pretty clear that the problem is that the constructor bundle installs pydantic 2, whereas napari still works with pydantic 1:

$ find ~/mambaforge/envs/napari ~/.local/napari-0.4.18 -name 'pydantic*.dist-info' -type d
/home/curtis/mambaforge/envs/napari/lib/python3.9/site-packages/pydantic-1.10.11.dist-info
/home/curtis/.local/napari-0.4.18/envs/napari-0.4.18/lib/python3.9/site-packages/pydantic-2.0.1.dist-info
/home/curtis/.local/napari-0.4.18/envs/napari-0.4.18/lib/python3.9/site-packages/pydantic_core-2.0.1.dist-info

But I could paste a more complete diff of my two environments if that would be helpful.

@jaimergp
Copy link
Collaborator

Yes, we need to regenerate the installers to accommodate the new version constraints. I am waiting for a couple PRs to be merged, but should be ready this week. I'll let you know when they are available!

@jaimergp jaimergp linked a pull request Jul 18, 2023 that will close this issue
@jaimergp
Copy link
Collaborator

@ctrueden
Copy link
Author

Awesome @jaimergp, the new bundle works nicely on my machine. It also made a ~/.local/share/applications/napari-0418_napari-0418.desktop so that napari appears as a normal application. 🌟

I was also able to install the napari-imagej plugin using the graphical plugin installer. But when OpenJDK spins up, it crashes. 😭 But on the napari packaging side, this issue is definitely resolved! 👍

@jaimergp
Copy link
Collaborator

Do you have an error message for the OpenJDK error? You should be able to launch napari from its internal conda environment (somewhere in ~/.local).

@ctrueden
Copy link
Author

@jaimergp It's a SIGSEGV. If you're interested in digging, the issue is at imagej/napari-imagej#269.

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

Successfully merging a pull request may close this issue.

2 participants