haesleinhuepf / napari-assistant

BSD 3-Clause "New" or "Revised" License
20 stars 5 forks source link

Loading from yaml file fails with AttributeError #28

Open jluethi opened 2 years ago

jluethi commented 2 years ago

I'm trying to load a pipeline saved to a yaml file created by the napari assistant, but it fails to do so.

I create a simple pipeline (e.g. combine 2 images) in the napari assistant. Then I close the viewer and start it again with the same images (with the same names). When using the Load workflow from file function of the assistant, I get the following error message:

Traceback (most recent call last):
  File "/Users/joel/opt/miniconda3/envs/napari-assistant/lib/python3.9/site-packages/napari_assistant/_gui/_Assistant.py", line 352, in load_workflow
    w_dw = initialise_root_functions(
  File "/Users/joel/opt/miniconda3/envs/napari-assistant/lib/python3.9/site-packages/napari_assistant/_workflow_io_utility.py", line 49, in initialise_root_functions
    widget = make_flexible_gui(
  File "/Users/joel/opt/miniconda3/envs/napari-assistant/lib/python3.9/site-packages/napari_assistant/_workflow_io_utility.py", line 224, in make_flexible_gui
    category = get_category_of_function(func)
  File "/Users/joel/opt/miniconda3/envs/napari-assistant/lib/python3.9/site-packages/napari_assistant/_categories.py", line 536, in get_category_of_function
    func_name = get_name_of_function(func)
  File "/Users/joel/opt/miniconda3/envs/napari-assistant/lib/python3.9/site-packages/napari_assistant/_categories.py", line 321, in get_name_of_function
    if v is func or v.__wrapped__ is func:
AttributeError: 'function' object has no attribute '__wrapped__'

For context, I was trying to do run napari_segment_blobs_and_things_with_membranes.sum_images. Here is the pipeline I used for that (renamed to .txt so I can upload it to Github): subtract_images.txt

My napari env (click to expand): ``` aiobotocore==2.3.4 aiofiles==0.8.0 aiohttp==3.8.1 aioitertools==0.10.0 aiosignal==1.2.0 aiosqlite==0.17.0 alabaster==0.7.12 anyio==3.6.1 appdirs==1.4.4 appnope==0.1.3 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 asciitree==0.3.3 asttokens==2.0.5 async-timeout==4.0.2 attrs==21.4.0 autopep8==1.6.0 Babel==2.10.3 backcall==0.2.0 beautifulsoup4==4.11.1 bleach==5.0.1 botocore==1.24.21 build==0.8.0 cachey==0.2.1 certifi @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_884c889c-96af-444f-bd6d-daddb5e9a462ykj3l5n_/croots/recipe/certifi_1655968814730/work/certifi cffi==1.15.1 charset-normalizer==2.1.0 click==8.1.3 cloudpickle==2.1.0 commonmark==0.9.1 cycler==0.11.0 dask==2022.7.0 debugpy==1.6.2 decorator==5.1.1 defusedxml==0.7.1 docstring-parser==0.14.1 docutils==0.18.1 entrypoints==0.4 executing==0.8.3 fasteners==0.17.3 fastjsonschema==2.16.1 fonttools==4.34.4 freetype-py==2.3.0 frozenlist==1.3.0 fsspec==2022.5.0 HeapDict==1.0.1 hsluv==5.0.3 idna==3.3 imageio==2.19.5 imagesize==1.4.1 importlib-metadata==4.12.0 ipykernel==6.15.1 ipython==8.4.0 ipython-genutils==0.2.0 ipywidgets==7.7.1 jedi==0.18.1 Jinja2==3.1.2 jmespath==1.0.1 json5==0.9.8 jsonschema==4.7.2 jupyter==1.0.0 jupyter-client==7.3.4 jupyter-console==6.4.4 jupyter-core==4.11.1 jupyter-server==1.18.1 jupyter-ydoc==0.1.10 jupyterlab==4.0.0a26 jupyterlab-pygments==0.2.2 jupyterlab-server==2.15.0 jupyterlab-widgets==1.1.1 jupytext==1.14.0 kiwisolver==1.4.4 locket==1.0.0 loguru==0.6.0 magicgui==0.5.1 markdown-it-py==2.1.0 MarkupSafe==2.1.1 matplotlib==3.5.2 matplotlib-inline==0.1.3 mdit-py-plugins==0.3.0 mdurl==0.1.1 mistune==0.8.4 multidict==6.0.2 napari==0.4.16 napari-assistant==0.3.10 napari-console==0.0.4 napari-ome-zarr==0.5.2 napari-plugin-engine==0.2.0 napari-segment-blobs-and-things-with-membranes==0.3.0 napari-skimage-regionprops==0.5.3 napari-svg==0.1.6 napari-time-slicer==0.4.9 napari-tools-menu==0.1.15 napari-workflow-inspector==0.2.2 napari-workflows==0.2.3 nbclient==0.6.6 nbconvert==6.5.0 nbformat==5.4.0 nest-asyncio==1.5.5 networkx==2.8.4 notebook==6.4.12 notebook-shim==0.1.0 npe2==0.5.1 numcodecs==0.10.0 numpy==1.23.1 numpydoc==1.4.0 ome-zarr==0.5.2 packaging==21.3 pandas==1.4.3 pandocfilters==1.5.0 parso==0.8.3 partd==1.2.0 pep517==0.12.0 pexpect==4.8.0 pickleshare==0.7.5 Pillow==9.2.0 Pint==0.19.2 pooch==1.6.0 prometheus-client==0.14.1 prompt-toolkit==3.0.30 psutil==5.9.1 psygnal==0.3.5 ptyprocess==0.7.0 pure-eval==0.2.2 pycodestyle==2.8.0 pycparser==2.21 pydantic==1.9.1 Pygments==2.12.0 PyOpenGL==3.1.6 pyparsing==3.0.9 pyperclip==1.8.2 PyQt5==5.15.2 PyQt5_sip==4.19.25 PyQtChart==5.15.2 pyrsistent==0.18.1 python-dateutil==2.8.2 pytomlpp==1.0.11 pytz==2022.1 PyWavelets==1.3.0 PyYAML==6.0 pyzmq==23.2.0 qtconsole==5.3.1 QtPy==2.1.0 requests==2.28.1 rich==12.5.1 s3fs==2022.5.0 scikit-image==0.19.3 scipy==1.8.1 Send2Trash==1.8.0 six==1.16.0 sniffio==1.2.0 snowballstemmer==2.2.0 soupsieve==2.3.2.post1 Sphinx==5.0.2 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 stack-data==0.3.0 superqt==0.3.3 terminado==0.15.0 tifffile==2022.5.4 tinycss2==1.1.1 toml==0.10.2 tomli==2.0.1 toolz==0.12.0 tornado==6.2 tqdm==4.64.0 traitlets==5.3.0 typer==0.6.1 typing_extensions==4.3.0 urllib3==1.26.10 vispy==0.10.0 wcwidth==0.2.5 webencodings==0.5.1 websocket-client==1.3.3 widgetsnbextension==3.6.1 wrapt==1.14.1 y-py==0.5.3 yarl==1.7.2 ypy-websocket==0.2.0 zarr==2.12.0 zipp==3.8.1 ```

EDIT: Using the napari_workflows._io_yaml_v1.load_workflow function in Python, I can load the workflow. Just doing it interactively in the assistant seems to failed when doing the if v is func or v.__wrapped__ is func check

rdemets commented 1 year ago

Can I wake up the dead and say that I am facing the same issue ? Was there any workaround to get it to run via Napari without using Python ?

Thanks !