sknetwork-team / scikit-network

Graph Algorithms
Other
606 stars 66 forks source link

Issues installing in aarch64 -- source distributions and some wheels missing for 0.32.x releases #576

Closed brianpiper closed 4 weeks ago

brianpiper commented 3 months ago

Description

When trying to install scikit-network in Python 3.10, I get an installation error.

What I Did

(macOS host)

$ podman run --rm -ti --platform linux/aarch64 python:3.10.14-slim-bullseye bash
... ... 
# pip install scikit-network
Collecting scikit-network
  Downloading scikit-network-0.31.0.tar.gz (1.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 11.1 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... 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-3lunwi5o/scikit-network_2d437ca01ce343a6aea4be995655d0f9/setup.py", line 12, 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

× 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.

Two (related?) issues I noticed while looking at the release files for scikit-network on https://pypi.org/project/scikit-network/.

  1. For the 0.32.x releases, no source distributions are available, only wheels
  2. None of the wheels seem to target aarch64 (for comparison, scikit-learn and numpy both have wheels targeting this platform).

When trying different platforms, it seems to work. My hypothesis is that setup.py might need changes to avoid the import error, and users installing from wheels avoid this setup.py error. But I confess, I'm not super familiar with wheels, so this might be unrelated or unhelpful, sorry if it's just noise.

tbonald commented 1 month ago

Hello, Could you please try with the latest version? Note that the source distributions are available now. Thanks.

brianpiper commented 1 month ago

Unfortunately, this platform and source distributions still aren't working with version 0.33.0, I'm getting the same error. I think it's the last paragraph I mentioned above that causes issues. Based on the error message, I think this is the issue:

It seems to work if I pip install numpy separately first, and that's okay for local development, but doesn't work so well in fresh installs when there's just one pip install call made (like in a CI system).

I can also replicate this independent of the platform in a fresh virtual environment, no docker container involved, just macOS, if I exclude installation via wheel and force installation from the source distribution:

$ pip install scikit-network --no-binary :all:
# ... ... (downloads 0.33.0.tar.gz)

  Preparing metadata (setup.py) ... 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 "/private/var/folders/zr/fyfc854170g0gyl35z2hw6fw0000gn/T/pip-install-9j8yq6s7/scikit-network_06ebec5299ea46fb8deb0c169d3d37bb/setup.py", line 12, 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

× 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.

I'm not totally sure of the right approach to address it. I tried delaying the numpy import, but didn't manage to land on a full solution.

mclegrand commented 1 month ago

Thanks for the report! I think your assessment is right, and I managed to reproduce the issue in a fresh venv.

In theory, https://github.com/sknetwork-team/scikit-network/commit/0af7ce2887df0872818ca5ddc7a2ec6d8a5989d6 should work as a "delay numpy import" method, can you confirm (cannot reproduce the issue with pip install . with the commit)

edit : this creates issues with cython... I'll try to migrate to pyproject.toml which should work, this will need a bit more time

mclegrand commented 1 month ago

OK, take 2 with pyproject.toml in https://github.com/sknetwork-team/scikit-network/commit/7a7a868c1996feb03397ea369293bc8719341a97 should be better

tbonald commented 1 month ago

Should work now. Thanks @mclegrand

brianpiper commented 4 weeks ago

Yes, I think this does it for me on macOS, at least! Great work, and thank you!

At risk of being really annoying, any ideas when this change will make it into a release? I'm not in a particular rush myself, just curious.

tbonald commented 4 weeks ago

In the coming days, hopefully :-) Thanks.

tbonald commented 3 weeks ago

In the coming days, hopefully :-) Thanks.

Done.

brianpiper commented 3 weeks ago

It looks like we're missing source distributions again in 0.33.1, but they were present in 0.33.0. Want a new issue opened?

tbonald commented 3 weeks ago

Done. Thanks!