kreshuklab / plant-seg

A tool for cell instance aware segmentation in densely packed 3D volumetric images
https://kreshuklab.github.io/plant-seg/
MIT License
91 stars 31 forks source link

AttributeError: 'str' object has no attribute 'open' #236

Closed Giannisbiol closed 4 months ago

Giannisbiol commented 4 months ago

Hi I get the below error:

(plant-seg) C:\Users\user>plantseg --gui
You are using the latest version of PlantSeg: 1.7.0.
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\miniforge3\envs\plant-seg\Scripts\plantseg-script.py", line 9, in <module>
    sys.exit(main())
             ^^^^^^
  File "C:\Users\user\AppData\Local\miniforge3\envs\plant-seg\Lib\site-packages\plantseg\run_plantseg.py", line 59, in main
    launch_gui()
  File "C:\Users\user\AppData\Local\miniforge3\envs\plant-seg\Lib\site-packages\plantseg\run_plantseg.py", line 21, in launch_gui
    PlantSegApp()
  File "C:\Users\user\AppData\Local\miniforge3\envs\plant-seg\Lib\site-packages\plantseg\legacy_gui\plantsegapp.py", line 40, in __init__
    self.app_config = self.load_app_config()
                      ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\miniforge3\envs\plant-seg\Lib\site-packages\plantseg\legacy_gui\plantsegapp.py", line 331, in load_app_config
    app_config = load_config(conf_path)["plant_segapp"]
                 ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\miniforge3\envs\plant-seg\Lib\site-packages\plantseg\utils.py", line 15, in load_config
    with config_path.open('r') as file:
         ^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'open'

I didnt have that error before. I updated plantseg, last Tuesday.

the command plantseg --napari works (though the boundaries prediction works on cpu even though I have installed the cuda version, I guess that another thing to worry for another time)

qin-yu commented 4 months ago

Hi @Giannisbiol, thanks for reporting this issue. I made lots of changes without proper tests. Let me try to play with the Legacy GUI and get back to you.

qin-yu commented 4 months ago

Hi @Giannisbiol, thanks again for reporting this issue. The cause of this issue is that I've been refactoring the whole PlantSeg including replacing use of io with pathlib. I should have put a casting line in this function:

https://github.com/hci-unihd/plant-seg/blob/ea78e2a3a49f42177ce016209c8dadcf0b9ef428/plantseg/utils.py#L13-L16

I'll release a fixed version.

qin-yu commented 4 months ago

Hi @Giannisbiol, I made some changes and tested the Legacy GUI with my datasets and models. It should be fixed now. A new version v1.7.1 will be released to conda-forge soon. If you can't wait, please check here to see how to install before it's published on conda-forge: https://hci-unihd.github.io/plant-seg/chapters/getting_started/installation/#install-newer-versions

qin-yu commented 4 months ago

Hi @Giannisbiol, the new version is released. You can install it with the standard command in our documentation.

Giannisbiol commented 4 months ago

Thanks @qin-yu. Looks OK. I havent tried to run anything though, but at least I can access it now. Funny think I have started playing with the Napari interface and I start liking it. Any estimation when a full tutorial will come out about this new feature?

qin-yu commented 4 months ago

That's great! We've invested a lot into the new Napari interface. For tutorial, the other two maintainers are doing it, and you can look at this issue to follow the progress: #177