PLEASE HELP! Issue with PyTorch Installation on Streamlit.app

Dear Streamlit.app Forum Support Team,

I am writing to bring to your attention an issue I encountered while attempting to install PyTorch on the Streamlit.app. I am experiencing difficulties with the installation process and would appreciate your assistance in resolving this matter.

Upon attempting to install PyTorch, specifically version 1.8.0+cpu, I encountered the following error message:

ERROR: Could not find a version that satisfies the requirement torch==1.8.0+cpu (from versions: 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0, 1.10.1, 1.10.2, 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 2.0.0, 2.0.1)

ERROR: No matching distribution found for torch==1.8.0+cpu

WARNING: You are using pip version 22.0.3; however, version 23.1.2 is available.

You should consider upgrading via the ‘/home/appuser/venv/bin/python -m pip install --upgrade pip’ command.

I have taken the following steps to resolve the issue but without success:

  1. Verified that the version number specified for PyTorch is correct.
  2. Ensured that my Python environment is compatible with PyTorch 1.8.0.
  3. Upgraded pip to the latest version using the command /home/appuser/venv/bin/python -m pip install --upgrade pip.
  4. Attempted to install alternative versions of PyTorch, such as 1.7.1, but encountered the same error.

I kindly request your assistance in resolving this issue as PyTorch is a crucial component for my project. If there are any specific steps or recommendations you can provide to successfully install PyTorch on Streamlit.app, I would greatly appreciate it.

Additionally, I would like to inquire if Streamlit itself is installed on the platform. Could you please confirm if Streamlit is available for use on Streamlit.app?

Thank you for your attention to this matter. I look forward to your prompt response and resolution of the PyTorch installation issue.

Hi @mcjill,

Thanks for sharing this question. Can you confirm that you’re using Streamlit Community Cloud to deploy your app? If so, can you please share the link to your app and the public GitHub repo?

I can confirm that Streamlit gets installed by default when you deploy an app on Community Cloud. It doesn’t sound like Streamlit not being installed is the issue in this case.

hey hi ! welcome to community there might to multiple issue for such error but

  1. Check your requirements.txt to ensure torch or torch==<version> is correctly specified.

  2. Explicitly specify a PyTorch version in requirements.txt, like torch==1.10.0.

  3. Ensure Streamlit Sharing settings allow for additional package installations.

  4. If using conda, create an environment.yml with the PyTorch version.

  5. Examine Streamlit app logs for details on PyTorch installation failure.

  6. Review Streamlit Sharing documentation or forums for known issues.

  7. Confirm Python version compatibility with PyTorch.

  8. Consider using a Docker container for full environment control.

Example requirements.txt:

torch==1.10.0
torchvision==0.11.1

Adapt version numbers based on your requirements. If the issue persists, provide error details for further assistance.