I’m trying to use Streamlit sharing to deploy an st_app.py file from my Github repo. I think it’s may be an environment issue or something but when I try to deploy the app, it gives the ModuleNotFound error.
In the beginning, I created the requirements.txt from pipreqs but that was giving this error so I tried to change the requirements.txt file by doing pip freeze instead and copy-pasting the entire thing into requirements (yes I know that you shouldn’t include packages that come pre-installed with Python but I just wanted to try it) and that didn’t do it either. I’ll give an idea of the imports I’m doing and the requirements file.
I would appreciate a detailed, simple, explain-like-I’m-five explanation of how Streamlit Sharing looks for and installs packages and all. Supposedly, one would list all the packages in requirements.txt and try and deploy and that should do it, but I think one also needs to have those packages installed in the local machine’s environment.
If that is so, the problem for me is that I have included all the packages for my project in a separate environment so I don’t know how to tell Streamlit to look in a particular environment for the packages.
Here’s a snippet of the imports I’m doing:
import streamlit as st
import numpy as np
import keras
import numpy as np
import cv2
from pydub import AudioSegment
from pydub.playback import play
import dlib
import json
import nltk
nltk.download('punkt')
nltk.download('wordnet')
from nltk.stem.lancaster import LancasterStemmer
from nltk.stem import WordNetLemmatizer
import random
import pickle
And here is my requirements.txt:
streamlit==0.71.0
numpy==1.18.1
Keras==2.4.3
tensorflow==2.3.1
opencv_python_headless==4.4.0.46
pydub==0.24.1
nltk==3.4.5
dlib==19.21.0
protobuf==3.14.0
It isn’t possible for me to install all these packages in the base environment since the dlib package can get installed only inside a virtual env on macOS.
Also, I’m working on another person with this who is on Windows and has their own environment and all. So does it matter which one of us tries to run the app deployment?
I know I asked a ton of questions but I would like some clarification on how Streamlit Deployment works in terms of packages and all because the documentation doesn’t cover any of that right now.
I can’t add the entire error message but I’ll add some relevant lines:
File "/usr/local/lib/python3.7/subprocess.py", line 488, in run
```
with Popen(*popenargs, **kwargs) as process:
```
```
File "/usr/local/lib/python3.7/subprocess.py", line 800, in __init__
```
```
restore_signals, start_new_session)
```
```
File "/usr/local/lib/python3.7/subprocess.py", line 1551, in _execute_child
```
```
raise child_exception_type(errno_num, err_msg, err_filename)
```
```
FileNotFoundError: [Errno 2] No such file or directory: 'cmake': 'cmake'
```
```
```
```
During handling of the above exception, another exception occurred:
```
```
```
```
Traceback (most recent call last):
```
```
File "<string>", line 1, in <module>
```
```
File "/tmp/pip-install-i05nepcf/dlib/setup.py", line 262, in <module>
```
```
'Topic :: Software Development',
```
```
File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
```
```
return distutils.core.setup(**attrs)
```
```
File "/usr/local/lib/python3.7/distutils/core.py", line 148, in setup
```
```
dist.run_commands()
```
```
File "/usr/local/lib/python3.7/distutils/dist.py", line 966, in run_commands
```
```
self.run_command(cmd)
```
```
File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
```
```
cmd_obj.run()
```
```
File "/usr/local/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
```
```
return orig.install.run(self)
```
```
File "/usr/local/lib/python3.7/distutils/command/install.py", line 545, in run
```
```
self.run_command('build')
```
```
File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command
```
```
self.distribution.run_command(command)
```
```
File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
```
```
cmd_obj.run()
```
```
File "/usr/local/lib/python3.7/distutils/command/build.py", line 135, in run
```
```
self.run_command(cmd_name)
```
```
File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command
```
```
self.distribution.run_command(command)
```
```
File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
```
```
cmd_obj.run()
```
```
File "/tmp/pip-install-i05nepcf/dlib/setup.py", line 129, in run
```
```
cmake_version = self.get_cmake_version()
```
```
File "/tmp/pip-install-i05nepcf/dlib/setup.py", line 125, in get_cmake_version
```
```
"\n*******************************************************************\n")
```
```
RuntimeError:
```
```
*******************************************************************
```
```
CMake must be installed to build the following extensions: _dlib_pybind11
```
```
*******************************************************************
```
```
```
```
----------------------------------------
```
```
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-i05nepcf/dlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-i05nepcf/dlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --no-user-cfg install --record /tmp/pip-record-5ig6to80/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/appuser/.local/include/python3.7m/dlib Check the logs for full command output.
```
```
[manager] Processed dependencies!
```
```
2020-11-21 18:10:33.750647: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
```
```
2020-11-21 18:10:33.750697: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
```
```
```
```
You can now view your Streamlit app in your browser.
```
```
```
```
Network URL: http://10.12.114.26:8501
```
```
External URL: http://34.83.49.151:8501
```