Gh-python-remote

Hi everyone,

I am trying to install gh-python-remote following the steps in gh-python-remote · PyPI .
But I got stuck at this ```
python -m ghpythonremote._configure_ironpython_installation

Error is 
![image|690x234](upload://wraLOVxRGTm6PvXak9BZpyC6KHm.png)

Traceback (most recent call last):
  File "C:\Users\PLM-Lab\anaconda3\envs\rhinoremote\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Users\PLM-Lab\anaconda3\envs\rhinoremote\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Users\PLM-Lab\anaconda3\envs\rhinoremote\lib\site-packages\ghpythonremote\_configure_ironpython_installation.py", line 40, in <module>
    subprocess.check_call(pip_cmd)
  File "C:\Users\PLM-Lab\anaconda3\envs\rhinoremote\lib\subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Users\\PLM-Lab\\anaconda3\\envs\\rhinoremote\\python.exe', '-m', 'pip', 'install', '--upgrade', '--target=C:\\Users\\PLM-Lab\\AppData\\Roaming\\McNeel\\Rhinoceros\\7.0\\Plug-ins\\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\\settings\\lib', '--no-compile', '--ignore-requires-python', 'gh-python-remote']' returned non-zero exit status 2



Kindly help with this. I want to use numpy and matplotlib in grasshopper.

Thank you!

Hi @mnaveen.iitkgp,

I’ve got a fix for this issue but unfortunately got delayed in releasing the new version containing the fix. It will come later this week.

Hi @pierrec,

Thank you for your reply. I’ll try to install it after the update and let you know if I run into any issues.

@mnaveen.iitkgp You should be able to install GH Python Remote now with the usual installation commands:

conda activate rhinoremote
pip install gh-python-remote --upgrade
python -m ghpythonremote._configure_ironpython_installation

Have you seen the new CPython features in Rhino 8?

1 Like

Dear @pierrec ,

I have an existing conda environment with python 3.8.
How would you recommend installing ghpythonremote?
If this means that I must downgrade python. Can I keep two python versions in one environment e.g. 2.7 and keep 3.8 or not really?

Just from the first try I get this error:

ERROR: Ignored the following versions that require a different python version: 1.0.1 Requires-Python >=2.6,<3; 1.0.2 Requires-Python >=2.6,<3; 1.0.3 Requires-Python >=2.6,<3; 1.0.4 Requires-Python >=2.6,<3; 1.1.1 Requires-Python >=2.6,<3; 1.1.2 Requires-Python >=2.6,<3; 1.1.3 Requires-Python >=2.6,<3; 1.1.4 Requires-Python >=2.6,<3; 1.2.0 Requires-Python >=2.6,<3; 1.2.1 Requires-Python >=2.6,<3; 1.3.0 Requires-Python >=2.6,<3; 1.3.1 Requires-Python >=2.6,<3; 1.4.0 Requires-Python >=2.6,<3; 1.4.1 Requires-Python >=2.6,<3; 1.4.2 Requires-Python >=2.6,<3; 1.4.3 Requires-Python >=2.6,<3; 1.4.4 Requires-Python >=2.6,<3; 1.4.5 Requires-Python >=2.6,<3; 1.4.6 Requires-Python >=2.6,<3
ERROR: Could not find a version that satisfies the requirement gh-python-remote (from versions: none)
ERROR: No matching distribution found for gh-python-remote

Hi @Petras_Vestartas,

GHPythonRemote only works in Python 2. You need to create a new Python 2 environment in order to install it.

A python virtual environment is basically just a folder where one python.exe executable is kept, along with its standard library and any user-installed packages. All the versions of these have to be compatible with each other, in particular it is not possible to have two different python.exe in the same environment.

The best way to install GHPythonRemote for you is to create a new virtual environment in Conda, based on the latest python 2.7. This procedure is explained in the documentation. You will need to install all the other packages you need for your scripts in that env.

If you are looking to use CPython in Rhino and can access the latest WIP version (Rhino 8), I highly recommend you check out the new script editor. It has built-in support for CPython in Rhino.

1 Like

Thank you for the reply, it shows which direction should I take. I hope that Rhino 8 will finally have proper CPython integration.

1 Like

@pierrec Good afternoon! Thank you for your work!
Ive installed everything as it was described in notes. But i think smth goes wrong. Could you see what the problem is please?
{0;0}
0. DEBUG: ghpythonremote.helpers:
Directly trying python executable at C:\ProgramData\anaconda3\envs\GHPython_remote

  1. DEBUG: ghpythonremote.connectors:
    Using python executable: C:\ProgramData\anaconda3\envs\GHPython_remote\python.exe
  2. DEBUG: ghpythonremote.connectors:
    Using rpyc_server module: C:\Users\Vladimir PO\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\pythonservice.py
  3. DEBUG: ghpythonremote.connectors:
    Using port: 61535
  4. DEBUG: ghpythonremote.connectors:
    Using log_level: DEBUG
  5. DEBUG: ghpythonremote.connectors:
    Using working_dir: D:\2023\Win Pot\Модель
  6. INFO: ghpythonremote.connectors:
    Connecting…
  7. DEBUG: ghpythonremote.connectors:
    Connecting. Timeout in 10 seconds.
  8. Runtime error (RuntimeException): Could not connect to remote python C:\ProgramData\anaconda3\envs\GHPython_remote\python.exe. Does the remote python have rpyc installed?

Traceback:
line 168, in _get_connection, “C:\Users\Vladimir PO\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\connectors.py”
line 52, in init, “C:\Users\Vladimir PO\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\connectors.py”
line 60, in script

Changed DEBUG to ERROR and got this
{0;0}
0. Runtime error (RuntimeException): Could not connect to remote python C:\ProgramData\anaconda3\envs\GHPython_remote\python.exe. Does the remote python have rpyc installed?

Traceback:
line 168, in _get_connection, “C:\Users\Vladimir PO\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\connectors.py”
line 52, in init, “C:\Users\Vladimir PO\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\connectors.py”
line 60, in script

BTW - “rpyc” - installed through the Anaconda

Hi @Vlad_Poluektov,

Can you double check your GHPython_Remote environment? Please run these commands in a Windows command line and report the output:

C:\ProgramData\anaconda3\envs\GHPython_remote\python.exe -V
C:\ProgramData\anaconda3\envs\GHPython_remote\python.exe -c "import rpyc; print(rpyc.__version__)"
C:\ProgramData\anaconda3\envs\GHPython_remote\python.exe -c "import ghpythonremote as ghpr; print(ghpr.__version__)"

–Pierre

@pierrec Than you for the quick responce!
C:\Users\Vladimir PO>C:\ProgramData\anaconda3\envs\GHPython_remote\python.exe -V
Python 2.7.18 :: Anaconda, Inc.

C:\Users\Vladimir PO>C:\ProgramData\anaconda3\envs\GHPython_remote\python.exe -c “import rpyc; print(rpyc.version)”
(4, 1, 5)

C:\Users\Vladimir PO>C:\ProgramData\anaconda3\envs\GHPython_remote\python.exe -c “import ghpythonremote as ghpr; print(ghpr.version)”
1.4.6

        {0;0}
  1. WARNING: ghpythonremote.helpers:
    Location format for C:\ProgramData\anaconda3\envs\GHPython_remote
    did not match expected format: “method://env_name”(need more than 1 values to unpack).
    Falling back to getting python path from Windows %PATH%.

i think problem is above… somehow with location

  1. DEBUG: ghpythonremote.connectors:
    Using python executable: C:\Users\Vladimir PO\AppData\Local\Programs\Python\Python311\python.exe
  2. DEBUG: ghpythonremote.connectors:
    Using rpyc_server module: C:\Users\Vladimir PO\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\pythonservice.py
  3. DEBUG: ghpythonremote.connectors:
    Using port: 64679
  4. DEBUG: ghpythonremote.connectors:
    Using log_level: DEBUG
  5. DEBUG: ghpythonremote.connectors:
    Using working_dir: D:\2023\Win Pot\Model
  6. INFO: ghpythonremote.connectors:
    Connecting…
  7. DEBUG: ghpythonremote.connectors:
    Connecting. Timeout in 10 seconds.
  8. Runtime error (RuntimeException): Could not connect to remote python C:\Users\Vladimir PO\AppData\Local\Programs\Python\Python311\python.exe. Does the remote python have rpyc installed?

Traceback:
line 168, in _get_connection, “C:\Users\Vladimir PO\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\connectors.py”
line 52, in init, “C:\Users\Vladimir PO\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\connectors.py”
line 60, in script

That all looks correct.

The only thing that I notice is that your environment location is in C:\ProgramData\anaconda3 instead of C:\Users\Vladimir PO\Anaconda3. The only time I get that behavior from conda is when I run the Ancaonda prompt as administrator instead of the normal user. However, that is not an issue when I reproduce that on a clean virtual machine. What exact command did you run to create the virtual environment?

The only thing I can think off is to try to recreate the rhinoremote environment using your regular user account, so it gets put in the usual place in your user folder.

Apart from that, I’ve only got general debugging questions: Do you see a command line window opening when you turn on GH Python Remote? Does it stay open long enough that you can see what error message it would display?

Yes that is very strange. The only way you should get that error is if the path C:\ProgramData\anaconda3\envs\GHPython_remote did not exist on your computer, but as demonstrated by the commands you ran above, it does exist…

When i installed Anaconda, it asked me if i want it for all users of PC or only for one. I check for all users (because when i chose for one (Vladimir PO) he warned me that there is a SPACE in the path and this can cause some problems…). For all users it was installed into “ProgramData” and no warnings during installation process.

I tried again with a user that has a space in the name.

The Anaconda installer did warn me about a space in my path. I installed for all users to match your setup. I then created a new virtual env (in the ProgramData folder) and install GHPythonRemote as usual. It worked fine and I could use numpy for example. So that’s probably not the root of the issue, but there is still something wrong in your CPython setup as shown by the fact that IronPython seems to think the C:\ProgramData\anaconda3\envs\GHPython_remote folder does not exist.

I did the same but installing in the user folder that has a space in the path, and got GHPythonRemote to work just the same.

If you can, I would completely start over on the CPython side. Uninstall Anaconda, reinstall it with a fresh installer (use Miniconda to save some time, GHPythonRemote does not use the base Anaconda environment anyway) but for just one user this time. Then create the rhinoremote environment from an unelevated command prompt (i.e. NOT running as administrator), and verify that it gets created in your user folder.

If that doesn’t work or if you can’t do that, I would look into Firewall and Antivirus permissions. Make sure that C:\ProgramData\Anaconda3\envs\GHPython_Remote\python.exe has the permissions required to use ports and to accept incoming connections. Same for the Rhino executable.

Good afternoon!
Removed Anaconda. Deleted Python. Installed miniconda for one user “with a space”. Created a virtual environment rhinoremote (checked, it is in the directory). Installed numpy, matplotlin and rpyc. Checked antivirus for blocking. Manually added permissions. Still this message

        {0;0}
  1. DEBUG: ghpythonremote.helpers:
    Directly trying python executable at C:\Users\Vladimir PO\miniconda3\envs\rhinoremote

  2. DEBUG: ghpythonremote.connectors:
    Using python executable: C:\Users\Vladimir PO\miniconda3\envs\rhinoremote\python.exe

  3. DEBUG: ghpythonremote.connectors:
    Using rpyc_server module: C:\Users\Vladimir PO\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\pythonservice.py

  4. DEBUG: ghpythonremote.connectors:
    Using port: 56412

  5. DEBUG: ghpythonremote.connectors:
    Using log_level: DEBUG

  6. DEBUG: ghpythonremote.connectors:
    Using working_dir: D:\2023\Win Pot\Grasshopper

  7. INFO: ghpythonremote.connectors:
    Connecting…

  8. DEBUG: ghpythonremote.connectors:
    Connecting. Timeout in 10 seconds.

  9. Runtime error (RuntimeException): Remote python C:\Users\Vladimir PO\miniconda3\envs\rhinoremote\python.exe failed on launch. Does the remote python have rpyc installed?

Traceback:
line 163, in _get_connection, “C:\Users\Vladimir PO\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\connectors.py”
line 52, in init, “C:\Users\Vladimir PO\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\ghpythonremote\connectors.py”
line 60, in script

I used the command "(rhinoremote) C:\Users\Vladimir PO> C:\Users\Vladimir PO\miniconda3\envs\rhinoremote\python.exe --version
and he said “is not an internal or external command, executable program or batch file”
But i checked, it is in directory

I also checked “pip list” - all packages are installed…
Chat GPT suggested that the problem is in the space… and you need to put the path in double quotes. And it worked, it displayed the version (Python 2.7.18 :: Anaconda, Inc.). But how to deal with it now?

You should not install rpyc by itself.

Can you delete this environment (conda env remove rhinoremote), then recreate it using these commands:

conda create -n rhinoremote python=2.7
conda activate rhinoremote
pip install gh-python-remote
python -m ghpythonremote._configure_ironpython_installation

?

The new env will not have numpy installed but we can always do that later when everything else works.

And try again to run GHPythonRemote in Rhino. After that, I think I’m out of ideas…

I doubt I’ll find the answer there, but could you paste the result of the Rhino command _SystemInfo here?

i made all the steps
(rhinoremote) C:\Users\Vladimir PO>python -m ghpythonremote._configure_installation
C:\Users\Vladimir PO\miniconda3\envs\rhinoremote\python.exe: No module named ghpythonremote._configure_installation

System info
Rhino 7 SR29 2023-4-17
License type: Corporate, build 2023-04-17
License details: Stand-Alone

Windows 11 (10.0.22621 SR0.0) or greater (Physical RAM: 64Gb)

Computer platform: DESKTOP

Standard graphics configuration.
Primary display and OpenGL: NVIDIA GeForce RTX 4080 (NVidia) Memory: 16GB, Driver date: 8-14-2023 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 537.13
> Accelerated graphics device with 4 adapter port(s)
- Windows Main Display attached to adapter port #0

OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
Redraw scene when viewports are exposed: On
Graphics level being used: OpenGL 4.6 (primary GPU’s maximum)

Anti-alias mode: 4x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High

Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 8-14-2023
Driver Version: 31.0.15.3713
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 16376 MB

Rhino plugins that do not ship with Rhino

Rhino plugins that ship with Rhino
C:\Program Files\Rhino 7\Plug-ins\Commands.rhp “Commands” 7.29.23107.3001
C:\Program Files\Rhino 7\Plug-ins\rdk.rhp “Renderer Development Kit”
C:\Program Files\Rhino 7\Plug-ins\RhinoRenderCycles.rhp “Rhino Render” 7.29.23107.3001
C:\Program Files\Rhino 7\Plug-ins\RhinoRender.rhp “Legacy Rhino Render”
C:\Program Files\Rhino 7\Plug-ins\rdk_etoui.rhp “RDK_EtoUI” 7.29.23107.3001
C:\Program Files\Rhino 7\Plug-ins\rdk_ui.rhp “Renderer Development Kit UI”
C:\Program Files\Rhino 7\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 7\Plug-ins\IronPython\RhinoDLR_Python.rhp “IronPython” 7.29.23107.3001
C:\Program Files\Rhino 7\Plug-ins\RhinoCycles.rhp “RhinoCycles” 7.29.23107.3001
C:\Program Files\Rhino 7\Plug-ins\Grasshopper\GrasshopperPlugin.rhp “Grasshopper” 7.29.23107.3001
C:\Program Files\Rhino 7\Plug-ins\Toolbars\Toolbars.rhp “Toolbars” 7.29.23107.3001
C:\Program Files\Rhino 7\Plug-ins\3dxrhino.rhp “3Dconnexion 3D Mouse”
C:\Program Files\Rhino 7\Plug-ins\Displacement.rhp “Displacement”