shawntan / scattermoe

Triton-based implementation of Sparse Mixture of Experts.
Apache License 2.0
150 stars 10 forks source link

No module named 'torch' #9

Open winkelstein opened 3 months ago

winkelstein commented 3 months ago

I've tried to install scattermoe and get this error:

ModuleNotFoundError: No module named 'torch'
      [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.

Torch is already installed in my environment. All libraries is up-to-date.

shawntan commented 3 months ago

This looks like it might be some local configuration issues. Don't think I can help here without more context. Was this when running pip install -e .?

winkelstein commented 2 months ago

This looks like it might be some local configuration issues. Don't think I can help here without more context. Was this when running pip install -e .?

I've tried global python environment, venv and conda environment on Mac OS. All of them give this issue.

obust commented 4 weeks ago

the problem is due to the unused import scattermoe in setup.py https://github.com/shawntan/scattermoe/blob/main/setup.py#L3

during pip install,setup.py imports scattermoe which leads to the following traceback because torch cannot be found at built time.

        File "/x/y/z/scattermoe/__init__.py", line 1, in <module>
          from . import kernels
        File "/x/y/z/scattermoe/kernels/__init__.py", line 1, in <module>
          from . import ops
        File "/x/y/z/scattermoe/kernels/ops.py", line 1, in <module>
          import torch
      ModuleNotFoundError: No module named 'torch'

Removing https://github.com/shawntan/scattermoe/blob/main/setup.py#L3 fixes it for me

obust commented 1 week ago

@shawntan would you consider removing the import scattermoe in setup.py https://github.com/shawntan/scattermoe/blob/main/setup.py#L3 ?