nipype icon indicating copy to clipboard operation
nipype copied to clipboard

Error when running nipype-tutorial container in VScode

Open yufang1039 opened this issue 3 years ago • 4 comments

Summary

Thanks for developing this amazing tool. I'm new to nipype and docker and trying to set the tutorial container up in Vscode, however, when I run the following code block, it gives me an error.

bet = BET()
bet.inputs.in_file = input_file
bet.inputs.out_file = "/output/T1w_nipype_bet.nii.gz"
res = bet.run

image

Actual behavior

image

Expected behavior

I'm expecting to get the code block to run suceessfully

How to replicate the behavior

  1. run the docker image in vscode
Screen Shot 2022-07-14 at 12 10 48 PM
  1. Attach to the docker container Screen Shot 2022-07-14 at 12 13 21 PM

  2. select interpreter (I selected neuro) Screen Shot 2022-07-14 at 12 14 35 PM

  3. Run Screen Shot 2022-07-14 at 12 15 24 PM

Screen Shot 2022-07-14 at 12 15 37 PM

Script/Workflow details

import os
from os.path import abspath

from nipype import Workflow, Node, MapNode, Function
from nipype.interfaces.fsl import BET, IsotropicSmooth, ApplyMask

from nilearn.plotting import plot_anat
%matplotlib inline
import matplotlib.pyplot as plt

input_file =  abspath("/data/ds000114/sub-01/ses-test/anat/sub-01_ses-test_T1w.nii.gz")

bet = BET()
bet.inputs.in_file = input_file
bet.inputs.out_file = "/output/T1w_nipype_bet.nii.gz"
res = bet.run()

Execution environment

  • Container

yufang1039 avatar Jul 14 '22 19:07 yufang1039

Do you have FSL installed in the container?

effigies avatar Jul 14 '22 19:07 effigies

Hi @effigies

I used docker pull miykael/nipype_tutorial:latest to get the docker image. So I suppose FSL should be already existed in the image?

Because when I run docker run -it --rm -p 8888:8888 miykael/nipype_tutorial jupyter notebook and open notebooks in my browser, it works fine. But if I do it in the vscode, there's an error.

Thanks in advance for the help!

yufang1039 avatar Jul 14 '22 20:07 yufang1039

It seems that there might be environment variables that aren't getting loaded, such as the PATH? FSL should be available in the container.

Unfortunately, I don't have any experience with using vscode inside a container. (And little enough outside.) But the problem does seem to be that the command can't be found.

effigies avatar Jul 14 '22 20:07 effigies

Hi @effigies Thanks for the help! I decided to work in the original jupyter notebook. However, when I try to nount my local file by running this code in the tutorial

docker run -p 8888:8888 -it --rm -v /Users/yufang/Leelab/Fmri/Notebooks -v /Users/yufang/Leelab/Fmri/data -v /Users/yufang/Leelab/Fmri/output -v /Users/yufang/Leelab/Fmri/20220618_122133_1_anaesth_auditory_response_1_1  miykael/nipype_tutorial

My local files doesn't show up, the directory is still the same to the tutorial's directory and I have no idea how should I fix it

Screen Shot 2022-07-15 at 11 00 28 AM

Thanks!

yufang1039 avatar Jul 15 '22 18:07 yufang1039

Sorry, I'm not really sure what the setup of the tutorial environment is. I would suggest Neurostars for more general questions, as this repository gets very limited views.

effigies avatar Sep 21 '22 15:09 effigies