# Slicer FiberTractMeasurements unable to find libSlicerBaseLogic

**URL:** https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357
**Category:** SlicerDMRI
**Tags:** diffusion, tractography
**Created:** [July 2, 2023, 10:52pm UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357 "2023-07-02T22:52:49Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 2, 2023, 10:52pm UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357/1 "2023-07-02T22:52:50Z")

</div>

Hi,  
I am trying to run [WMA](https://github.com/SlicerDMRI/whitematteranalysis) on a given dataset. The process runs fine until the moment where the `FiberTractMeasurements` module in Slicer is called. The tool writes the following to the std output:

```auto
<wm_apply_ORG_atlas_to_subject> Report diffusion measurements of fiber clusters.
Importing whitematteranalysis package.
<wm_diffusion_measurements>. Starting scalar measurement extraction.

=====input directory======
 {my_data}/FiberClustering/SeparatedClusters/tracts_commissural
=====output directory=====
 {my_data}/FiberClustering/SeparatedClusters
=====3D Slicer====
 /opt/Slicer-5.2.2-linux-amd64/NA-MIC/Extensions-31382/SlicerDMRI/lib/Slicer-5.2/cli-modules/FiberTractMeasurements
==========================
/opt/Slicer-5.2.2-linux-amd64/NA-MIC/Extensions-31382/SlicerDMRI/lib/Slicer-5.2/cli-modules/FiberTractMeasurements:
error while loading shared libraries: libSlicerBaseLogic.so: cannot open shared object file: No such file or directory

<wm_diffusion_measurements>
Measurements done at: {my_data}/FiberClustering/SeparatedClusters/diffusion_measurements_commissural.csv

```

No CSV file is effectively written after the `libSlicerBaseLogic` library not being found. A `find` shows that the library is there:

```auto
$ find /opt/Slicer-5.2.2-linux-amd64/ -name libSlicerBaseLogic.so
/opt/Slicer-5.2.2-linux-amd64/lib/Slicer-5.2/libSlicerBaseLogic.so

```

I had a look at the [CDash dashboard](https://slicer.cdash.org/index.php?project=SlicerStable), including the [Linux SlicerDMRI build](https://slicer.cdash.org/viewTest.php?onlyfailed&buildid=3077318) but did not find any relevant information.

How can I investigate/debug further/fix this issue?

I have tried computing the measures from the GUI but no file is being written.

Thanks.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [July 3, 2023, 2:44pm UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357/2 "2023-07-03T14:44:41Z")

</div>

I’m guessing that this script was developed on Mac, where the shared library paths are baked into the executable. On linux you need to use Slicer’s launch environment. Easiest would be to run

`Slicer --launch bash`

to create a shell with the right environment and run the whitematteranalysis scripts in that shell.

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 3, 2023, 5:27pm UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357/3 "2023-07-03T17:27:37Z")

</div>

Thanks for the answer Steve.

The script I am using calls to `wm_apply_ORG_atlas_to_subject.sh`, but it is not being found within Slicer’s launch environment:

```auto
wm_apply_ORG_atlas_to_subject.sh: not found

```

If I give it its absolute path, then the immediately next WMA script called by the former (`wm_register_to_atlas_new.py`) is not found. Adding the absolute path where the WMA scripts are installed to the `PATH` env variable does not help either.

Slicer comes with a Python 3.9 version; my default is Python 3.10, and have installed WMA following the website’s instructions. A `pip show whitematteranalysis` within the launch environment results in a

```auto
ModuleNotFoundError: No module named 'importlib.readers'

```

Do I need to install it within Slicer’s launch environment?

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [July 3, 2023, 5:35pm UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357/4 "2023-07-03T17:35:34Z")

</div>

I haven’t used whitematteranalysis much, but yes, when I did it I used Slicer’s python environment.

Maybe @zhangfanmark or @ljod can suggest where to look for instructions?

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 3, 2023, 6:44pm UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357/5 "2023-07-03T18:44:39Z")

</div>

BTW, I now realize that another discourse thread reported the same error in another discourse threadh, and that I even confirmed that I was having the issue:

> [@No CSV file in DiffusionMessurements folder in WMA](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439):
>
> Hi there, I am doing whitematteranalysis along with WMA tutorial: [whitematteranalysis/subject-specific-tractography-parcellation.md at master · SlicerDMRI/whitematteranalysis · GitHub](https://github.com/SlicerDMRI/whitematteranalysis/blob/master/doc/subject-specific-tractography-parcellation.md). In the last step of tutorial, " 8. Fiber tract diffusion measurements", I could not get any CSV file in the created new DiffusionMeasurements folder with error message of below: brain@l4n:~/Desktop/WMA\_tutorial\_data$ wm\_diffusion\_measurements.py ./FiberClustering/SeparatedClusters/tracts\_commissural/ ./Diffusion…

Sorry for the cross-posting 🙃.

This has also been reported to the WMA repository as an ongoing issue:

> <https://github.com/SlicerDMRI/whitematteranalysis/issues/122#issuecomment-1481034903>
>
> Hi, while I am trying to install whitematteranalysis with 'pip install git+https…://github.com/SlicerDMRI/whitematteranalysis.git', there was an error message below:
> \[Anaconda Prompt (miniconda3).txt\](https://github.com/SlicerDMRI/whitematteranalysis/files/10917234/Anaconda.Prompt.miniconda3.txt)
> Would anyone tell me how to solve this error?
> I am using Windoows, Python 3.10, Miniconda 3.
> 
> Thank you,

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 3, 2023, 7:03pm UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357/6 "2023-07-03T19:03:29Z")

</div>

Another element in the WMA folder that may play a role in all this is this one:

> <https://github.com/SlicerDMRI/whitematteranalysis/blob/master/slicer/installWMA.sh>

Not sure this is necessary, even on macOS (the `INSTALLFOLDER` is certainly a hard-coded macOS path); even if the parent folder says `slicer`, there are no paths related to Slicer in this script.

---

<div class="post-metadata">

### Author: ![ljod](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ljod/32/652_2.png) [@ljod](https://discourse.slicer.org/u/ljod)
#### Post date: [July 3, 2023, 7:19pm UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357/7 "2023-07-03T19:19:36Z")

</div>

Hi I hope Fan can chime in because he wrote this part and uses it frequently @zhangfanmark

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 5, 2023, 12:46pm UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357/8 "2023-07-05T12:46:05Z")

</div>

@lassoan @pieper Where can we start investigating this? I am very much willing to help fixing this. Thanks.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [July 5, 2023, 5:12pm UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357/9 "2023-07-05T17:12:17Z")

</div>

At one point I worked on applying the WMA pipeline to sets of data and ran the whole process out of Slicer’s python environment, including the part where it launched the FiberTractMeasurements. This code includes some odd workarounds (like calling eddy current correction on a remote machine) but it did basically work so you might be able to start from here:

> <https://github.com/pieper/SlicerDMRI/blob/batchtract/Modules/Scripted/BatchTract/BatchTract.py>

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 5, 2023, 10:17pm UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357/10 "2023-07-05T22:17:42Z")

</div>

Thanks Steve.

Not sure this would work, as even when I try to use the “FiberTractMeasurements” module from within the GUI no CSV/output is being written. Anyways, gave it a try with a reduced version of your script (with the paths adapted to my case):

> <https://gist.github.com/jhlegarreta/d90ff3b70b3d85271a4afc953d76be14>

Launched from a terminal like

```auto
$ ./Slicer --no-main-window --python–script ~/path/to/fibertractmeasurements_slicerpy.py

```

It fails with

```auto
qSlicerMarkupsModulePrivate::addToolBar: no main window is available, toolbar is not added
qSlicerSequencesModulePrivate::addToolBar: no main window is available, toolbar is not added
Ignore argument received via command-line (not a valid URL or existing local file): "--pythonâ\u0080\u0093script"Local filepath received via command-line: "/home/path/to/fibertractmeasurements_slicerpy.py"
virtual bool qSlicerFreeSurferImporterScalarOverlayReader::load(const IOProperties&) failed: missing fileName or modelNodeId property
static void qSlicerIOManager::showLoadNodesResultDialog(bool, vtkMRMLMessageCollection*) Errors occurred while loading nodes: "Error: Loading /home/path/to/fibertractmeasurements_slicerpy.py - load failed.\n"

```

The script does exist in the provided path.

If I try a simple

```auto
$ ./Slicer --no-main-window --python-code "print("Hello")"

```

I get an error

```auto
qSlicerMarkupsModulePrivate::addToolBar: no main window is available, toolbar is not added
qSlicerSequencesModulePrivate::addToolBar: no main window is available, toolbar is not added
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'Hello' is not defined

```

So what am I missing?

---

<div class="post-metadata">

### Author: ![zhangfanmark](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/zhangfanmark/32/4451_2.png) [@zhangfanmark](https://discourse.slicer.org/u/zhangfanmark)
#### Post date: [July 6, 2023, 5:17am UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357/11 "2023-07-06T05:17:07Z")

</div>

Hi Jon,

Please take a look at my reply in the other post, which should fix the issue you have here:

> [@No CSV file in DiffusionMessurements folder in WMA](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/6):
>
> Hi @Fumi @jhlegarreta I looked in the the issue that you were facing. On MacOS (mine is Ventura 13.2.1), it is working properly for me as it is. Please see the below screenshot for my setting to run the wm\_diffusion\_measurements script using Slicer 5.2.2 stable release: On Ubuntu (mine is 20.04.4 LTS), I also saw the issue about missing lib files when using Slicer 5.2.2 when directly call the FiberTractMeasurements module in the CLI mode. In this case, we would need to use Slicer L…

Regards,  
Fan

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 6, 2023, 2:35pm UTC](https://discourse.slicer.org/t/slicer-fibertractmeasurements-unable-to-find-libslicerbaselogic/30357/12 "2023-07-06T14:35:33Z")

</div>

So the solution in the [other post](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/6) [worked for me](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/7). Thanks @zhangfanmark.
