BentoML: Docker container stopped working with: ModuleNotFoundError: No module named 'ruamel'
Describe the bug Without any change to my code, new Docker containers aren’t working anymore. When I try to run it, I get:
Traceback (most recent call last):
File "/opt/conda/bin/bentoml", line 5, in <module>
from bentoml.cli import cli
File "/opt/conda/lib/python3.6/site-packages/bentoml/__init__.py", line 27, in <module>
from bentoml.saved_bundle import load, save_to_dir
File "/opt/conda/lib/python3.6/site-packages/bentoml/saved_bundle/__init__.py", line 15, in <module>
from bentoml.saved_bundle.bundler import save_to_dir
File "/opt/conda/lib/python3.6/site-packages/bentoml/saved_bundle/bundler.py", line 31, in <module>
from bentoml.utils.usage_stats import track_save
File "/opt/conda/lib/python3.6/site-packages/bentoml/utils/usage_stats.py", line 22, in <module>
from ruamel.yaml import YAML
ModuleNotFoundError: No module named 'ruamel'
To Reproduce Steps to reproduce the behavior:
- Create a BentoService with:
@env(conda_channels=["conda-forge"], conda_dependencies=["libpq=12.3"],
pip_dependencies=["mxnet==1.4.1", "gluonts==0.5", "numpy==1.16", "pandas==1.0.5", "holidays==0.9.12",
"python-dateutil==2.8", "convertdate==2.2", "pydantic==1.6", "luigi==2.8", "sqlalchemy==1.3",
"psycopg2==2.8"])
- Pack the model and build the Docker Container
- When the container is being built, we can see the following package being installed while updating the conda environment: ruamel_yaml-0.15.87
- When trying to run the container, ModuleNotFoundError: No module named ‘ruamel’ appears. If you open bash into the container, you can see that the ruamel is installed, but can’t be imported.
Expected behavior It was expected to run successfully.
Screenshots/Logs
Resulting environment.yml:
name: bentoml-DemandForecaster
channels:
- defaults
- conda-forge
dependencies:
- python=3.6.11
- pip
- libpq=12.3
Log of installed packages through conda:
Downloading and Extracting Packages
idna-2.10 | 50 KB | ########## | 100%
python-3.6.11 | 34.1 MB | ########## | 100%
yaml-0.2.5 | 75 KB | ########## | 100%
cryptography-2.9.2 | 556 KB | ########## | 100%
pysocks-1.7.1 | 30 KB | ########## | 100%
krb5-1.17.1 | 1.3 MB | ########## | 100%
pyopenssl-19.1.0 | 48 KB | ########## | 100%
pycparser-2.20 | 94 KB | ########## | 100%
cffi-1.14.0 | 223 KB | ########## | 100%
sqlite-3.32.3 | 1.4 MB | ########## | 100%
tk-8.6.10 | 3.0 MB | ########## | 100%
conda-4.8.3 | 2.8 MB | ########## | 100%
wheel-0.34.2 | 51 KB | ########## | 100%
pycosat-0.6.3 | 82 KB | ########## | 100%
pip-20.2.1 | 1.8 MB | ########## | 100%
openssl-1.1.1g | 2.5 MB | ########## | 100%
xz-5.2.5 | 341 KB | ########## | 100%
tqdm-4.42.1 | 56 KB | ########## | 100%
python_abi-3.6 | 4 KB | ########## | 100%
urllib3-1.25.9 | 103 KB | ########## | 100%
ruamel_yaml-0.15.87 | 270 KB | ########## | 100%
conda-package-handli | 797 KB | ########## | 100%
libpq-12.3 | 2.6 MB | ########## | 100%
certifi-2020.6.20 | 156 KB | ########## | 100%
requests-2.24.0 | 56 KB | ########## | 100%
setuptools-49.2.1 | 736 KB | ########## | 100%
ca-certificates-2020 | 125 KB | ########## | 100%
readline-8.0 | 356 KB | ########## | 100%
chardet-3.0.4 | 180 KB | ########## | 100%
brotlipy-0.7.0 | 323 KB | ########## | 100%
six-1.15.0 | 13 KB | ########## | 100%
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Error when trying to import bentoml:
Traceback (most recent call last):
File "/opt/conda/bin/bentoml", line 5, in <module>
from bentoml.cli import cli
File "/opt/conda/lib/python3.6/site-packages/bentoml/__init__.py", line 27, in <module>
from bentoml.saved_bundle import load, save_to_dir
File "/opt/conda/lib/python3.6/site-packages/bentoml/saved_bundle/__init__.py", line 15, in <module>
from bentoml.saved_bundle.bundler import save_to_dir
File "/opt/conda/lib/python3.6/site-packages/bentoml/saved_bundle/bundler.py", line 31, in <module>
from bentoml.utils.usage_stats import track_save
File "/opt/conda/lib/python3.6/site-packages/bentoml/utils/usage_stats.py", line 22, in <module>
from ruamel.yaml import YAML
ModuleNotFoundError: No module named 'ruamel'
Environment:
- OS: Linux Manjaro
- Python/BentoML Version: Python 3.6.11, BentoML 0.8.5
Additional context As a workaround, I added ruamel.yaml=0.16 in conda_dependencies.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 21 (11 by maintainers)
@fernandocamargoti @aslom We just released BentoML
0.8.6
It contains the fix from #1012.I am closing this for now. Feel free to reopen if you still encounter this bug.
Fixed the typo missing
]
and that finally made it work 😃