MIC-DKFZ / nnUNet

Apache License 2.0
5.91k stars 1.76k forks source link

pip install -e . error: subprocess-exited-with-error #1866

Closed xiongjiuli closed 5 months ago

xiongjiuli commented 10 months ago

(nnunet2) [xxx@bme_login2 nnUNet]$ pip install -e . Obtaining file:///xxx/data/xxx/nnUNet Installing build dependencies ... done Checking if build backend supports build_editable ... done Getting requirements to build editable ... error error: subprocess-exited-with-error

× Getting requirements to build editable did not run successfully. │ exit code: 1 ╰─> [14 lines of output] error: Multiple top-level packages discovered in a flat-layout: ['log', 'nnunetv2', 'DataFrame'].

  To avoid accidental inclusion of unwanted files or directories,
  setuptools will not proceed with this build.

  If you are trying to create a single distribution with multiple packages
  on purpose, you should not rely on automatic discovery.
  Instead, consider the following options:

  1. set up custom discovery (`find` directive with `include` or `exclude`)
  2. use a `src-layout`
  3. explicitly set `py_modules` or `packages` with a list of names

  To find more information, look for "package discovery" on setuptools docs.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build editable did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

FabianIsensee commented 10 months ago

Could it be that you have added additional stuff to the nnU-Net code? It seems like it is detecting multiple packages in the folder where the setup.py is located. Those are not present in the master

FabianIsensee commented 9 months ago

Hey, how are things going? Have you been able to install everything?

xyjpang commented 7 months ago

I encountered the same problem as well. Initially, after cloning the project, I executed pip install -e ., and there were no issues. However, after adding my own DATASET directory, when I tried to convert the dataset using the command nnUNet_convert_decathlon_task -i /root/siton-tmp/nnUNet/nnUNet/DATASET/nnUNet_raw/Task01_BrainTumour, I encountered an error: -bash: nnUNet_convert_decathlon_task: command not found. Following your previous advice, I re-executed pip install -e . only to encounter the error error: subprocess-exited-with-error. Even after removing the DATASET directory and re-executing pip install -e ., it still indicates that all packages have been successfully installed.

Hey, how are things going? Have you been able to install everything?

FabianIsensee commented 7 months ago

Hey, since nnU-Net v2 the command is called nnUNetv2_convert_MSD_dataset. Can you please try that?

FabianIsensee commented 7 months ago

please DO NOT place downloaded MSD datasets into the nnUNet_raw folder

xyjpang commented 7 months ago

Hey, since nnU-Net v2 the command is called nnUNetv2_convert_MSD_dataset. Can you please try that? Yes, I realized that I used the wrong command. But I still encounter the following issue:

(base) root@bc8cc2d64fae:~# nnUNetv2_convert_MSD_dataset -i /root/siton-tmp/data/Task01_BrainTumour multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/opt/conda/lib/python3.10/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/opt/conda/lib/python3.10/multiprocessing/pool.py", line 51, in starmapstar return list(itertools.starmap(args[0], args[1])) File "/root/siton-tmp/nnUNet/nnUNet/nnunetv2/dataset_conversion/convert_MSD_dataset.py", line 15, in split_4d_nifti img_itk = sitk.ReadImage(filename) File "/opt/conda/lib/python3.10/site-packages/SimpleITK/extra.py", line 375, in ReadImage return reader.Execute() File "/opt/conda/lib/python3.10/site-packages/SimpleITK/SimpleITK.py", line 8430, in Execute return _SimpleITK.ImageFileReader_Execute(self) RuntimeError: Exception thrown in SimpleITK ImageFileReader_Execute: /tmp/SimpleITK/Code/IO/src/sitkImageReaderBase.cxx:105: sitk::ERROR: Unable to determine ImageIO reader for "/root/siton-tmp/data/Task01_BrainTumour/imagesTr/BRATS_001.nii.gz" """

FabianIsensee commented 7 months ago

This is strange, it appears like SImpleITK cannot read the images. Please verify that with

import SimpleITK as sitk
img = sitk.ReadImage("/root/siton-tmp/data/Task01_BrainTumour/imagesTr/BRATS_001.nii.gz")

Best, Fabian

FabianIsensee commented 6 months ago

Have you been able to solve this?

namhoangle commented 5 months ago

@FabianIsensee Can you please reopen this issue?

I'm having this exact issue when I try to update my local repository to your latest commit.

Detail description: Before today, I used a nnUNetv2 commit from some time in January 2024. I have since added a number of new directories and files inside the main repo directory. Today, I updated my local repo to the lastest commit in your base nnUNetv2. I ran $ pip install -e . again to install the new packages which are new in pyproject.toml. Then I ran into the issue above.

The latest pyproject.toml have new dependencies, ie: "batchgeneratorsv2" "einops"

What is the correct way to "update" my current local installation to the lastest installation configurations specified in pyproject.toml?

I think this problem is caused by the foreign additional stuff I added to my project.

Can I just pip install the missing packages?