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

ModuleNotFoundError: No module named 'torch' #253

Open
lucasjinreal opened this issue May 31, 2023 · 11 comments
Open

ModuleNotFoundError: No module named 'torch' #253

lucasjinreal opened this issue May 31, 2023 · 11 comments

Comments

@lucasjinreal
Copy link

torch actually installed

@xwyzsn
Copy link

xwyzsn commented May 31, 2023

try pip install flash-attn --no-build-isolation. it works for me

@vchiley
Copy link

vchiley commented Jun 2, 2023

this cant be done within a setup.py file in my project...

@REIGN12
Copy link

REIGN12 commented Jun 8, 2023

Maybe regressing to older version of flash-attn is sufficient. I succeed with flash-attn==1.0.4

@sytelus
Copy link

sytelus commented Jun 9, 2023

I'm getting below with --no-build-isolation as well as with 1.0.4.

ModuleNotFoundError: No module named 'torch.utils'

@tridao
Copy link
Contributor

tridao commented Jun 9, 2023

We recommend the Pytorch container from Nvidia, which has all the required tools to install FlashAttention.

@sytelus
Copy link

sytelus commented Jun 9, 2023

I'm getting below with --no-build-isolation as well as with 1.0.4.

ModuleNotFoundError: No module named 'torch.utils'

Looks like the issue was that my anaconda install was in /anaconda and therefore required sudo. After reinstalling anaconda in ~/, --no-build-isolation is working now.

Also, I installed Pytorch nighly build that works with CUDA 12.0.

It would be GREAT to retain ability to build things outside one specific container!

@mattsta
Copy link

mattsta commented Jun 23, 2023

Seeing ModuleNotFoundError: No module named 'torch' during an install is probably because the setup.py is technically incorrect.

python needs more details about dependencies during build time and it's not being threaded through the entire project definition (and it's not great/safe to be calling other installed libraries during install time, etc).

It looks like this is project borrowed a copy of the broken detectron2 setup script which they also haven't fixed for years so the infrastructure contagion is spreading 🫠

also see:

@tridao
Copy link
Contributor

tridao commented Jul 3, 2023

I had to remove pyproject.toml for now since I couldn't find a way to add torch as a build dependencies that work for everyone. Hopefully installation would work for the newest version (1.0.8).

@zerogerc
Copy link

zerogerc commented Jul 3, 2023

Hi, the installation doesn't work for me with 1.0.8. Same error

 ModuleNotFoundError: No module named 'torch'

@kylematoba
Copy link

--no-build-isolation works for me with 1.0.8, torch==2.0.0+cu117.

@jaraco
Copy link

jaraco commented Mar 26, 2024

This issue is a dupe of #246.

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

10 participants