peterwittek / somoclu

Massively parallel self-organizing maps: accelerate training on multicore CPUs, GPUs, and clusters
https://peterwittek.github.io/somoclu/
MIT License
266 stars 69 forks source link

Numpy requirement in setup.py #165

Open yanzastro opened 1 year ago

yanzastro commented 1 year ago

I'm trying to use somoclu in a project. When I make a PR of my project to a github repo, it failed the codecov test and the readthedoc build because to install somoclu I need numpy in the first place (as there is a line import numpy in the setup.py file of somoclu)

This is not a problem of somoclu itself, but that codecov and Read the Docs do not have numpy. I'm wondering if any small modification could be made to handle this problem? Thanks in advance!

xgdgsc commented 1 year ago

Cannot add deps first? https://github.com/codecov/example-python/actions/runs/2456178653/workflow

yanzastro commented 1 year ago

Thanks for your reply! We tried to modify workflow and codecov works fine now, but read-the-docs still raises an error:

Collecting numpy
  Downloading numpy-1.23.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.1/17.1 MB 77.3 MB/s eta 0:00:00
Requirement already satisfied: sphinx in /home/docs/checkouts/readthedocs.org/user_builds/my/project/lib/python3.9/site-packages (from -r docs/requirements.txt (line 5)) (5.2.2)
...
Collecting somoclu
  Downloading somoclu-1.7.5.1.tar.gz (6.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.1/6.1 MB 154.0 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-yjrktktm/somoclu_f38134a40b7747e6a0372e4bc55abcef/setup.py", line 4, in <module>
          import numpy
      ModuleNotFoundError: No module named 'numpy'
      [end of output]

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

We are confused since numpy is explicitly included in our requirements.txt, and the build also installed numpy before somoclu (please see the error message above)...

xgdgsc commented 1 year ago

https://github.com/readthedocs/readthedocs.org/issues/1639#issuecomment-139237619

Tesax123 commented 9 months ago

This issue is keeping us from being able to use somoclu. We are not able to install numpy first (Databricks Model Serving).

@yanzastro Did you perhaps find a solution?

nialov commented 9 months ago

As I see it the issue could be avoided if wheels were uploaded of somoclu to pypi. Other solution is adding a pyproject.toml file next to setup.py with the contents:

[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools", "wheel", "numpy"]  # PEP 508 specifications.

I.e. numpy is explicitly added to the required packages for building. I have not tested these changes but something similar should work.