RPC full reinitialise

Hello,

I have a problem using the RPC. It was working properly before I started to use try/except in the wrong way. It seems it tries to connect to an old non-existing one. I have this problem when I run it in Sublime (Mac side), Grasshopper on Rhino Windows but no problem on Grasshopper on Rhino Mac oddly.

Is there a brute manner to force it to reinitialise?

Thanks,
Robin


Starting a new proxy server…
99 attempts left.
98 attempts left.
97 attempts left.

0 attempts left.
Traceback (most recent call last):

File “/Users/Robin/Documents/COMPAS/core/compas/src/compas/rpc/proxy.py”, line 238, in start_server
raise RPCServerError(“The server is not available.”)
compas.rpc.errors.RPCServerError: The server is not available.

Would using Proxy().stop_server() help? Alternatively on mac, going to the Activity Monitor and killing the active process could do. On my computer this shows up as python3.x.

Still not working. The error occurs at the instantiation. And restarting my computer does not solve it and killing python via the Activity Monitor neither.

hi robin,

i need a bit more info to help solve the issue.
also, what do you mean by “before i started to use try/except in the wrong way”?

and as a side note, on windows the process running the server will show up on the “Details” tab of the “Task Manager” under “pythonw.exe”…

a method for starting RPC that should always work is to use the Terminal/Anaconda Prompt.

conda activate robin
compas_rpc start

or, more explicitly

conda activate robin
python
>>> from compas.rpc import Proxy
>>> proxy = Proxy()
>>>

let me know how that goes…

Hi Tom,

I tried both methods but the RPC doesn’t appear to start. I aborted the first method because nothing happened after a minute.

Last login: Wed Jun 24 13:01:56 on ttys000
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit Use zsh as the default shell on your Mac - Apple Support.
(base) MacBook-Pro-de-Robin:~ Robin$ conda activate research
(research) MacBook-Pro-de-Robin:~ Robin$ compas_rpc start
Starting default RPC service on port 1753…
Listening, press CTRL+C to abort…
^CTraceback (most recent call last):
File “/Users/Robin/anaconda3/envs/research/bin/compas_rpc”, line 11, in
load_entry_point(‘COMPAS’, ‘console_scripts’, ‘compas_rpc’)()
File “/Users/Robin/Documents/COMPAS/core/compas/src/compas/rpc/main.py”, line 63, in main
args.func(**vars(args))
File “/Users/Robin/Documents/COMPAS/core/compas/src/compas/rpc/main.py”, line 12, in start
start_service(port)
File “/Users/Robin/Documents/COMPAS/core/compas/src/compas/rpc/services/default.py”, line 38, in start_service
server.serve_forever()
File “/Users/Robin/anaconda3/envs/research/lib/python3.7/socketserver.py”, line 232, in serve_forever
ready = selector.select(poll_interval)
File “/Users/Robin/anaconda3/envs/research/lib/python3.7/selectors.py”, line 415, in select
fd_event_list = self._selector.poll(timeout)
KeyboardInterrupt
(research) MacBook-Pro-de-Robin:~ Robin$ python
Python 3.7.6 | packaged by conda-forge | (default, Mar 23 2020, 22:45:16)
[Clang 9.0.1 ] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

from compas.rpc import Proxy
proxy = Proxy()
Starting a new proxy server…
99 attempts left.
98 attempts left.
97 attempts left.
96 attempts left.
95 attempts left.
94 attempts left.
93 attempts left.
92 attempts left.
91 attempts left.
90 attempts left.
89 attempts left.
88 attempts left.
87 attempts left.
86 attempts left.
85 attempts left.
84 attempts left.
83 attempts left.
82 attempts left.
81 attempts left.
80 attempts left.
79 attempts left.
78 attempts left.
77 attempts left.
76 attempts left.
75 attempts left.
74 attempts left.
73 attempts left.
72 attempts left.
71 attempts left.
70 attempts left.
69 attempts left.
68 attempts left.
67 attempts left.
66 attempts left.
65 attempts left.
64 attempts left.
63 attempts left.
62 attempts left.
61 attempts left.
60 attempts left.
59 attempts left.
58 attempts left.
57 attempts left.
56 attempts left.
55 attempts left.
54 attempts left.
53 attempts left.
52 attempts left.
51 attempts left.
50 attempts left.
49 attempts left.
48 attempts left.
47 attempts left.
46 attempts left.
45 attempts left.
44 attempts left.
43 attempts left.
42 attempts left.
41 attempts left.
40 attempts left.
39 attempts left.
38 attempts left.
37 attempts left.
36 attempts left.
35 attempts left.
34 attempts left.
33 attempts left.
32 attempts left.
31 attempts left.
30 attempts left.
29 attempts left.
28 attempts left.
27 attempts left.
26 attempts left.
25 attempts left.
24 attempts left.
23 attempts left.
22 attempts left.
21 attempts left.
20 attempts left.
19 attempts left.
18 attempts left.
17 attempts left.
16 attempts left.
15 attempts left.
14 attempts left.
13 attempts left.
12 attempts left.
11 attempts left.
10 attempts left.
9 attempts left.
8 attempts left.
7 attempts left.
6 attempts left.
5 attempts left.
4 attempts left.
3 attempts left.
2 attempts left.
1 attempts left.
0 attempts left.
Traceback (most recent call last):
File “”, line 1, in
File “/Users/Robin/Documents/COMPAS/core/compas/src/compas/rpc/proxy.py”, line 102, in init
self._server = self.start_server()
File “/Users/Robin/Documents/COMPAS/core/compas/src/compas/rpc/proxy.py”, line 238, in start_server
raise RPCServerError(“The server is not available.”)
compas.rpc.errors.RPCServerError: The server is not available.

I tried to reinstall compas with

pip install -e .

but the same occurred.

can you try with a clean environment? something like

conda create -n testrpc python=3.7 --yes
conda activate testrpc
cd path/to/compas
pip install -e .
python
>>> from compas.rpc import Proxy
>>> p = Proxy()
>>> p.stop_server()
>>> p.start_server()

The same happened in the new environment at

p = Proxy()

with this error

Traceback (most recent call last):
File “”, line 1, in
File “/Users/Robin/Documents/COMPAS/core/compas/src/compas/rpc/proxy.py”, line 102, in init
self._server = self.start_server()
File “/Users/Robin/Documents/COMPAS/core/compas/src/compas/rpc/proxy.py”, line 238, in start_server
raise RPCServerError(“The server is not available.”)
compas.rpc.errors.RPCServerError: The server is not available.

I also tried in a new environment from a new folder for COMPAS, but it was the same.

is there anything worth mentioning that happened with your computer before it stopped working? OS update, new installed software, Anaconda installation, …?