question-mark
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

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:
    print("Success")
  1. Traceback
Message: Traceback (most recent call last):
  File "C:\Users\a\scoop\apps\miniconda3\4.7.12.1\envs\compas_rr_ts-dev\lib\site-packages\compas\rpc\dispatcher.py", line 100, in _dispatch
    module = importlib.import_module(modulename)
  File "C:\Users\a\scoop\apps\miniconda3\4.7.12.1\envs\compas_rr_ts-dev\lib\importlib\__init__.py", 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\4.7.12.1\envs\compas_rr_ts-dev\lib\site-packages\compas\geometry\__init__.py", line 497, in <module>
    from .bbox import *  # noqa: F401 F403
  File "C:\Users\a\scoop\apps\miniconda3\4.7.12.1\envs\compas_rr_ts-dev\lib\site-packages\compas\geometry\bbox\__init__.py", line 10, in <module>
    from .bbox_numpy import *  # noqa: F401 F403
  File "C:\Users\a\scoop\apps\miniconda3\4.7.12.1\envs\compas_rr_ts-dev\lib\site-packages\compas\geometry\bbox\bbox_numpy.py", line 24, in <module>
    from compas.numerical import pca_numpy
  File "C:\Users\a\scoop\apps\miniconda3\4.7.12.1\envs\compas_rr_ts-dev\lib\site-packages\compas\numerical\__init__.py", line 109, in <module>
    from .isolines import *  # noqa: F401 F403
  File "C:\Users\a\scoop\apps\miniconda3\4.7.12.1\envs\compas_rr_ts-dev\lib\site-packages\compas\numerical\isolines\__init__.py", line 8, in <module>
    from .isolines_numpy import *  # noqa: F401 F403
  File "C:\Users\a\scoop\apps\miniconda3\4.7.12.1\envs\compas_rr_ts-dev\lib\site-packages\compas\numerical\isolines\isolines_numpy.py", line 11, in <module>
    import matplotlib.pyplot as plt
  File "C:\Users\a\scoop\apps\miniconda3\4.7.12.1\envs\compas_rr_ts-dev\lib\site-packages\matplotlib\__init__.py", line 174, in <module>
    _check_versions()
  File "C:\Users\a\scoop\apps\miniconda3\4.7.12.1\envs\compas_rr_ts-dev\lib\site-packages\matplotlib\__init__.py", line 159, in _check_versions
    from . import ft2font
ImportError: DLL load failed while importing ft2font: %1 is not a valid Win32 application.


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

Expected behavior Print “Success”.

Desktop (please complete the following information):

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

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
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.

0reactions
tetovcommented, Dec 16, 2020
    if PYTHON_DIRECTORY:
        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 >
Untitled
2 syllable boy names starting with k, Wurst online einkaufen, ... Ouderkerk voetbal, Msn video not working firefox, Bindawood offers jeddah, ...
Read more >
Untitled
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found