Hi, if I run this program
import streamlit as st
import torch
def main():
st.write(torch.cuda.is_available())
if __name__ == "__main__":
main()
it output’s False. However, if I run python -c 'import torch; print(torch.cuda.is_available())'
it outputs True. Is Cuda not available in streamlit apps?
Hi @Oliver_Wang -
I don’t think there’s any specific reason that Streamlit wouldn’t support Torch, but I don’t know. How are you installing Streamlit and pytorch so that I can try it out myself?
Best,
Randy
I installed pytorch with conda: conda install pytorch torchvision -c pytorch
and streamlit with pip pip install streamlit
. The system is Ubuntu 16.04 with CUDA version 10.0, pytorch 1.4. Thanks.
Try
which pip
which python
which streamlit
My guess is that pip install has put streamlit with a different environment than your conda install is using.
1 Like