- Python 3.11 or newer https://www.python.org/ or https://anaconda.org/
- Microsoft Visual Studio https://visualstudio.microsoft.com/downloads/
- uv, used to install and manage build dependencies
- Local copy of resdata
-
Download or clone the resdata GitHub repository to your local disk.
-
Python 3.11 or newer installation
- Download a python installation or a python environment solution such as Anaconda.
-
Download and install Microsoft Visual Studio . At a minimum resdata requires the VS Studio packages for cmake, msbuild, c and c++ compilers (CL.exe).
-
Open a MSVC command prompt such as x64 Native Tools Command Prompt for VS 2017 from your start menu. In the open prompt, navigate to the resdata source directory you created in step 1. Use uv (see installing uv if you don't already have it) to install resdata's pinned build requirements (cmake, ninja, etc.) via:
uv sync --group build --no-install-projectThis creates a
.venvdirectory with the pinned tools. Add.venv\Scriptsto yourPATHsocmakeand the other build tools are picked up, for example:set PATH=%CD%\.venv\Scripts;%PATH%If Python is not accessible from the prompt it may be necessary to add the Python environment location to your system path variable
PATH. -
Execute the build commands with the desired CMAKE parameters from
README.md. The cmake generator can beNMake Makefiles,Ninjaor an appropriate version ofMSVC. For the available options typecmake -Gin the MSVC command prompt.An example build and install is provided below where %VARIABLE% are user defined directory paths:
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX=%INSTALLPATH% -DBUILD_SHARED_LIBS="ON" -DENABLE_PYTHON="ON" -DCMAKE_BUILD_TYPE="Release" %SOURCEPATH%
cmake --build %BUILDPATH% --config Release --target install
-
For resdata to be accessible in Python the
%INSTALLPATH%\lib\pythonX.Y\site-packageand Python subdirectories must be added to thePATHandPYTHONPATHvariables. Wherepythonx.yis the current Python version e.g. (python3.11,python3.12etc.) . -
Open a Python interactive session and run
import resdatato check that the install and paths are now set.