Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named 'torch' #9

Open
winkelstein opened this issue Apr 10, 2024 · 4 comments
Open

No module named 'torch' #9

winkelstein opened this issue Apr 10, 2024 · 4 comments

Comments

@winkelstein
Copy link

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
Copy link
Owner

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
Copy link
Author

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
Copy link

obust commented Jun 19, 2024

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
Copy link

obust commented Jul 4, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants