Hi!
Has anyone managed to run Jupyter Notebook from grasshopper? I.e. triggering a certain .ipynb file to run, and then receiving its output?
Hi!
Has anyone managed to run Jupyter Notebook from grasshopper? I.e. triggering a certain .ipynb file to run, and then receiving its output?
You can export your notebooks as py files and refer to the py files from grasshopper.
Using GH Python Remote? Or is there another way?
If you want access to cpython like your pandas or numpy etc, then you can use Gh_cpython from food4rhino or remote. I believe there are other solutions also - the newest ladybug tools uses python 3 in grasshopper afaik.
If you donât need those libraries, then you can load your .py file using import statements in your gh_python component
I have other dependencies for the Jupyter notebook code, and they donât seem to work with GH_cpython or remote, unfortunately
I wonder if there is a way to execute the jupyter code without having to run it in grasshopper
Hello,
When I have done things like this I have run my Jupyter notebook separately, saving the results to a csv file or similar, then loaded the results inside Rhino. Obviously that is not ideal if there is a lot of interraction between your geometry and your python code.
In that case, save the jupyter notebook as a .py file somewhere on your drive.
Have a gh python script to run the bash/cmd using subprocess to run the python script in the background (basically calling âpython3 your path/yourfile.pyâ as a windows subprocess).
And then check wherever your results should land using readfile afterwards.
import subprocess
subprocess.call(âpython3 path/file.pyâ)
This works so well, thank you very much!
Hey,
I know itâs not the answer to your question, but I also wanted to connect both (Grasshopper and JupyterLab). If you have any video how it works for you then it would be really helpful if you could show us
What I did was basic file export, so I could export data from JupyterLab to Grasshopper and from Grasshopper to JupyterLab: https://www.youtube.com/watch?v=ccvalWGqsGw
But if you find more elegant solution - let me know
@w.radaczynski your work looks great! I would like to know more
Thank you Andrea! What I did was pretty straight forward - with Python I was saving text file dynamically with all the needed data, and then âRead fileâ component is reading dynamically the data inside Grasshopper. The same way it can go other way around. Maybe there is some other more clever way to do it, but for me it wwasa sufficient enough.
do you have a sample file that I could look at? even if limited to geometry only
I think I donât have it anymore, but if youâll look at the 0:05, there is a source code for Python (JupyterLab) part, and if you want to input the values inside Grasshopper (that were saved to this text file): All I did was something like this: