Revision history [back]
So in answer to my own question, the issue was trying to build using Visual Studio 2015. After a few missteps I've managed to get a working build using Visual Studio 2013. Thanks definitely due to @MarkAdams!
There are five main steps to the process - setting up the tools required, cloning the source code, configuring and generating the solution file in CMake, building in Visual Studio 2013, and finally setting up your Python environment
1) Set up the build environment for Windows
Install the software listed:
Visual Studio 2013 with Update 5 (must be VisualStudio 2013 - trying to build with VisualStudio 2015 Community Edition failed)
msysGit for working with Git
NSIS (builds the installer that packages everything up including the Python library)
Add C:\Qt\Qt5.3.2\5.3\msvc2013_64_opengl\bin to the System Path
2) Clone OpenStudio from Github
Launch Git Bash and run the following commands in the folder you want to build in. I ran directly in C: so my source folder will be C:\OpenStudio throughout this step-by-step.
git clone -b develop git@github.com:NREL/OpenStudio.git
cd OpenStudio
mkdir build
3) Configure and generate in CMake
Launch CMake
Set the path to the source code:
C:\OpenStudioand the build path:C:\OpenStudio\buildHit Configure and selected
Visual Studio 12 2013 Win64from the dropdownLeave the radio button on the default,
Use default native compilersCMake runs for a little while then will hit an error which prompts to set
SWIG_EXECUTABLESet the full path to the swig.exe executable
C:/swigwin-3.0.7/swig.exeTick
BUILD_PACKAGEandBUILD_PYTHON_BINDINGSKeep hitting
Configureuntil the red highlighting on the new entries is all goneHit
Generate
4) Build in Visual Studio 2013
Open up Visual Studio 2013 and open the
OpenStudio.slnfile from thebuilddirectoryBuild > Configuration Managerset the build configuration toRelease. This is needed because we don't havepython_d.libon the system which is required for aDebugbuildSet to build
PACKAGEsince that setting wasn't set and this answer suggested we need itRun
Build > Build solutionwhich churns away for a few hours and eventually spits out the final productRun the installer from
C:\OpenStudio\build\_CPack_Packages\win64\NSIS
5) Make it visible to Python (edited)
- Add an
__init__.pyfile toC:\Program Files\OpenStudio 1.8.5\Python\openstudioto make it into a Python package Add the following to the
__init__.pyfile for all the imports. My one's here. I think it could be better structured (@MarkAdams, any suggestions? I notice you dofrom openstudioutilitiescore import *hereimport openstudioairflow as airflow import openstudioanalysis as analysis ...
Add
C:\Program Files\OpenStudio 1.8.5\Python(or wherever you installed to) to you Python path- Test it out. Open up a Python shell and try
from openstudio import model print model.Model()
You should see:
OS:Version,
{2a919255-8208-412f-a328-62f40f74182c}, !- Handle
1.8.5; !- Version Identifier
That's it. That's really not as many steps as it felt like at the time! I hope this step-by-step helps someone out.
So in answer to my own question, the issue was trying to build using Visual Studio 2015. After a few missteps I've managed to get a working build using Visual Studio 2013. Thanks definitely due to @MarkAdams!
There are five main steps to the process - setting up the tools required, cloning the source code, configuring and generating the solution file in CMake, building in Visual Studio 2013, and finally setting up your Python environment
1) Set up the build environment for Windows
Install the software listed:
Visual Studio 2013 with Update 5 (must be VisualStudio 2013 - trying to build with VisualStudio 2015 Community Edition failed)
msysGit for working with Git
NSIS (builds the installer that packages everything up including the Python library)
Add C:\Qt\Qt5.3.2\5.3\msvc2013_64_opengl\bin to the System Path
2) Clone OpenStudio from Github
Launch Git Bash and run the following commands in the folder you want to build in. I ran directly in C: so my source folder will be C:\OpenStudio throughout this step-by-step.
git clone -b develop git@github.com:NREL/OpenStudio.git
cd OpenStudio
mkdir build
3) Configure and generate in CMake
Launch CMake
Set the path to the source code:
C:\OpenStudioand the build path:C:\OpenStudio\buildHit Configure and selected
Visual Studio 12from the dropdown20132015 Win64Leave the radio button on the default,
Use default native compilersCMake runs for a little while then will hit an error which prompts to set
SWIG_EXECUTABLESet the full path to the swig.exe executable
C:/swigwin-3.0.7/swig.exeTick
BUILD_PACKAGEandBUILD_PYTHON_BINDINGSKeep hitting
Configureuntil the red highlighting on the new entries is all goneHit
Generate
4) Build in Visual Studio 2013
Open up Visual Studio 2013 and open the
OpenStudio.slnfile from thebuilddirectoryBuild > Configuration Managerset the build configuration toRelease. This is needed because we don't havepython_d.libon the system which is required for aDebugbuildSet to build
PACKAGEsince that setting wasn't set and this answer suggested we need itRun
Build > Build solutionwhich churns away for a few hours and eventually spits out the final productRun the installer from
C:\OpenStudio\build\_CPack_Packages\win64\NSIS
5) Make it visible to Python (edited)
- Add an
__init__.pyfile toC:\Program Files\OpenStudio 1.8.5\Python\openstudioto make it into a Python package Add the following to the
__init__.pyfile for all the imports. My one's here. I think it could be better structured (@MarkAdams, any suggestions? I notice you dofrom openstudioutilitiescore import *hereimport openstudioairflow as airflow import openstudioanalysis as analysis ...
Add
C:\Program Files\OpenStudio 1.8.5\Python(or wherever you installed to) to you Python path- Test it out. Open up a Python shell and try
from openstudio import model print model.Model()
You should see:
OS:Version,
{2a919255-8208-412f-a328-62f40f74182c}, !- Handle
1.8.5; !- Version Identifier
That's it. That's really not as many steps as it felt like at the time! I hope this step-by-step helps someone out.
So in answer to my own question, the issue was trying to build using Visual Studio 2015. After a few missteps I've managed to get a working build using Visual Studio 2013. Thanks definitely due to @MarkAdams!
There are five main steps to the process - setting up the tools required, cloning the source code, configuring and generating the solution file in CMake, building in Visual Studio 2013, and finally setting up your Python environment
1) Set up the build environment for Windows
Install the software listed:
Visual Studio 2013 with Update 5 (must be VisualStudio 2013 - trying to build with VisualStudio 2015 Community Edition failed)
msysGit for working with Git
NSIS (builds the installer that packages everything up including the Python library)
Add C:\Qt\Qt5.3.2\5.3\msvc2013_64_opengl\bin to the System Path
2) Clone OpenStudio from Github
Launch Git Bash and run the following commands in the folder you want to build in. I ran directly in C: so my source folder will be C:\OpenStudio throughout this step-by-step.
git clone -b develop git@github.com:NREL/OpenStudio.git
cd OpenStudio
mkdir build
3) Configure and generate in CMake
Launch CMake
Set the path to the source code:
C:\OpenStudioand the build path:C:\OpenStudio\buildHit Configure and selected
Visual Studio 12 2015 Win64from the dropdownLeave the radio button on the default,
Use default native compilersCMake runs for a little while then will hit an error which prompts to set
SWIG_EXECUTABLESet the full path to the swig.exe executable
C:/swigwin-3.0.7/swig.exeTick
BUILD_PACKAGEandBUILD_PYTHON_BINDINGSKeep hitting
Configureuntil the red highlighting on the new entries is all goneHit
Generate
4) Build in Visual Studio 2013
Open up Visual Studio 2013 and open the
OpenStudio.slnfile from thebuilddirectoryBuild > Configuration Managerset the build configuration toRelease. This is needed because we don't havepython_d.libon the system which is required for aDebugbuildSet to build
PACKAGEsince that setting wasn't set and this answer suggested we need itRun
Build > Build solutionwhich churns away for a few hours and eventually spits out the final productRun the installer from
C:\OpenStudio\build\_CPack_Packages\win64\NSIS
5) Make Add library path to PYTHONPATH
Add
C:\OpenStudio\build\_CPack_Packages\win64\NSIS\OpenStudio-1.8.5.ffdfae3164-Win64\Python\openstudioto your environment (not sure if itvisible to Python (edited)will always be- Add an
__init__.pyfile toC:\Program Files\OpenStudio 1.8.5\Python\openstudioto make it into a Python package Add the following to the
__init__.pyfile for all the imports. My one's here. I think it could
better structured (@MarkAdams, any suggestions? I notice you dofrom openstudioutilitiescore import *hereimport openstudioairflow as airflow import openstudioanalysis as analysis ...
- Add an
Add
C:\Program Files\OpenStudio 1.8.5\Python(or wherever you installed to) to you Python path- called this, but something similar at least)
Test it out. Open up a Python shell and
trytryimport openstudioenergyplus
from openstudio import model print model.Model()
You should see:
OS:Version,
{2a919255-8208-412f-a328-62f40f74182c}, !- Handle
1.8.5; !- Version Identifier
That's it. I get no error importing a module from the Python shell. That's really not as many steps as it felt like at the time! I hope this step-by-step helps someone out.
So in answer to my own question, the issue was trying to build using Visual Studio 2015. After a few missteps I've managed to get a working build using Visual Studio 2013. Thanks definitely due to @MarkAdams!
There are five main steps to the process - setting up the tools required, cloning the source code, configuring and generating the solution file in CMake, building in Visual Studio 2013, and finally setting up your Python environment
1) Set up the build environment for Windows
Install the software listed:
Visual Studio 2013 with Update 5 (must be VisualStudio 2013 - trying to build with VisualStudio 2015 Community Edition failed)
msysGit for working with Git
NSIS (builds the installer that packages everything up including the Python library)
Add C:\Qt\Qt5.3.2\5.3\msvc2013_64_opengl\bin to the System Path
2) Clone OpenStudio from Github
Launch Git Bash and run the following commands in the folder you want to build in. I ran directly in C: so my source folder will be C:\OpenStudio throughout this step-by-step.
git clone -b develop git@github.com:NREL/OpenStudio.git
cd OpenStudio
mkdir build
3) Configure and generate in CMake
Launch CMake
Set the path to the source code:
C:\OpenStudioand the build path:C:\OpenStudio\buildHit Configure and selected
Visual Studio 12 2015 Win64from the dropdownLeave the radio button on the default,
Use default native compilersCMake runs for a little while then will hit an error which prompts to set
SWIG_EXECUTABLESet the full path to the swig.exe executable
C:/swigwin-3.0.7/swig.exeTick
BUILD_PACKAGEandBUILD_PYTHON_BINDINGSKeep hittingHitConfigureuntilHit
Configureagain (not sure if this was needed but it gets rid of the red highlighting on the newentries is all goneentries)Hit
Generate
4) Build in Visual Studio 2013
Open up Visual Studio 2013 and open the
OpenStudio.slnfile from thebuilddirectoryBuild > Configuration Managerset the build configuration toRelease. This is needed because we don't havepython_d.libon the system which is required for aDebugbuildSet to build
PACKAGEsince that setting wasn't set and this answer suggested we need itRun
Build > Build solutionwhich churns away for a few hours and eventually spits out the final product
5) Add library path to PYTHONPATH
Add
C:\OpenStudio\build\_CPack_Packages\win64\NSIS\OpenStudio-1.8.5.ffdfae3164-Win64\Python\openstudioto your environment (not sure if it will always be called this, but something similar at least)Test it out. Open up a Python shell and try
import openstudioenergyplus
That's it. I get no error importing a module from the Python shell. That's really not as many steps as it felt like at the time! I hope this step-by-step helps someone out.
So in answer to my own question, the issue was trying to build using Visual Studio 2015. After a few missteps I've managed to get a working build using Visual Studio 2013. Thanks definitely due to @MarkAdams!
There are five main steps to the process - setting up the tools required, cloning the source code, configuring and generating the solution file in CMake, building in Visual Studio 2013, and finally setting up your Python environment
1) Set up the build environment for Windows
Install the software listed:
Visual Studio 2013 with Update 5 (must be VisualStudio 2013 - trying to build with VisualStudio 2015 Community Edition failed)
msysGit for working with Git
NSIS (builds the installer that packages everything up including the Python library)
Add C:\Qt\Qt5.3.2\5.3\msvc2013_64_opengl\bin to the System Path
2) Clone OpenStudio from Github
Launch Git Bash and run the following commands in the folder you want to build in. I ran directly in C: so my source folder will be C:\OpenStudio throughout this step-by-step.
git clone -b develop git@github.com:NREL/OpenStudio.git
cd OpenStudio
mkdir build
3) Configure and generate in CMake
Launch CMake
Set the path to the source code:
C:\OpenStudioand the build path:C:\OpenStudio\buildHit Configure and selected
Visual Studio 12 2015 Win64from the dropdownLeave the radio button on the default,
Use default native compilersCMake runs for a little while then will hit an error which prompts to set
SWIG_EXECUTABLESet the full path to the swig.exe executable
C:/swigwin-3.0.7/swig.exeTick
BUILD_PACKAGEandBUILD_PYTHON_BINDINGSHit
ConfigureHit
Configureagain (not sure if this was needed but it gets rid of the red highlighting on the new entries)Hit
Generate
4) Build in Visual Studio 2013
Open up Visual Studio 2013 and open the
OpenStudio.slnfile from thebuilddirectoryBuild > Configuration Managerset the build configuration toRelease. This is needed because we don't havepython_d.libon the system which is required for aDebugbuildSet to build
PACKAGEsince that setting wasn't set and this answer suggested we need itRun
Build > Build solutionwhich churns away for a few hours and eventually spits out the final product
5) Add library path to PYTHONPATH
Add
C:\OpenStudio\build\_CPack_Packages\win64\NSIS\OpenStudio-1.8.5.ffdfae3164-Win64\Python\openstudioto yourenvironment (not sure if it will always be called this, but something similar at least)environmentTest it out. Open up a Python shell and try
import openstudioenergyplus
That's it. I get no error importing a module from the Python shell. That's really not as many steps as it felt like at the time! I hope this step-by-step helps someone out.
So in answer to my own question, the issue was trying to build using Visual Studio 2015. After a few missteps I've managed to get a working build using Visual Studio 2013. Thanks definitely due to @MarkAdams!
There are five main steps to the process - setting up the tools required, cloning the source code, configuring and generating the solution file in CMake, building in Visual Studio 2013, and finally setting up your Python environment
1) Set up the build environment for Windows
Install the software listed:
Visual Studio 2013 with Update 5 (must be VisualStudio 2013 - trying to build with VisualStudio 2015 Community Edition failed)
msysGit for working with Git
EnergyPlus 8.3.0 (have a guess)
NSIS (builds the installer that packages everything up including the Python library)
Add C:\Qt\Qt5.3.2\5.3\msvc2013_64_opengl\bin to the System Path
2) Clone OpenStudio from Github
Launch Git Bash and run the following commands in the folder you want to build in. I ran directly in C: so my source folder will be C:\OpenStudio throughout this step-by-step.
git clone -b develop git@github.com:NREL/OpenStudio.git
cd OpenStudio
mkdir build
3) Configure and generate in CMake
Launch CMake
Set the path to the source code:
C:\OpenStudioand the build path:C:\OpenStudio\buildHit Configure and selected
Visual Studio 12 2015 Win64from the dropdownLeave the radio button on the default,
Use default native compilersCMake runs for a little while then will hit an error which prompts to set
SWIG_EXECUTABLESet the full path to the swig.exe executable
C:/swigwin-3.0.7/swig.exeTick
BUILD_PACKAGEandBUILD_PYTHON_BINDINGSHit
ConfigureHit
Configureagain (not sure if this was needed but it gets rid of the red highlighting on the new entries)Hit
Generate
4) Build in Visual Studio 2013
Open up Visual Studio 2013 and open the
OpenStudio.slnfile from thebuilddirectoryBuild > Configuration Managerset the build configuration toRelease. This is needed because we don't havepython_d.libon the system which is required for aDebugbuildSet to build
PACKAGEsince that setting wasn't set and this answer suggested we need itRun
Build > Build solutionwhich churns away for a few hours and eventually spits out the final product
5) Add library path to PYTHONPATH
Add
C:\OpenStudio\build\_CPack_Packages\win64\NSIS\OpenStudio-1.8.5.ffdfae3164-Win64\Python\openstudioto your environmentTest it out. Open up a Python shell and try
import openstudioenergyplus
That's it. I get no error importing a module from the Python shell. That's really not as many steps as it felt like at the time! I hope this step-by-step helps someone out.