Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RPC proxy not working with implicit start from Rhino/Grasshopper

See original GitHub issue

Issue Description

Describe the bug

Using compas_rpc.Proxy as a contextmanager raises an exception. This only happens if a RPC server is not already running. (Same/similar to #265)

To Reproduce Steps to reproduce the behavior:

Context: Grasshopper GHPython node or Rhino python editor.

Sample script

from compas.rpc import Proxy
from compas.geometry import Point

pt1 = Point(1, 2, 3)

with Proxy("compas.geometry", max_conn_attempts=5) as proxy:
    pt2 = proxy.Point(1, 2, 3)

if list(pt1) == pt2:
  1. Traceback
Message: Traceback (most recent call last):
  File "C:\Users\a\scoop\apps\miniconda3\\envs\compas_rr_ts-dev\lib\site-packages\compas\rpc\", line 100, in _dispatch
    module = importlib.import_module(modulename)
  File "C:\Users\a\scoop\apps\miniconda3\\envs\compas_rr_ts-dev\lib\importlib\", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\a\scoop\apps\miniconda3\\envs\compas_rr_ts-dev\lib\site-packages\compas\geometry\", line 497, in <module>
    from .bbox import *  # noqa: F401 F403
  File "C:\Users\a\scoop\apps\miniconda3\\envs\compas_rr_ts-dev\lib\site-packages\compas\geometry\bbox\", line 10, in <module>
    from .bbox_numpy import *  # noqa: F401 F403
  File "C:\Users\a\scoop\apps\miniconda3\\envs\compas_rr_ts-dev\lib\site-packages\compas\geometry\bbox\", line 24, in <module>
    from compas.numerical import pca_numpy
  File "C:\Users\a\scoop\apps\miniconda3\\envs\compas_rr_ts-dev\lib\site-packages\compas\numerical\", line 109, in <module>
    from .isolines import *  # noqa: F401 F403
  File "C:\Users\a\scoop\apps\miniconda3\\envs\compas_rr_ts-dev\lib\site-packages\compas\numerical\isolines\", line 8, in <module>
    from .isolines_numpy import *  # noqa: F401 F403
  File "C:\Users\a\scoop\apps\miniconda3\\envs\compas_rr_ts-dev\lib\site-packages\compas\numerical\isolines\", line 11, in <module>
    import matplotlib.pyplot as plt
  File "C:\Users\a\scoop\apps\miniconda3\\envs\compas_rr_ts-dev\lib\site-packages\matplotlib\", line 174, in <module>
  File "C:\Users\a\scoop\apps\miniconda3\\envs\compas_rr_ts-dev\lib\site-packages\matplotlib\", line 159, in _check_versions
    from . import ft2font
ImportError: DLL load failed while importing ft2font: %1 is not a valid Win32 application.

  line 345, in _proxy, "C:\Users\a\AppData\Roaming\McNeel\Rhinoceros\6.0\scripts\compas\rpc\"
  line 4, in <module>, "C:\Users\a\AppData\Local\Temp\"

Expected behavior Print “Success”.

Desktop (please complete the following information):

  • OS: Win10
  • Python version 2.7.8 (IronPython 2.7.8 ( on .NET 4.0.30319.42000 (64-bit))
  • Python package manager: Anaconda
  • compas version: 0.19.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:45 (45 by maintainers)

github_iconTop GitHub Comments

tetovcommented, Dec 11, 2020
  • You are using a dev environment (based on the name), so the first thing I would try is to create a brand new env with compas 0.19.1, to rule out interference from other stuff

That environment only had a compas 0.19.1 and an editable install of a package I tested compas.plugin with.

  • You have miniconda instead of Anaconda, I don’t think that is the source of the problem, but perhaps miniconda does take a different priority for some of the packages that normally are found on the anaconda channel (eg. matplotlib)

  • Since the error seems to be coming from matplotlib, could you verify that 1) it works without RPC, 2) a --force-reinstall conda installation of the matplotlib-base package does not fix it ?

Just tested this on another computer with miniconda and it worked. Seems like my plugin package is the culprit.

I’ll investigate further, I’ll reopen if necessary.

tetovcommented, Dec 16, 2020
        lib_bin = os.path.join(PYTHON_DIRECTORY, 'Library', 'bin')
        if os.path.exists(lib_bin) and lib_bin not in env['PATH']:
            env['PATH'] = lib_bin + os.pathsep + env['PATH']

        lib_bin = os.path.join(PYTHON_DIRECTORY, 'lib')
        if os.path.exists(lib_bin) and lib_bin not in env['PATH']:
            env['PATH'] = lib_bin + os.pathsep + env['PATH']

This fixed it for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

rpc - COMPAS
The other one is called RPC , which stands for Remote Procedure Call` and it allows to create a transparent proxy/connection between our...
Read more >
What is the correct way to serialize data for rpc in grasshopper
I'm running into a seemingly simple problem where I am unable to pass a compas mesh to an rpc proxy: In grasshopper, I...
Read more >
RPC Proxy doesn't work: 2013/2010 Co-Existence ... - TechNet
I'm working on a new client and they have it. Mailboxes on 2010 do not work with external outlook anywhere with the 2013...
Read more >
2 syllable boy names starting with k, Wurst online einkaufen, ... Ouderkerk voetbal, Msn video not working firefox, Bindawood offers jeddah, ...
Read more >
Provocadora mujer, Crowie running, Essay about national festivals of india, Asus m32ad-tr002s, Baden import weihnachten, Steenmarters op zolder, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found