eis_toolkit icon indicating copy to clipboard operation
eis_toolkit copied to clipboard

Issue with adding somoclu package

Open nmaarnio opened this issue 1 year ago • 7 comments

somoclu is a Python package for self-organizing maps and was intended to be used for issue #179 . However, when trying to add somoclu with poetry add somoclu, the following error occurs:

Installing somoclu (1.7.6): Failed

ChefBuildError

Backend subprocess exited when trying to invoke get_requires_for_build_wheel

Traceback (most recent call last): File "/home/niko/.local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in main() File "/home/niko/.local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/home/niko/.local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/tmp3f83aa7z/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/tmp/tmp3f83aa7z/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires self.run_setup() File "/tmp/tmp3f83aa7z/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 480, in run_setup super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script) File "/tmp/tmp3f83aa7z/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup exec(code, locals()) File "", line 4, in ModuleNotFoundError: No module named 'numpy'

So somehow somoclu doesn't recognize that numpy is present and installed, even if it is.

However, when I tried pip install somoclu in a Python venv where I have installed the current EIS Toolkit, that worked.

It would be good to solve this issue in the near future so that we have time to either convert the notebook by @iiroseppa into an EIS Toolkit function, or create a whole new SOM implementation if somoclu cannot be reliably included in the toolkit.

nmaarnio avatar Dec 20 '23 10:12 nmaarnio

Tagging you here @nialov in case you have time and think you could potentially solve this somoclu installation problem.

nmaarnio avatar Dec 20 '23 10:12 nmaarnio

Issue is somoclu requiring numpy in the build environment for the setup.py install that is invoked by poetry. pip seems to be less strict about the build environment and it seems to include numpy during the invocation. This problem would be avoided if somoclu provided Python wheels on https://pypi.org/project/somoclu/#files but only the source distribution is given so the setup.py install step is required.

See e.g. https://stackoverflow.com/a/72777145

Options to support poetry install:

  1. Make a pull request for somoclue that adds numpy to [build-system] requirements.
  2. Make a pull request for somoclu to build wheels and upload them to pypi

nialov avatar Dec 20 '23 11:12 nialov

So solving is not easy, I would weight the need for the package with the required time to fix these issues. conda install works fine as I understand?

nialov avatar Dec 20 '23 11:12 nialov

https://github.com/peterwittek/somoclu/issues/165

nialov avatar Dec 20 '23 11:12 nialov

Thanks for looking into the matter. These fixes don't seem very difficult and I noticed you made a comment in the somoclu issue, but I guess it ultimately comes down to how quickly / will somoclu maintainers accept one of these suggestions. I cannot really assess how much this package is needed or how important it is to include SOM in EIS Toolkit, as I am not familiar with either the method or the package.

And yes, at least I managed to install somoclu with conda. But if this addition breaks the Poetry env (and will affect end users that choose to use Poetry?), it's problematic

nmaarnio avatar Dec 21 '23 10:12 nmaarnio

It is a maintenance problem on the part of somoclu. The packaging tools for Python develop and they have not updated accordingly. It looks like a complex package (many non-Python external library dependencies) so it is worrying if the maintenance is not keeping up with new developments as there is many parts that can break now and in the future.

nialov avatar Dec 21 '23 11:12 nialov

Installation of somoclu failed due to a missing dependency, specifically the numpy module. Make sure that your pip and setuptools are up-to-date by running: * pip install --upgrade pip setuptools. Try Installing somoclu Again: * poetry add somoclu

Neethuharii avatar Feb 17 '24 16:02 Neethuharii