Skip to content

Quick Start Error: (container log with python closure container) TypeError: 'str' object does not support item assignment #573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
FrankY-Sa opened this issue Sep 18, 2018 · 4 comments

Comments

@FrankY-Sa
Copy link

python3.5 clipper-develop quick_start: sum-model

python_deployer.deploy_python_closure(clipper_conn, name="sum-model", version=1, input_type="doubles", func=feature_sum, pkgs_to_install=['numpy','scipy'])

Hi,
I tried deploying sum-model gets stuck on

18-09-18:10:13:51 INFO [docker_container_manager.py:257] Found 0 replicas for sum-model:1. Adding 1

I print the docker's healthy status (unhealthy)

18-09-18:10:13:52 INFO [docker_container_manager.py:272] Container status: running, Docker healthy status: starting
18-09-18:10:13:55 INFO [docker_container_manager.py:272] Container status: running, Docker healthy status: unhealthy

The container log shows that

Starting Python Closure container
Connecting to Clipper with default port: 7000
Traceback (most recent call last):
File "/container/python_closure_container.py", line 56, in
rpc_service.get_input_type())
File "/container/python_closure_container.py", line 28, in init
self.predict_func = load_predict_func(predict_path)
File "/container/python_closure_container.py", line 17, in load_predict_func
return cloudpickle.load(serialized_func_file)
File "/usr/local/lib/python3.5/site-packages/cloudpickle/cloudpickle.py", line 1044, in _make_skel_func
base_globals['builtins'] = builtins
TypeError: 'str' object does not support item assignment
Encountered error not related to missing packages. Please refer to the container log to diagnose.

Any help would be really appreciated!

@withsmilo
Copy link
Collaborator

@FrankY-Sa : Please share your feature_sum function with me.

@FrankY-Sa
Copy link
Author

FrankY-Sa commented Sep 18, 2018

@withsmilo

clipper_conn.register_application(name="hello-world", input_type="doubles", default_output="-1.0", slo_micros=100000)

def feature_sum(xs):
return [str(sum(x)) for x in xs]

python_deployer.deploy_python_closure(clipper_conn, name="sum-model", version=1, input_type="doubles", func=feature_sum, pkgs_to_install=['numpy','scipy'])

@withsmilo
Copy link
Collaborator

withsmilo commented Sep 18, 2018

@FrankY-Sa :
I think that the latest release(v0.5.6) of cloudpickle causes this problem. (link) Please downgrade it from v0.5.6 to v0.5.3 by applying this patch.

diff --git a/dockerfiles/Py35RPCDockerfile b/dockerfiles/Py35RPCDockerfile
index 79612a2..883d448 100644
--- a/dockerfiles/Py35RPCDockerfile
+++ b/dockerfiles/Py35RPCDockerfile
@@ -9,7 +9,7 @@ RUN mkdir -p /model \
       && apt-get update \
       && apt-get install -y libzmq3 libzmq3-dev redis-server libsodium13 build-essential

-RUN pip install cloudpickle==0.5.* pyzmq==17.0.* prometheus_client==0.1.* \
+RUN pip install cloudpickle==0.5.3 pyzmq==17.0.* prometheus_client==0.1.* \
     pyyaml==3.12.* jsonschema==2.6.* redis==2.10.* psutil==5.4.* flask==0.12.2 \
     numpy==1.14.*

@FrankY-Sa
Copy link
Author

@withsmilo Thanks! others encountered the issue. The reason is that my local cloudpickle version(0.5.5) is higher than the one used in docker container(0.5.2), making them incompatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants