# 'serve start' from command line fails

**URL:** <https://discuss.ray.io/t/serve-start-from-command-line-fails/2425>\
**Category:** Ray Serve\
**Created:** [June 7, 2021, 12:57am UTC](https://discuss.ray.io/t/serve-start-from-command-line-fails/2425 "2021-06-07T00:57:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![blshao84](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/blshao84/32/1010_2.png) [@blshao84](https://discuss.ray.io/u/blshao84)\
**Post date:** [June 7, 2021, 12:57am UTC](https://discuss.ray.io/t/serve-start-from-command-line-fails/2425/1 "2021-06-07T00:57:12Z")

</div>

hi, I’m playing with the nightly built version of ray. I got an error, when I tried ‘serve start’ from the command line:

'RuntimeError: serve.start(detached=True) should not be called in anonymous Ray namespaces because you won’t be able to reconnect to the Serve instance after the script exits. If you want to start a long-lived Serve instance, provide a namespace when connecting to Ray. See the documentation for more details: [Using Namespaces — Ray v2.0.0.dev0](https://docs.ray.io/en/master/namespaces.html?highlight=namespace#using-namespaces.')

But it seems no place for me to pass a namespace from this interface.

Any thought?

My ray version is: ray, version 2.0.0.dev0, and my python version is 3.8

Thanks,  
-BS

---

<div class="post-metadata">

**Author:** ![eoakes](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/eoakes/32/7825_2.png) [@eoakes](https://discuss.ray.io/u/eoakes)\
**Post date:** [June 7, 2021, 3:56pm UTC](https://discuss.ray.io/t/serve-start-from-command-line-fails/2425/2 "2021-06-07T15:56:28Z")

</div>

Thanks for reporting this @blshao84! I filed a bug to track it on GitHub and we should be able to fix it soon:

> <https://github.com/ray-project/ray/issues/16289>
>
> Reported here:
> https://discuss.ray.io/t/serve-start-from-command-line-fails/242…5
> 
> Repro:
> \`\`\`
> ray start --head
> serve start
> 2021-06-07 10:55:06,424 INFO worker.py:726 -- Connecting to existing Ray cluster at address: 192.168.0.124:6379
> Traceback (most recent call last):
> File "/Users/eoakes/anaconda3/bin/serve", line 33, in \<module\>
> sys.exit(load\_entry\_point('ray', 'console\_scripts', 'serve')())
> File "/Users/eoakes/anaconda3/lib/python3.8/site-packages/click/core.py", line 829, in \_\_call\_\_
> return self.main(\*args, \*\*kwargs)
> File "/Users/eoakes/anaconda3/lib/python3.8/site-packages/click/core.py", line 782, in main
> rv = self.invoke(ctx)
> File "/Users/eoakes/anaconda3/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
> return \_process\_result(sub\_ctx.command.invoke(sub\_ctx))
> File "/Users/eoakes/anaconda3/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
> return ctx.invoke(self.callback, \*\*ctx.params)
> File "/Users/eoakes/anaconda3/lib/python3.8/site-packages/click/core.py", line 610, in invoke
> return callback(\*args, \*\*kwargs)
> File "/Users/eoakes/code/ray/python/ray/serve/scripts.py", line 47, in start
> serve.start(
> File "/Users/eoakes/code/ray/python/ray/serve/api.py", line 654, in start
> raise RuntimeError(
> RuntimeError: serve.start(detached=True) should not be called in anonymous Ray namespaces because you won't be able to reconnect to the Serve instance after the script exits. If you want to start a long-lived Serve instance, provide a namespace when connecting to Ray. See the documentation for more details: https://docs.ray.io/en/master/namespaces.html?highlight=namespace#using-namespaces.
> \`\`\`

---

<div class="post-metadata">

**Author:** ![blshao84](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/blshao84/32/1010_2.png) [@blshao84](https://discuss.ray.io/u/blshao84)\
**Post date:** [June 11, 2021, 3:53am UTC](https://discuss.ray.io/t/serve-start-from-command-line-fails/2425/3 "2021-06-11T03:53:15Z")

</div>

I notice this bug was fixed a few days ago, but after I upgrade ray to the latest nightly build, there’s still such an error. Here’s the way I did my upgrade:  
pip install -U [https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-2.0.0.dev0-cp38-cp38-manylinux2014\_x86\_64.whl](https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-2.0.0.dev0-cp38-cp38-manylinux2014_x86_64.whl)

I also tried install from a specific commit like this:  
pip install -U [https://s3-us-west-2.amazonaws.com/ray-wheels/master/8d56a36d28535fb64961327b037d8553700d7e4f/ray-2.0.0.dev0-cp38-cp38-manylinux2014\_x86\_64.whl](https://s3-us-west-2.amazonaws.com/ray-wheels/master/8d56a36d28535fb64961327b037d8553700d7e4f/ray-2.0.0.dev0-cp38-cp38-manylinux2014_x86_64.whl), but still no luck.

Am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![blshao84](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/blshao84/32/1010_2.png) [@blshao84](https://discuss.ray.io/u/blshao84)\
**Post date:** [June 11, 2021, 3:56am UTC](https://discuss.ray.io/t/serve-start-from-command-line-fails/2425/4 "2021-06-11T03:56:03Z")

</div>

aha, I figure it out. I have to pip uninstall ray first. Probably it worth mentioning on the documentation.
