# Building Shapeworks from Source

**URL:** <https://shapeworks.discourse.group/t/building-shapeworks-from-source/192>\
**Category:** Uncategorized\
**Created:** [December 12, 2023, 2:00am UTC](https://shapeworks.discourse.group/t/building-shapeworks-from-source/192 "2023-12-12T02:00:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![acreegan](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@acreegan](https://shapeworks.discourse.group/u/acreegan)\
**Post date:** [December 12, 2023, 2:00am UTC](https://shapeworks.discourse.group/t/building-shapeworks-from-source/192/1 "2023-12-12T02:00:19Z")

</div>

I would like to make some contributions to Shapeworks but am having trouble setting up a developer environment. I am running Windows 11 and trying to follow the instructions [here](https://sciinstitute.github.io/ShapeWorks/6.3/dev/build.html#windows_1). Here are the steps I have taken:

- CMake, Visual Studio, and Anaconda are already installed. I forked the Shapeworks repository and cloned it to my PC.

- With conda activated in Powershell, run install\_shapeworks.bat. Then run conda activate shapeworks

- In git bash, run ./build\_dependencies. This resulted in an error: Could not find boost. I gather this is because install\_shapeworks.bat does not install the developer dependencies.

- So, in git bash, I activated conda, then ran source install\_shapeworks.sh

- Ran ./build\_dependencies. Seemed to run fine this time. Took about 1 hour. The end of my build\_dependencies.log looks like this:

```auto
Dependency paths:
  VTK_DIR: /c/g/shapeworks_dev/dependencies/install/lib/cmake/vtk-9.1
  ITK_DIR: /c/g/shapeworks_dev/dependencies/install/lib/cmake/ITK-5.2
  EIGEN_DIR: 
  OpenVDB_DIR: /c/g/shapeworks_dev/dependencies/install/lib/cmake/OpenVDB/
  LIBIGL_DIR: /c/g/shapeworks_dev/dependencies/install/libigl/cmake
  GEOMETRY_CENTRAL_DIR: /c/g/shapeworks_dev/dependencies/install/geometry-central
  ACVD_DIR: /c/g/shapeworks_dev/dependencies/install

## To configure ShapeWorks, create a build directory and from there run...

cmake -DCMAKE_CXX_FLAGS= -DCMAKE_PREFIX_PATH=/c/g/shapeworks_dev/dependencies/install -DUSE_OPENMP=ON -Wno-dev -Wno-deprecated -DCMAKE_BUILD_TYPE=Release /c/g/shapeworks_dev

real	60m24.389s
user	0m0.060s
sys	0m0.289s

```

- Installed version 6.6.1 of open source QT. Added C:\Qt\6.6.1\msvc2019\_64\bin to my Path environment variable.

- Created a directory named build, then entered it and ran the exact cmake command from the build\_dependencies output.

- Ran start shapeworks.sln. In visual studio, set configuration to release. Build ran with 32 succeeded, 0 failed, 2 skipped.

- Back in git bash, ran cmake -P cmake\_install.cmake (Not sure if this is needed?) Redulted in error, cannot find C:\Windows\SysWOW64\vcruntime140\_1.dll. Pasted this dll into this location from the ITK installation in conda. cmake script then ran fine.

- Ran source …/devenv.sh ./bin/Release/

- Ran ctest -C Release. Resulted in 40% pass:

```auto
Test project C:/g/shapeworks_dev/build
      Start 1: ImageTests
 1/10 Test #1: ImageTests ....................... Passed 61.40 sec
      Start 2: MeshTests
 2/10 Test #2: MeshTests ........................ Passed 25.21 sec
      Start 3: GroomTests
 3/10 Test #3: GroomTests .......................Exit code 0xc0000135
***Exception: 0.03 sec
      Start 4: OptimizeTests
 4/10 Test #4: OptimizeTests ....................Exit code 0xc0000135
***Exception: 0.03 sec
      Start 5: PythonTests
 5/10 Test #5: PythonTests ......................***Failed 41.59 sec
      Start 6: ParticlesTests
 6/10 Test #6: ParticlesTests ................... Passed 6.10 sec
      Start 7: ProjectTests
 7/10 Test #7: ProjectTests .....................Exit code 0xc0000135
***Exception: 0.03 sec
      Start 8: UseCaseTests
 8/10 Test #8: UseCaseTests .....................***Failed 13.29 sec
      Start 9: shapeworksTests
 9/10 Test #9: shapeworksTests ..................***Failed 6.65 sec
      Start 10: UtilsTests
10/10 Test #10: UtilsTests ....................... Passed 0.04 sec

40% tests passed, 6 tests failed out of 10

Total Test time (real) = 154.41 sec

```

- Importing shapeworks in python results in the following error:

```auto
Python 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:50:36) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import shapeworks
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\g\shapeworks_dev\Python\shapeworks\shapeworks\ __init__.py", line 5, in <module>
    from shapeworks_py import *
ImportError: DLL load failed while importing shapeworks_py: The specified module could not be found.

```

---

<div class="post-metadata">

**Author:** ![amorris](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@amorris](https://shapeworks.discourse.group/u/amorris)\
**Post date:** [January 18, 2024, 5:12pm UTC](https://shapeworks.discourse.group/t/building-shapeworks-from-source/192/2 "2024-01-18T17:12:55Z")

</div>

I am surprised it build with Qt6 with no changes, but that’s great.

All of your test errors are likely related to the python module loading. It’s a little more difficult on windows. You may need to add the shapeworks bin directory to both %PATH% and %PYTHONPATH%.
