Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
4

How to create an openstudio python bindings docker file?

asked 2019-12-30 16:57:25 -0600

TomB's avatar

My goal is to create a docker file (apologies if this is the incorrect terminology) that will allow me to run an instance OpenStudio (just the command line for now) ( version >= 2.7) with python bindings.

My reasons for this include that I want to be able to 1) write measures in python, and generally interact with .osm and .idf files using python, 2) easily set up my colleagues to run the same environment/measures/workflows 3) do this from windows 10 machines 4) replicate the same environment on a linux server.

Any comments, answers or assistance would be greatly appreciated and I'll happily share a docker file once it is working nicely.

My research of the solution has so far found

edit retag flag offensive close merge delete

Comments

We need to do some cleanup for sure in the wiki, which will happen before the official OpenStudio 3.0 around April 2020. The instructions for building the current develop (formerly develop3, as in future 3.0) which uses ruby 2.5, needs Ubuntu 18.04 (not 16.04 like openstudio 2.x) is here: https://github.com/NREL/OpenStudio/wi...

Julien Marrec's avatar Julien Marrec  ( 2020-01-07 02:30:49 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
4

answered 2020-01-02 13:57:54 -0600

saeranv's avatar

I also tried to do this, and kept hitting a memory error while trying to build the bindings in Docker. It only hit about 4 hours into the ~8 hour build which really slowed down my ability to figure out a fix. It's definitely a complicated process to get it working correctly.

Luckily, another unmethours user Arif has built the python bindings for OpenStudio 2.7 and is sharing them on git here: https://github.com/arif-hanif/py3-ope.... I've cloned this repo and have it working smoothly in an ubuntu docker container. However only Arif knows how to get the bindings made correctly. I'll send him a note to see if he can provide more information here.

S

edit flag offensive delete link more

Comments

Thanks ! Can you explain, step by step, what the install and setup instructions are for this? I have tried the install instructions on the github 'pip install ..' but it does not appear to work ?

TomB's avatar TomB  ( 2020-01-02 17:39:05 -0600 )edit

There are better ways to automate this in docker, but here's a quick way that should work:

In your terminal:
Clone repo

git clone https://github.com/arif-hanif/py3-ope...

Add the directory to ld library path

export LD_LIBRARY_PATH={YOUR-DIRECTORY-HERE}/py3-openstudio-linux-sdk/py3_openstudio_linux_sdk:$LD_LIBRARY_PATH

In your python file

import sys
ops_fpath = "{YOUR-DIRECTORY-HERE}//py3-openstudio-linux-sdk/"
if os_fpath not in sys.path: sys.path.insert(0, ops_fpath)

Now this should work

import py3_openstudio_linux_sdk

saeranv's avatar saeranv  ( 2020-01-02 18:25:28 -0600 )edit

thanks saeranv!

TomB's avatar TomB  ( 2020-01-02 18:45:34 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

2 followers

Stats

Asked: 2019-12-30 16:57:25 -0600

Seen: 399 times

Last updated: Jan 02 '20