peng-lab / BaSiCPy

MIT License
66 stars 22 forks source link

Installation of BaSiCPy fails in environment with recent version of setuptools #100

Closed SilverViking closed 1 year ago

SilverViking commented 2 years ago

In a virtual environment with setuptools >= 61.0.0 installation of BaSiCPy fails with an error. It does work with setuptools < 61.0.0 however. The problem was encountered on Windows, but should also occur on other platforms.

On Windows the problem can be reproduced as follows:

conda create -n test python=3.10
conda activate test
git clone https://github.com/peng-lab/PyBaSiC.git
cd PyBaSiC
pip3 install -e .

This results in the following error:

Obtaining file:///C:/Users/johndoe/PyBaSiC
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      error: Multiple top-level packages discovered in a flat-layout: ['figures', 'pybasic', 'Notebooks', 'ExampleData'].

      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: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

The error is due to a change first introduced in setuptools 61.0.0. In the environment created above, we automatically got setuptools 61.2.0.

To fix the problem, a (probably small) change to BaSiCPy's setup.py will be needed.

As a temporary workaround, one can install the package anyway by reverting to an older version of setuptools:

pip install setuptools==60.10.0
pip install -e .

BaSiCPy installation then works:

Obtaining file:///C:/Users/johndoe/PyBaSiC
  Preparing metadata (setup.py) ... done
Collecting scipy>=1.3
  Using cached scipy-1.9.0-cp310-cp310-win_amd64.whl (38.6 MB)
...
Installing collected packages: pyparsing, pillow, numpy, networkx, tifffile, scipy, PyWavelets, packaging, imageio, scikit-image, pybasic
  Running setup.py develop for pybasic
Successfully installed PyWavelets-1.3.0 imageio-2.21.1 networkx-2.8.5 numpy-1.23.2 packaging-21.3 pillow-9.2.0 pybasic-0.0.0 pyparsing-3.0.9 scikit-image-0.19.3 scipy-1.9.0 tifffile-2022.8.12
yfukai commented 2 years ago

Hi, thanks @SilverViking for your comment! The main branch is now unmaintained, and we are now working on the dev branch. The beta version will appear in PyPi in a couple of days. Please be patient until it becomes available!

SilverViking commented 2 years ago

Great news @yfukai! Looking forward to trying out the new version. Thanks a lot for your work.

donovanr commented 2 years ago

is there a beta release on PyPi or is it recommended to install from source on the dev branch?

yfukai commented 1 year ago

Sorry we're a bit late but I expect it will come in a week on PyPi (hopefully!)

yfukai commented 1 year ago

We're sorry to be late, but now the beta 1.0.1 version is on PyPi! We welcome any feedback for the beta version.