Hi
Cant deploy my app 'cause i get
ModuleNotFoundError: No module named 'torch'
but i have torch>=1.7
in the requirements.txt
Repo: GitHub - angelicaba23/app-super-resolution at dev
Hi
Cant deploy my app 'cause i get
ModuleNotFoundError: No module named 'torch'
but i have torch>=1.7
in the requirements.txt
Repo: GitHub - angelicaba23/app-super-resolution at dev
Hi @Kanak !
Sure! im sending the log file.
repo: GitHub - angelicaba23/app-super-resolution at prod
this is the setup.py i guess…
I dont know if is there any other way to have the package installed to use it, i’ve tried with:
but i get this…
Unfortunately, it’s not clear to me how to solve this issue, as it looks like a package calls out to a subprocess to install torch, which is a non-standard Python way of handling installs which we haven’t planned for on Streamlit Cloud.
Having the same issue when installing torch-scatter, torch-sparse deps:
Collecting torch-scatter==2.0.9
Downloading torch_scatter-2.0.9.tar.gz (21 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status '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-4sqktldq/torch-scatter_5ebc64e92a104e449b5d280d71aa04cd/setup.py", line 8, in <module>
import torch
ModuleNotFoundError: No module named 'torch'
[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.
According to the project page you are supposed to install a binary wheel:
To install the binaries for PyTorch 1.13.0, simply run
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.13.0+${CUDA}.html
where
${CUDA}
should be replaced by eithercpu
,cu116
, orcu117
depending on your PyTorch installation.
This means you have to add two lines to your requirements.txt
(adjust according to your pytorch installation):
-f https://data.pyg.org/whl/torch-1.13.0+cpu.html
torch-scatter
Thanks. @Goyo It has been fixed.
I face the same problem when torch-sparse in my code too,have you fix it?
See previous answer from @Goyo and here:
thank you ,it did make some differences!
Have you tried to append these lines to your requirements.txt file:
torch==1.12.1
torch-geometric==2.1.0
-f https://data.pyg.org/whl/torch-1.12.1+cpu.html
torch-scatter==2.0.9
-f https://data.pyg.org/whl/torch-1.12.1+cpu.html
torch-sparse==0.6.16
I ran streamlit run but it sill same error ModuleNotFoundError: No module named ‘torch’
I had the same error, in the end I had to add torchvision to requirements.txt and it was working.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.