Closed chriswmackey closed 3 years ago
Ah! Did you recently updated your OpenStudio library files? I have to revert back to version 1.4. Give me a second and I will update the download link.
Ok, Cool.
Let's see if this will solve the issue: https://app.box.com/s/y2sx16k98g1lfd3r47zi
I am still getting the error. Could we try another version?
Did you try to unblock .dll files? I can upload version 1.4.0 tomorrow. We really need OpenStudio team's help for this. There is almost nothing that I can do about it. Have you ever successfully loaded the libraries? and do you remember what was the version. FYI: @axelstudios, @macumber
Hey @mostaphaRoudsari can you point me to some instructions on how to set up the Honeybee environment with OpenStudio? I had tried this at one point but have completely forgotten
I am pretty sure that the files are unblocked. I was able to run the OpenStudio component before if that is any indication. How do I unblock the files in case that is the issue?
Hi @macumber! Thank you for the very quick reply. We don't have an instruction but I can send you an example file tomorrow or even tonight and show you how to run it on your system. Let me know when do you want me to do it.
@chriswmackey if it doesn't show up when you right click and check the properties then it is unblocked.
Ok. It is unblocked, then.
@mostaphaRoudsari I think some written instructions would be best, especially as I am sure something else is bound to come up in the future :-/
@macumber you are definitely right.
Ok. Here is an example file: https://www.dropbox.com/s/pwpsravhwk0vlal/OpenStudioExample.gh?dl=0
Let me try right now to come up with an instruction:
Let me know if you have any question about any of the steps. Thanks!
I just wrote this for debugging this type of problem for the SketchUp plug-in, it might apply here. I'm going to try to get the Honeybee environment set up and try these steps but you guys might be able to beat me to it.
If none of the steps above work and you are on Windows, it is likely that there is a dynamic library being loaded from another application that is interfering with OpenStudio. If you just want to fix your problem, try copying the files libeay32.dll and ssleay32.dll from C:\Program Files (x86)\OpenStudio X.X.X\bin to C:\Program Files (x86)\SketchUp\SketchUp 2014, this will fix the problem 80% of the time.
If you want to investigate in more depth, download Dependency Walker. Extract the files and launch depends.exe. Navigate to File->Open and then browse to choose the SketchUp.exe under C:\Program Files (x86)\SketchUp\SketchUp 2014. This will examine all of the libraries loaded by SketchUp but not the libraries loaded by OpenStudio. Navigate to Profile->Start Profiling then press Ok in the dialog that pops up. This will launch SketchUp and attempt to load OpenStudio. Scroll down in the list of loaded libraries and look for the OpenStudio dlls. Expand the paths under the OpenStudio dlls and look for libraries that are being loaded from other locations. Often, some other program will install a different version of one of the libraries (usually libeay32.dll or ssleay32.dll) that OpenStudio uses. This other library will be in the path ahead of OpenStudio and will be loaded instead, this results in a hard crash of SketchUp. Correcting your path or copying the dlls from the OpenStudio bin directory into the SketchUp install directory will cause the correct dlls to be loaded when SketchUp starts.
Are you copying files from C:\Program Files\OpenStudio 1.5.0\CSharp\openstudio or from here C:\Program Files\OpenStudio 1.5.0\bin? I believe you may need both sets of dlls.
@mostaphaRoudsari I clicked on the red button but nothing seemed to happen. I read some of the readMe outputs but I didn't understand the messages (something about Type Error: Value cannot be null)
How do I get Honeybee to update itself? Does it automatically do that?
@macumber we only copy the ones from C:\Program Files\OpenStudio 1.5.0\CSharp\openstudio
If you zoom in on the orange component there will be a baloon on top of the component that you can click on it and read the message. Here is an example:
Is the path to weather file correct?
You can update Honeybee from github but you shouldn't need to do that right now.
@macumber just as a reminder we are using 64bit bindings of C#.
@macumber I followed your instruction and copied .dlls from both folders to c:\ladybug\OpenStudio but it still gives me the same error
@chriswmackey I also updated the files here if you want to give it a try on your system: https://app.box.com/s/y2sx16k98g1lfd3r47zi
I'm also adding @jacoposartore to the discussion as he has the same issue on his system (https://github.com/mostaphaRoudsari/Honeybee/issues/170)
@mostaphaRoudsari can you try following the steps to use dependency walker to diagnose if any dlls are getting loaded incorrectly? you might also try making sure that C:\ladybug\OpenStudio is the first entry in your path.
@macumber will test it later this week and update you. Can you re-produce the error on your system?
@mostaphaRoudsari No but I can't reproduce the successful run either
@macumber I finally get a chance to check this. I'm not sure if I can follow your the steps that you mentioned in Grasshopper. There is no Grasshopper.exe file that I can use for profiling.
BTW here is the results when I load OpenStudio.dll
I tried to copy IESHIMS.dll into the folder but then it gives me another error.
The most strange part is that now I can import openstudio with no problem on my system. Makes it really hard to debug. The path is at the end of system paths.
@chriswmackey can you try similar approach on your system? Here is a simple file that tries to import the libraries:https://www.dropbox.com/s/p6ze63n3k3ctmqt/testImportingOpenStudioLibs.gh?dl=0
Here is OpenStudio libraries that I use: https://www.dropbox.com/s/4azxa9shit0wpn2/openstudio_CSharp_64bits_Ver.1.5.0.zip?dl=0 Copy them to c:\ladybug\openstudio
@macumber you should also be able to run the grasshopper file too. It is a component that only tries to import the library and print it.
Hello @macumber and @mostaphaRoudsari ,
I'm sorry for getting back so late here and for not trying the previous suggestion (a month ago) on my system. I first tried opening the GH file that you posted, Mostapha, and got and, as expected, got an error:
Next, I tried copying the libraries into C:\Ladybug\openstudio and re-opened the GH file but I still got the same error. Then, I realized that the script that you wrote, Mostapha, was importing the libraries from the Honeybee default folder and so I copied the libraries to C:\Users\cwmackey\AppData\Roaming\Ladybug\OpenStudio. I still got the same error.
Let me know if there is anything else that you would like me to test. -Chris
@macumber and @mostaphaRoudsari ,
Scratch my last comment. I looks like the libraries are importing well on my system but there was just something going wrong with the Grasshopper display. As you can see from the screenshot below, the libraries seems to be coming in well:
To be clear, I still get the same PINVOKE error when I try to run the OpenStudio component:
@chriswmackey thanks for testing. Now that I tested OpenStudio component again it also fails on my system. The error is not in import line but when the code initializes the model.
ops.Model()
@macumber can you please test this file: https://www.dropbox.com/s/p6ze63n3k3ctmqt/testImportingOpenStudioLibs.gh?dl=0
It is a pretty simple code and should run on your system without giving the warnings.
import scriptcontext as sc
import os
if sc.sticky.has_key('honeybee_release'):
openStudioLibFolder = os.path.join(sc.sticky["Honeybee_DefaultFolder"], "OpenStudio")
if os.path.isdir(openStudioLibFolder) and os.path.isfile(os.path.join(openStudioLibFolder, "openStudio.dll")):
import clr
clr.AddReferenceToFileAndPath(openStudioLibFolder+"\\openStudio.dll")
import sys
if openStudioLibFolder not in sys.path:
sys.path.append(openStudioLibFolder)
import OpenStudio as ops
ops.Model()
else:
print "Can't find OpenStudio library in " + openStudioLibFolder
@mostaphaRoudsari @chiensiTB I tried looking into this today. I downloaded the newest version of Ladybug/Honeybee from food4rhino, removed my old Ladybug/Honeybee, and updated to the new versions. I removed my old C:\ladybug\OpenStudio, added a new C:\Users\dmacumbe\AppData\Roaming\Ladybug\OpenStudio, and copied the linked OpenStudio dlls over there. When I try to run the testImportingOpenStudioLibs.gh script I get this output:
Runtime error (IOException): file does not exist: C:\Users\dmacumbe\AppData\Roaming\Ladybug\OpenStudio\openStudio.dll Traceback: line 12, in script
I corrected the case of OpenStudio.dll but still get the same error. The file does exist on my computer. I suspect some other problem is happening, see this post http://ironpython.codeplex.com/workitem/31749.
Is this the latest error you guys are seeing?
@macumber thank you for looking into this. No we don't have the issue of finding the file. Did you unblock your .dlls? (Right click on the file > unblock?)
try this sample file. It only tries to import the library. Thanks again and let me know if you want to set up a googleHangout and try to figure it out together. This will be a huge help to us to go forward.
Hey Mostapha, I had problems with the OpenStudio package that OpenStudioExample.gh pointed me to, https://app.box.com/s/y2sx16k98g1lfd3r47zi.
Instead, I downloaded the 1.6.0 64bit OpenStudio installer from https://www.openstudio.net/downloads, ran the installer, then copied all the files from 'C:\Program Files\OpenStudio 1.6.0\CSharp\openstudio' to 'C:\Users\dmacumbe\AppData\Roaming\Ladybug\OpenStudio'.
After that testImportingOpenStudioLibs.gh works fine, and OpenStudioExample.gh works but I get this message (I don't know how to change units):
Currently the OpenStudio component only works in meters. Change the units to Meters and try again!
If you guys use the OpenStudio dlls from our installer do you still run into pInvoke problems?
Ok, figured out how to change units and ran the simulation :-)
However, OS 1.6.0 writes a E+ 8.2 file but Ladybug used E+ 8.1 so this was not exactly perfect....
@chiensiTB @mostaphaRoudsari
@macumber you imported the latest version of OpenStudio with no problem! That's great. Can you share the libraries with us so we can also try it on our systems?
The most recent version of Honeybee on github actually works with both 8.1 and 8.2
@mostaphaRoudsari like I said, just download the installer from https://www.openstudio.net/downloads, run the installer, then copy all the files from 'C:\Program Files\OpenStudio 1.6.0\CSharp\openstudio' to 'C:\Users#{your_user}\AppData\Roaming\Ladybug\OpenStudio'.
@macumber as far as I can see the site is under maintenance
but I have also a question. Are you shipping 64bits library also with installation? I remember it used to be 32bits which wasn't working for us.
Weird, the website was working for me. You can also get downloads on our github page, here is a link to the 1.6.0 release, https://github.com/NREL/OpenStudio/releases/tag/v1.6.0
Direct link to 64 bit installer, https://github.com/NREL/OpenStudio/releases/download/v1.6.0/OpenStudio-1.6.0.1229eac298-Win64.exe
Our default installer on Windows is now 64 bit since SketchUp 2015 is now 64 bit
@macumber Thanks. Downloading right now! I'll let you know if it works on my system.
@chiensiTB, @chriswmackey and @jacoposartore can you guys also test on your systems and let us know the results?
@macumber :( - Still the same error on my system.
Hmm, bummer. I am uploading a copy of my debug build dlls to this link (will take some time to upload), https://www.dropbox.com/s/oczwi4yylxixcvg/OpenStudio_1_6_3.zip?dl=0
Maybe those will give you some more information. If not, I think the thing to do would be to have you build your own 64 bit OpenStudio bindings and try those out, that will give you better debug information.
The only other idea I have is instead of appending the OpenStudio dir to the end of your path, you might try adding at the front of the path.
Ok this is definitely a path issue, I was just able to reproduce by doing this at the command line:
C:\Program Files\Rhinoceros 5 (64-bit)\System>set PATH="" C:\Program Files\Rhinoceros 5 (64-bit)\System>Rhino.exe
Are you talking about sys.path or are you talking about my windows system path? I added the path as the first item to sys.path and it is still the same
Have you tried adding this line (works for me when starting with an empty path):
os.environ['PATH'] = os.environ['PATH'] + ";" + openStudioLibFolder
Looks like sys.path is just the Python path, does not actually affect the system path which is where dependent libraries are loaded from
Just tried and it doesn't help. the same error. There should be something else in your Windows path that I don't have in mine. I hope the debug version tells us something about that...
hi @mostaphaRoudsari I just have tried on my system what @macumber did (copying the dlls within C:\Program Files\OpenStudio 1.6.0\CSharp\openstudio into c:\ladybug\openstudio) and now both the testImportingOpenStudioLibs.gh and the OpenStudioExample.gh are working fine.
In particular, as regards the last file, the Export to OpenStudio component returns an orange error about not having the latest OpenStudio libraries but the .osm file is eventually generated as you can see from the screenshot.
I have added a screenshot form Google Sketchup, the file is perfectly generated. Great job guys!
Hmm @mostaphaRoudsari, in my testing I reproduced your error by completely wiping out my PATH environment variable before starting Rhino. Then I fixed the error by adding the openStudioLibFolder to the PATH environment variable (Rhino did add some Rhino paths to this variable when it started) in the script before loading the assembly file, here is the code that did that:
os.environ['PATH'] = os.environ['PATH'] + ";" + openStudioLibFolder
I guess that you could test by adding openStudioLibFolder to your regular windows PATH, but I think my fix will be better for most of your users as they won't have to modify their PATH permanently. Could you try again to see if this works for you?
@macumber I tested on my work machine and it works fine. Still have the issue on my laptop. Also used the new debug libraries and it generates similar error report. Nothing really helpful.
Thanks @jacoposartore
Thanks everyone for testing, @mostaphaRoudsari I missed some DLLs in my first zip of debug libraries, can you re-download this one and try again on your laptop?
https://www.dropbox.com/s/oczwi4yylxixcvg/OpenStudio_1_6_3.zip?dl=0
Also, it is possible there is something in your path that is causing an issue (alternate versions of Qt or OpenSSL would be my guess). Can you open a command prompt in your Rhino folder and type these commands:
C:\Program Files\Rhinoceros 5 (64-bit)\System>set PATH="" C:\Program Files\Rhinoceros 5 (64-bit)\System>set PYTHONPATH="" C:\Program Files\Rhinoceros 5 (64-bit)\System>Rhino.exe
That will launch Rhino from an empty environment, then when you run the code you will be starting from a clean start. It's ugly but in OpenStudio we get around these issues by always adding our stuff to the front of the path when our applications load.
:|. I cleaned it up inside the code and also tried your solution and in both cases it doesn't work. as you can see I only have c:\openstudio\openstudio in both Windows path and python's sys.path
@macumber I'm uninstalling OpenSSL and Qt! Let's see if that helps.
Can you try this code:
import scriptcontext as sc
import os
if sc.sticky.has_key('honeybee_release'):
openStudioLibFolder = os.path.join(sc.sticky["Honeybee_DefaultFolder"], "OpenStudio")
if os.path.isdir(openStudioLibFolder) and os.path.isfile(os.path.join(openStudioLibFolder, "OpenStudio.dll")):
print os.environ['PATH']
os.environ['PATH'] = openStudioLibFolder + ";" + os.environ['PATH']
print os.environ['PATH']
import sys
if openStudioLibFolder not in sys.path:
sys.path.append(openStudioLibFolder)
import clr
clr.AddReferenceToFileAndPath(openStudioLibFolder+"\\OpenStudio.dll")
import OpenStudio as ops
print ops.Model()
else:
print "Can't find OpenStudio library in " + openStudioLibFolder
No luck! I also removed Qt and uninstalled OpenSSL
I see a bunch of other stuff in your path, are you using the command prompt to clear PATH and PYTHON path (will only affect that command prompt session) and start Rhino from a clean environment?
I copied my second try. Here is the first one with clean path:
@chiensiTB , Do you know why I get this error with the OpenStudio Component that you just committed?