Thank you for the update. I can recreate the issue on my end in Rhino 8 but not the other versions of Rhino. I suspect it has to do with how Rhino 8 tries to load the DLLs from a different version of Python.
@chriswmackey and @eirannejad should be able to provide better insight. Meanwhile, Iām updating my installation from RS3 to RS5 to see if that resolves the issue.
Now Iām more confident that the issue is because of how Rhino 8 loads the Python dependencies after dropping a Python 3 Script component on the canvas.
I think this may actually be an issue that @mingbo might be able to address in the Rhino plugin without having to wait for McNeel to make a change. I sense that the root of the problem is that @eirannejad had to set the PYTHONHOME variable in Rhino 8 to something that references his python environment (in the .rhinocode folder). You can see at the start of the error message that itās telling you:
Setting this PYTHONHOME variable to something that we are not using in LBT/Pollination messes up all of the commands that we make from our software to our own copy of Python 3.10 that we ship with Pollination and Ladybug Tools. When I talked to @eirannejad about this at the AEC Hackathon last year, he made it seem that resetting the PYTHONHOME back to nothing (as it used to be in Rhino 7) would break many of the ScriptEditor capabilities that he added. So I agreed to work around it by just setting the PYTHONHOME to an empty string before making any command line calls to the version of Python we ship with Pollination/Ladybug Tools. You can see an example of one of these changes here:
This has gotten everything in the Ladybug Tools plugin to work correctly in Rhino 8.
I would presume that, if @mingbo is able to do something similar before he calls the honeybee validate model command from Pollination Rhino, we can avoid this error that the Rhino plugin is throwing.
@mingbo , is any of what I am saying making sense here? If not, I may be able to help if you point me to the part of the Rhino plugin where you call the honeybee validate model command. We basically just need to call this command with a custom environment that does not have the PYTHONHOME variable set.
FYI, @milog . If you want to use Option 2. that @mostapha specified to work around the issue for now, the best way to ensure that you donāt get this error message in Rhino 8 is to just delete this folder:
C:\Users\[USERNAME]\.rhinocode
If you do that, you can have both Pollination Rhino and Grasshopper open at the same time without having anything broken in either Pollination Rhino or Ladybug Tools. But the error will come back as soon as you launch the Rhino 8 ScriptEditor or drop a Python 3 component on your canvas.
Also, bear in mind that this solution is just temporary. Hopefully, once we get @mingbo to call the commands without the Rhino 8 PYTHONHOME variable, you wonāt have a need for this workaround anymore and youāll be able to use the new Rhino 8 ScriptEditor and Python 3 components without issues.
Thanks a lot @chriswmackey to put all this in writing here. We can potentially makes some changes to make this easier but @milog I think it is just good practice to set/override the PYTHONHOME environment variable for your honeybee subprocess since it needs a different deployment of python.
Let me know if solves the problem and if now we can think of other ways
@chriswmackey I can potentially unset PYTHONHOME after I am loading the engine but I have to test this. Would you mind if I send you a 8.x build towards the end of the week to test?
For reference: RH-80931 PYTHONHOME causes conflicts with python subprocess
I am definitely happy to test any new builds you send me. Iāll likely be busy this Friday but I should be able to easily test anything before that.
I should also report that @mingbo just told me that he found a way to overwrite the PYTHONHOME variable from the methods he is using on the .NET side. So there should be a fix for this particular case that @milog brought up here very soon.
Long story short, thereās really no rush from our end, @eirannejad , though I think it would still be nice if Rhino did not set the PYTHONHOME variable for all processes by default. This would certainly make things easier for us in the future and could possibly help some other developers who are trying to work with a version of Python outside of the Rhino environment.
Iāll avoid deleting the .rhinocode folder as this is where we are developing our custom python packages for our own internal plug ins. Seems like a fix is on the horizon so Iāll hold off for now. I raised this as an issue as I was just concerned that the simulations might be affected in some way given these error messages.
I also have this problem when I choose to run on local machine in pollinate. However, when I use the cloud or just the local component, they are just fine.