Note that every now and then it fails and you have to restart Rhino 8 for it to work.
Hi all! Havenāt entirely caught up with this two-year-long thread haha, so I might be missing something obvious. But the rhinocode
command does not work for me. I just installed 8.0.23080.12305
WIP. Tried reinstalling - same thing. Any suggestions?
@enmerk4r I just added an RhinoCode
alias to run ScriptEditor
for others. I realized this change caused a bit of confusion
Hehe, thanks @eirannejad!
Iāve literally been dreaming about this for years - ever since I first realized I can use Python in Rhino
Currently, Iām trying to play around with training RL agents in StableBaselines3. So far have been seeing some hiccups with pip installation through # requirements: <package>
and a bit of runtime weirdness. Once Iām confident that this isnāt because I am being dense, Iāll post my findings in the thread. But yeah, this is awesome!
I canāt wait! Please do. Iād love to learn about all your special case to make sure your required packages are easy to install through the # requirements: <package>
pattern so others can enjoy your tools as well
Is there any chance to activate c# in the Grasshopper version of the script editor?
The abandoned one in WIP 8 on mac is not useable at all (and V7 is even worse and unusable on mac)
It would really help the folks using mac, because as of now there is no way to write C# code in GH without wanting to throw everything out the window after 2 minutesā¦ (on macOS)
thanks!
Ps: it looks like a low hanging fruit - in the report window it even shows that the c# modules are loadedā¦ just now way to switch from python3
Hi, how are you able to use pythonnet with python 3.9? I would love to use our own packages, but we also rely on pythonnet and are not able to get it to work above 3.8.
Iāve been getting unknown locale: en-US
when trying to install Pandas. And I think Stable Baselines has a dependency on Pandas as well. Not sure what this is related to
Dear @eirannejad ,
I have a question related to python and pip install "package name"
.
After installation of e.g. pip install compas
the library is not found and I cannot import it.
How do I need to install new libraries so that they become recognizable by RhinoCode ?
I have a custom build of pythonnet at this point. We have done some changes to make it a bit more scripting friendly
Rhino uses a custom deployment of python so it does not create conflicts with python installed globally on your machine. So any packages installed using pip install
commands you run on the command line (assuming that is the global pip) are not going to be visible to Rhino. (That said we will have options to add search paths in editor settings)
This is how to you can specify the requirements for your script in the script itself:
"""
Note:
This project is work-in-progress and still in its infancy
- Reference to RhinoCommmon.dll is added by default
- You can specify your script requirements like:
# r: <package-specifier> [, <package-specifier>]
# requirements: <package-specifier> [, <package-specifier>]
For example this line will ask the runtime to install
the listed packages before running the script:
# requirements: pytoml, keras
You can install specific versions of a package
using pip-like package specifiers:
# r: pytoml==0.10.2, keras>=2.6.0
"""
For example:
# r: numpy==1.24.2
import numpy
I wonder if it would be good to allow launching of the command line with Rhinoās local python at the top of the search path.
Thank you for the reply.
This is what I observed:
-
After this snippet the package installs, but then everything freezes. I guess in the background files are being downloaded.
-
After some time the rhino is responding again. But I cannot type anything:
-
Then I restart rhino.
-
I open the same file again, it takes around 50 seconds to open and the components is red (with error message):
-
then I launch the file again and it works, but the first time I hit play it takes 10 seconds to run while after the 2nd load it works fast again:
-
then I again close rhino and open the grasshopper file. And the same process must be repeated. Again takes 1 minute to load the file, I need to open the editor and replay.
-
same continues any time I close rhino.
I have to admit it is cool but a bit frustrating.
Is there a way to install dependencies without using editor? It is not clear if rhino has crashed and when the process will finish
Is it normal?
And there is no command if I type in the command line, only RhinoCode is in Grasshopper as a Component:
Command: RhinoCode
Unknown command: RhinoCode
I have latest Rhino 8 WIP
As I understand it: It installes the packages on every first run, but not the ones after. Rhino is locked while this happens and sometimes stuff goes wrong and freezes. So being patient is key.
But why it is necessary to install libraries every time you open rhino for the same code and for same user? The 1 minute delay is quite big. Imagine you have a python library that builds c++ via pip install -e . that takes 20 min. If you recompile it every time you run rhino or it crashes.
Only because it is a Work In Progress build. It will change soon as I understand it.
Fingers crossed, it looks very cool and interesting, I guess it is not easy to implement but hopefully we will have proper CPython interface in the future.
It is not necessary. This was a bug with pip list
that was trying to list the installed packages. I pushed a fix for the next WIP and now package install should only happen when the package is actually missing.
Absolutely. I am working on cleanups and robustness issues for the next couple of weeks.