AllenCell / EMT_data_analysis

This repo contains code for EMT deliverable data analysis and has dependencies associated with output from EMT_image_analysis repo.
Other
1 stars 0 forks source link

Installation error if nuclei localization was previously run #8

Open pgarrison opened 1 month ago

pgarrison commented 1 month ago

Steps to reproduce

  1. Simulate a previous (partial) run of Nuclei_localization.py: mkdir -p emt_tmp/nuclei_localization
  2. Follow the virtual environment creation steps from the README.md: a. python -m venv venv b. source venv/bin/activate c. pip install -e . The final step produces this error:

    
    Looking in indexes: https://artifactory.corp.alleninstitute.org/artifactory/api/pypi/pypi-virtual/simple
    Obtaining file:///home/philip.garrison/EMT_data_analysis
    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: ['emt_tmp', 'EMT_data_analysis'].
    
      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.


# Version info
```bash
$ python --version && pip --version
Python 3.11.0
pip 24.2 from /home/philip.garrison/EMT_data_analysis/venv-pip/lib/python3.11/site-packages/pip (python 3.11)
pgarrison commented 1 month ago

I believe this issue only happens if Nuclei_localization.py fails or is canceled in the middle. If it succeeds, I believe it will delete the emt_tmp directory.

One possible solution may be to use a tempfile.TemporaryDirectory() context manager instead of manually creating & deleting emt_tmp