MahmoudAbdelRahman / GH_CPython

CPython plugin for Rhino-Grasshopper
BSD 2-Clause "Simplified" License
175 stars 38 forks source link

Problem with GH_CPython and Eppy run command #45

Open fracarl opened 3 years ago

fracarl commented 3 years ago

Good morning, I wrote a code to run energy analysis from Python 3.8 in Spyder (Anaconda3) and it works. In a few words, my code modifies the idf file (the file used for the energy analysis) and then launches the analysis in an external software (EnergyPlus). I was trying to use this code in grasshopper using GH_CPython code (with this path C:\Users\Pc\anaconda3\python.exe) but I'm facing different problems, it would be great to have help from you.

I have created a rhinoremote environment and imported all the scripts needed for my Python code (Eppy which is installed in anaconda) and the code seems to work if I modify my .idf file or save it. But if I try to launch the analysis it doesn't work, find attached the error.

C:\Users\Pc\anaconda3\lib\site-packages\numpy__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service from . import _distributor_init Traceback (most recent call last): File "C:\GH_CPython\PythonFileWritten_1.py", line 27, in idf.run(readvars=True, expandobjects=True,output_directory=os.path.join(folderpath,"Output")) File "C:\Users\Pc\anaconda3\lib\site-packages\eppy\modeleditor.py", line 1009, in run self.saveas("in.idf") File "C:\Users\Pc\anaconda3\lib\site-packages\eppy\modeleditor.py", line 974, in saveas self.save(filename, lineendings, encoding) File "C:\Users\Pc\anaconda3\lib\site-packages\eppy\modeleditor.py", line 947, in save with open(filename, "wb") as idf_out: PermissionError: [Errno 13] Permission denied: 'in.idf'

fracarl commented 3 years ago

I have solved the error due to numpy (changing the python path with C:\Users\Pc\anaconda3\envs\rhinoremote\python.exe) and now the the traceback is the following:

Traceback (most recent call last): File "C:\GH_CPython\PythonFileWritten_1.py", line 28, in idf.run(readvars=True, expandobjects=True,output_directory=os.path.join(folderpath,"Output")) File "C:\Users\Pc\anaconda3\envs\rhinoremote\lib\site-packages\eppy\modeleditor.py", line 1009, in run self.saveas("in.idf") File "C:\Users\Pc\anaconda3\envs\rhinoremote\lib\site-packages\eppy\modeleditor.py", line 974, in saveas self.save(filename, lineendings, encoding) File "C:\Users\Pc\anaconda3\envs\rhinoremote\lib\site-packages\eppy\modeleditor.py", line 947, in save with open(filename, "wb") as idf_out: PermissionError: [Errno 13] Permission denied: 'in.idf'

@MahmoudAbdelRahman do you have any idea of this problem?

Thank you in advance for your availability.