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

xfomers installation failed #267

Closed
stevensf1998 opened this issue May 2, 2024 · 6 comments
Closed

xfomers installation failed #267

stevensf1998 opened this issue May 2, 2024 · 6 comments

Comments

@stevensf1998
Copy link

Encountering "ModuleNotFoundError: No module named 'torch'" while running pip install -r requirements.txt.

I have created a venv and selected it as interpreter. Is there any work around or solution for this?

python version : 3.12.3

@sagadre
Copy link
Collaborator

sagadre commented May 2, 2024

Hi @stevensf1998, does the issue seem to be with torch or xformers? Could you please post the whole stack trace and also some additional information: linux distro, type of GPUs, cuda version?

@achalddave
Copy link
Collaborator

I think this happens because xformers installation requires torch to already be installed, though somehow it doesn't seem to be a universal issue. Can you try installing torch first, and then installing requirements.txt?

@stevensf1998
Copy link
Author

I think this happens because xformers installation requires torch to already be installed, though somehow it doesn't seem to be a universal issue. Can you try installing torch first, and then installing requirements.txt?

I have pip install "pip3 install torch torchvision" into my venv. and pip list show that i am installed, but when i run pip3 install -r requirements.txt, it still shows me "No module named 'torch'"

`pip install -r requirements.txt
Collecting xformers>=0.0.20 (from -r requirements.txt (line 1))
Using cached xformers-0.0.26.post1.tar.gz (4.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [17 lines of output]
Traceback (most recent call last):
File "/Users/steven/virtual-openlm/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in
main()
File "/Users/steven/virtual-openlm/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/steven/virtual-openlm/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "/private/var/folders/2m/gm9pnqp5539d1l3br1lbb65m0000gn/T/pip-build-env-14vz_duu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/private/var/folders/2m/gm9pnqp5539d1l3br1lbb65m0000gn/T/pip-build-env-14vz_duu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
self.run_setup()
File "/private/var/folders/2m/gm9pnqp5539d1l3br1lbb65m0000gn/T/pip-build-env-14vz_duu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
super().run_setup(setup_script=setup_script)
File "/private/var/folders/2m/gm9pnqp5539d1l3br1lbb65m0000gn/T/pip-build-env-14vz_duu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
exec(code, locals())
File "", line 23, in
ModuleNotFoundError: No module named 'torch'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.`

@stevensf1998
Copy link
Author

Hi @stevensf1998, does the issue seem to be with torch or xformers? Could you please post the whole stack trace and also some additional information: linux distro, type of GPUs, cuda version?

I am using an macbook m1 chip.

Log
`pip install -r requirements.txt
Collecting xformers>=0.0.20 (from -r requirements.txt (line 1))
Using cached xformers-0.0.26.post1.tar.gz (4.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [17 lines of output]
Traceback (most recent call last):
File "/Users/steven/virtual-openlm/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in
main()
File "/Users/steven/virtual-openlm/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/steven/virtual-openlm/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "/private/var/folders/2m/gm9pnqp5539d1l3br1lbb65m0000gn/T/pip-build-env-14vz_duu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/private/var/folders/2m/gm9pnqp5539d1l3br1lbb65m0000gn/T/pip-build-env-14vz_duu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
self.run_setup()
File "/private/var/folders/2m/gm9pnqp5539d1l3br1lbb65m0000gn/T/pip-build-env-14vz_duu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
super().run_setup(setup_script=setup_script)
File "/private/var/folders/2m/gm9pnqp5539d1l3br1lbb65m0000gn/T/pip-build-env-14vz_duu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
exec(code, locals())
File "", line 23, in
ModuleNotFoundError: No module named 'torch'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.`

@achalddave
Copy link
Collaborator

There are some suggestions here that might help. facebookresearch/xformers#740

In particular, maybe try pip3 install wheel before installing requirements.txt.

@stevensf1998
Copy link
Author

There are some suggestions here that might help. facebookresearch/xformers#740

In particular, maybe try pip3 install wheel before installing requirements.txt.

After installing wheel, i manage to run -r requirements.txt

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