GHPython Remote error

Hi,

I have trouble with GHPython Remote :slightly_frowning_face:

I have followed these instructions:
https://wiki.mcneel.com/grasshopper/cpython
and also
http://theonovak.com/news_2_ghpr_guide.html

These instructions seems to work just fine with other computer that i have, but with this computer, which i am using right now i get this error:

Runtime error (Exception): CalledProcessError

Traceback:
line 229, in check_output, “C:\Program Files\Rhino 6\Plug-ins\IronPython\Lib\subprocess.py”
line 58, in get_python_from_conda_env, “C:\Users%UserName%\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\helpers.py”

line 28, in get_python_path, “C:\Users%UserName%\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\helpers.py”

line 20, in init, “C:\Users%UserName%\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\connectors.py”
line 49, in script

I have reinstalled and gone through instructions multiple times and I have no glue what i should do right now.

I am using Rhino 6

pip list:

env list:

(rhinoremote) C:\Users%UserName%>conda env list

conda environments:

base C:\Users%UserName%\Anaconda2
rhinoremote * C:\Users%UserName%\Anaconda2\envs\rhinoremote

its looks like this:

Hello,

Have you tried these instructions?

I haven’t tried this…

Not sure what the issue is here, sorry. Could you tell me what versions you have installed, by running the following commands?

In the Windows cmd:

conda activate rhinoremote
conda -V
python -V
pip show rpyc
pip show gh-python-remote

In a Rhino Python script:

import rpyc, ghpythonremote, sys, os
from ghpythonremote import version as ghpyrv

print(sys.version)
print(sys.path)
print(rpyc.__version__)
print(rpyc.__path__)
print(ghpyrv.__version__)
print(ghpythonremote.__path__)

Hi,

I too am having the same issue as Jaakko, and am getting the exact same returns in the panel connected to the ‘out’ of the GH python remote. I tried reinstalling Rhino6 and everything.

If I run the commands I get the following outputs for the versions I am running, ofc in the order you listed above.

  • conda 4.7.10
  • Python 2.7.16 :: Anaconda, Inc.
  • Version: 4.1.2
  • Version: 1.2.1

When I run your code in a Rhino Python I get the following output

moduleRhinoPythonOutput

The error above seems to be in the code trying to parse your conda envs to find the path to the python exe that is specified by the conda://rhinoremote location. Could you change that to C:\Users\<username>\.conda\envs\rhinoremote\python.exe as a workaround?

I’ll look into the real bug as soon as I can.

Hi,
Thank you for your fast reply,

It seems that your suggestion worked in part, as several error codes have been solved. The problem now seems to be that it cannot find rpyc, despite it showing up in my rhinoremote pip list.

When searching through the specified code in the error message (connectors.py), it appears to have something to do with connection.

  • Are you absolutely certain that the command C:\Users\<username>\.conda\envs\rhinoremote\python.exe -m pip show rpyc returns the expected RPyC information? The best is to run it in cmd.exe, not in the conda shell.
  • Do you see a console window popping up when you turn on GHPyRemote?

Yes, when I run that command through my command prompt the following is returned which, as I assume, the expected information.

When I turn on GHPyRemote the console window pops up for a fraction of a second.

There is something going on here that I don’t understand… I’ll have to look at this in a debugger, but it won’t be till next week.

Also for some reason the debug logs are not showing up in your GHPythonRemote output. Do you get more info when you open double-click the GHPythonRemote component to open the Python editor, before switching the toggle to on? You might also need to click on “Test” in the editor at some point.

If you feel like doing more debugging yourself, you can try this:

  1. Open an rpyc server in a command prompt: C:\Users\<username>\.conda\envs\rhinoremote\python.exe "%APPDATA%\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\pythonservice.py" 18871 DEBUG
    You should either get an error message, or some debug messages and a prompt that never returns.
  2. If the first step does not return, it means the sever is running and you can try connecting to it from another console: C:\Users\<username>\.conda\envs\rhinoremote\python.exe -c "import rpyc; c = rpyc.classic.connect('localhost', 18871); print(c)"
    The second step should print something like <rpyc.core.protocol.Connection 'conn1' object at 0x0000000003BA47F0>, return, and close the server that was created in the first step.

Hi,

Thank you for your helping so much, in regards to the debug logs, I previously turned off the debug logs to see the errors, but have turned them back on and below a screenshot of the log is show. Also I took the time to uninstall Anaconda completely and reinstall, but it did not seem to change anything.

In regard to your debugging tips (I don’t have much experience myself), but I hope the following screenshot could help you.

I think there is something broken in your RPyC installation. The first error in your second screenshot should definitely not happen in a functioning installation, and I can’t reproduce it here.

Do you maybe have a directory called rpyc somewhere in your home folder, or in the Python path? You can get your python path by running python -c "import sys; print(sys.path)" in a prompt with env rhinoremote activated. The only directory containing a rpyc item should be the last one, ending in site-packages.

Since you reinstalled Conda, I guess that you also went through the installation procedure again for GHPythonRemote and your RPyC installation has not been modified. Still, I’d like to see if the installation logs for RPyC tell us anything. Try a reinstall with these commands, and report if you see any error:

conda activate rhinoremote
pip uninstall -y rpyc
pip install rpyc

A good way to check if that did anything is to run that debugging command “1.” from my previous message. If you are still in a prompt with rhinoremote activated, you can skip the path to python and run: python "%APPDATA%\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\pythonservice.py" 18871 DEBUG

If that still returns the same error as before, please report the output of:

conda activate rhinoremote
python -c "import rpyc, ghpythonremote; print(rpyc.__file__); print(ghpythonremote.__file__); print(ghpythonremote.rpyc.__file__)"
python -c "from rpyc import ClassicService; import inspect; print(inspect.getsourcefile(ClassicService))"
python -c "from ghpythonremote import rpyc; import inspect; print(inspect.getsourcefile(rpyc.ClassicService))"
python -c "from ghpythonremote import rpyc; import inspect; print(inspect.getsource(rpyc.core.protocol.Connection._netref_factory))"

Also, that might be related to the initial conda issue you were experiencing at first. What’s the output of conda env list -v?