Rhino 8 Feature: ScriptEditor (CPython, CSharp)

I reworked the three diagnostic panels into one “Messages” panel. The new panel only shows Errors by default and has buttons to enable Warnings and others.

The main editor panel now only highlights what is shown in the Messages panel. So if you are not showing Warnings, the squiggly lines for warnings do not show up in the editor control

5 Likes

thank you for this, I have been looking for this for years, Michael Wickerson

1 Like

I can get NUMPY, keras, and other libraries to load in Rhino3WIP python 3 node but I can’t get tensorflow to work. Any tips?

Michael

1 Like

Tensorflow is a bit more complicated as it has various libraries for different architectures. I have not digged deep into it but will do soon.

1 Like

Thank you for your quick response, I can definitely wait for TensorFlow in grasshopper, plenty of things to learn first.

I am however having a similar problem with other libraries like pandas. I have lots of work to translate into the gh canvas through the python 3 script node and I am wondering why my code won’t load:

# r: pandas

import pandas as pd

I am getting this error:

  1. Solution exception:Error installing: pandas==0 | ERROR: Exception:
    Traceback (most recent call last):
    File “\?\C:\Users\Sculpture.rhinocode\python3.9-31\lib\site-packages\pip_internal\cli\base_command.py”, line 173, in _main
    status = self.run(options, args)
    File “\?\C:\Users\Sculpture.rhinocode\python3.9-31\lib\site-packages\pip_internal\cli\req_command.py”, line 203, in wrapper
    return func(self, options, args)
    File “\?\C:\Users\Sculpture.rhinocode\python3.9-31\lib\site-packages\pip_internal\commands\install.py”, line 446, in run
    self._handle_target_dir(
    File “\?\C:\Users\Sculpture.rhinocode\python3.9-31\lib\site-packages\pip_internal\commands\install.py”, line 501, in _handle_target_dir
    shutil.rmtree(target_item_dir)
    File “shutil.py”, line 749, in rmtree
    File “shutil.py”, line 622, in _rmtree_unsafe
    File “shutil.py”, line 627, in _rmtree_unsafe
    File “shutil.py”, line 625, in _rmtree_unsafe
    PermissionError: [WinError 5] Access is denied: ‘C:\Users\Sculpture\.rhinocode\python3.9-31\site-envs\default-CPIaitVY\numpy\.libs\libopenblas64__v0.3.23-246-g3d31191b-gcc_10_3_0.dll’

Try deleting C:\Users\Sculpture\.rhinocode\python3.9-31\site-envs and run rhino again. I’d like to see if this still crashes when installing pandas from scratch

Thanks!

1 Like

It is still buggin’ out:

  1. Solution exception:Error installing: pandas==0 | ERROR: Exception:
    Traceback (most recent call last):
    File “\?\C:\Users\Sculpture.rhinocode\python3.9-31\lib\site-packages\pip_internal\cli\base_command.py”, line 173, in _main
    status = self.run(options, args)
    File “\?\C:\Users\Sculpture.rhinocode\python3.9-31\lib\site-packages\pip_internal\cli\req_command.py”, line 203, in wrapper
    return func(self, options, args)
    File “\?\C:\Users\Sculpture.rhinocode\python3.9-31\lib\site-packages\pip_internal\commands\install.py”, line 446, in run
    self._handle_target_dir(
    File “\?\C:\Users\Sculpture.rhinocode\python3.9-31\lib\site-packages\pip_internal\commands\install.py”, line 501, in _handle_target_dir
    shutil.rmtree(target_item_dir)
    File “shutil.py”, line 749, in rmtree
    File “shutil.py”, line 622, in _rmtree_unsafe
    File “shutil.py”, line 627, in _rmtree_unsafe
    File “shutil.py”, line 625, in _rmtree_unsafe
    PermissionError: [WinError 5] Access is denied: ‘C:\Users\Sculpture\.rhinocode\python3.9-31\site-envs\default-sH0rNCGg\numpy\.libs\libopenblas64__v0.3.23-246-g3d31191b-gcc_10_3_0.dll’

after a bit of messing around with anaconda and pandas, I am getting a new error message:

  1. Error running script Script
    Exception: Traceback (most recent call last):
    File “rhinocode:///grasshopper/1/e75146d4-fa49-46fa-b591-7b3004ac7e07/d4d6362b-5236-4a3d-a05a-4edee330c1ef”, line 8, in
    File “C:\Users\Sculpture.rhinocode\python3.9-31\site-envs\default-sH0rNCGg\pandas_init_.py”, line 22, in
    from pandas.compat import is_numpy_dev as is_numpy_dev # pyright: ignore # noqa:F401
    File "C:\Users\Sculpture.rhinocode\python3.9-31\site-envs\default-sH0rNCGg\pandas\compat_init
    .py", line 25, in
    from pandas.compat.numpy import (
    File “C:\Users\Sculpture.rhinocode\python3.9-31\site-envs\default-sH0rNCGg\pandas\compat\numpy_init_.py”, line 4, in
    from pandas.util.version import Version
    File “C:\Users\Sculpture.rhinocode\python3.9-31\site-envs\default-sH0rNCGg\pandas\util_init_.py”, line 2, in
    from pandas.util._decorators import ( # noqa:F401
    File “C:\Users\Sculpture.rhinocode\python3.9-31\site-envs\default-sH0rNCGg\pandas\util_decorators.py”, line 14, in
    from pandas.libs.properties import cache_readonly
    File "C:\Users\Sculpture.rhinocode\python3.9-31\site-envs\default-sH0rNCGg\pandas_libs_init
    .py", line 13, in
    from pandas._libs.interval import Interval
    File “pandas_libs\interval.pyx”, line 1, in init pandas._libs.interval
    File “pandas_libs\hashtable.pyx”, line 1, in init pandas._libs.hashtable
    File “pandas_libs\missing.pyx”, line 1, in init pandas.libs.missing
    File "C:\Users\Sculpture.rhinocode\python3.9-31\site-envs\default-sH0rNCGg\pandas_libs\tslibs_init
    .py", line 39, in
    from pandas._libs.tslibs.conversion import localize_pydatetime
    File “pandas_libs\tslibs\conversion.pyx”, line 1, in init pandas._libs.tslibs.conversion
    File “pandas_libs\tslibs\offsets.pyx”, line 1, in init pandas._libs.tslibs.offsets
    File “pandas_libs\tslibs\timestamps.pyx”, line 1, in init pandas._libs.tslibs.timestamps
    File “pandas_libs\tslibs\timedeltas.pyx”, line 81, in init pandas._libs.tslibs.timedeltas
    File “pandas_libs\tslibs\fields.pyx”, line 7, in init pandas._libs.tslibs.fields
    File “”, line 1007, in _find_and_load
    File “”, line 986, in _find_and_load_unlocked
    File “”, line 664, in _load_unlocked
    File “”, line 627, in _load_backward_compatible
    File “”, line 259, in load_module
    File “_strptime.py”, line 268, in
    File “_strptime.py”, line 182, in init
    File “_strptime.py”, line 69, in init
    File “_strptime.py”, line 28, in _getlang
    File “locale.py”, line 593, in getlocale
    File “locale.py”, line 501, in _parse_localename
    ValueError: unknown locale: en-US

nope… bakc to this error again:

  1. Solution exception:Error installing: pandas==0 | ERROR: Exception:
    Traceback (most recent call last):
    File “\?\C:\Users\Sculpture.rhinocode\python3.9-31\lib\site-packages\pip_internal\cli\base_command.py”, line 173, in _main
    status = self.run(options, args)
    File “\?\C:\Users\Sculpture.rhinocode\python3.9-31\lib\site-packages\pip_internal\cli\req_command.py”, line 203, in wrapper
    return func(self, options, args)
    File “\?\C:\Users\Sculpture.rhinocode\python3.9-31\lib\site-packages\pip_internal\commands\install.py”, line 446, in run
    self._handle_target_dir(
    File “\?\C:\Users\Sculpture.rhinocode\python3.9-31\lib\site-packages\pip_internal\commands\install.py”, line 501, in _handle_target_dir
    shutil.rmtree(target_item_dir)
    File “shutil.py”, line 749, in rmtree
    File “shutil.py”, line 622, in _rmtree_unsafe
    File “shutil.py”, line 627, in _rmtree_unsafe
    File “shutil.py”, line 625, in _rmtree_unsafe
    PermissionError: [WinError 5] Access is denied: ‘C:\Users\Sculpture\.rhinocode\python3.9-31\site-envs\default-VfYslUoS\numpy\.libs\libopenblas64__v0.3.23-246-g3d31191b-gcc_10_3_0.dll’

for what it is worth, here is a list of the libraries that are not giving me porblems (is there an issue with using Python 3.11.4 instead of python 3.9.31?)

requirements: numpy, toml, matplotlib, bokeh, contourpy, fontTools, kiwisolver, markupsafe, packaging

most of the other python pip installs are failing to the same error above.

I will work with NUMPY into grasshopper until I can get pandas working, then onto scikit-learn and scipy

:slight_smile:

Ok I’ll test these libraries. How is Python 3.11.4 involved here? Rhino has its own Python 3.9 runtime that it ships with

1 Like

I was wondering why 3.9 was being used because I thought it was using my updated version. Thank you for testing pandas. I am in no rush because I have so many hops NUMPY scripts from using the ghhops_server and flask to move over already. Many kind thanks for your responses.Michael

1 Like

Hi everyone,
Testing this out with geopandas and shapely on the mac at the moment. Everything works smoothly.

One issue. Treehelpers don’t seem to be working. Rhino crashes if i attempt to convert a list of lists into a tree in the script editor using the th.list_to_tree() as documented in Rhino - Grasshopper data trees and Python

Is there a new way of doing this now? I’m being forced to join columns in pandas and then split the list into a tree in grasshopper at the moment.

1 Like

I have resorted to using this to get arrays and data frames into Grasshopper node outputs, for what it’s worth. It is not ideal.

"""Grasshopper Script"""
#! python 3
a = "Welcome to Wickerson Studios!"
print(a)

# r: numpy

import numpy

arr = numpy.random.rand(rows, columns)

print(arr)
print(type(arr))
arr = arr.tolist()
print(arr)

arr_OUT = [arr[i] if i < rows else False for i in range(4)]
arr0_OUT, arr1_OUT, arr2_OUT, arr3_OUT = arr_OUT
1 Like

@user970 Would you be able to give me an example I can test and see the error?

I’ll try to cook it up before I leave for a much needed holiday.

1 Like

Seems list to tree from treehelper crashes if given a nested list containing one text list and one numeric list. @eirannejad can you confirm?

FYI, I have got this crash after starting _-ScriptEditor _Edit the first time in Rhino (8.0.23234.12305, 2023-08-22):
RhinoDotNetCrash.txt (13.9 KB)

I can confirm we’re getting the same error when trying to install pandas on a windows system. The same gh file works perfectly on macs. There is also a gh json error higher up in the log that has shown up before in rhino 7 on this forum, but we’re ignoring that.

We have managed to get pandas to install by installing dependencies in a particular order. But this is not easily reproducible and easily breaks.

1 Like

I have made some fixes related to this. Should be available in next wip

1 Like