Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

activating conda to use datalad in a neurodocker recipe #532

Open
Remi-Gau opened this issue May 22, 2023 · 5 comments
Open

activating conda to use datalad in a neurodocker recipe #532

Remi-Gau opened this issue May 22, 2023 · 5 comments
Labels

Comments

@Remi-Gau
Copy link
Collaborator

I need to use datalad installed via conda to get some data into a container.

Installing datalad itself works but then running it to get the data requires to first activate conda environment.

The doc is not very clear on how one is supposed to do this.

Current recipe is this

  docker run --rm repronim/neurodocker:0.9.5 generate docker \
             --base-image bids/base_validator \
             --yes \
             --pkg-manager apt \
             --install git num-utils gcc g++ curl build-essential nano\
             --miniconda \
                version=latest \
                env_name=bidsonym \
                env_exists=false\
                conda_install="python=3.10 numpy nipype nibabel pandas" \
                pip_install="deepdefacer tensorflow scikit-image pydeface==2.0.2 nobrainer==0.4.0 quickshear==1.2.0 datalad datalad-osf" \
             --fsl version=6.0.6.4 method=binaries \
             --run-bash "mkdir -p /opt/nobrainer/models && cd /opt/nobrainer/models && conda activate bidsonym && datalad datalad clone https://github.com/neuronets/trained-models && cd trained-models && git-annex enableremote osf-storage && datalad get -s osf-storage ."
             --run-bash "git clone https://github.com/mih/mridefacer" \
             --env MRIDEFACER_DATA_DIR=/mridefacer/data \
             --run-bash "mkdir /home/mri-deface-detector && cd /home/mri-deface-detector && npm install sharp --unsafe-perm && npm install -g mri-deface-detector --unsafe-perm && cd ~" \
             --run-bash "git clone https://github.com/miykael/gif_your_nifti && cd gif_your_nifti && source activate bidsonym && python setup.py install" \
             --copy . /home/bm \
             --run-bash "chmod a+x /home/bm/bidsonym/fs_data/mri_deface" \
             --run-bash "source activate bidsonym && cd /home/bm && pip install -e ." \
             --env IS_DOCKER=1 \
             --workdir '/tmp/' \
             --entrypoint "/neurodocker/startup.sh  bidsonym"

The relevant command where things fail is this one:

--run-bash "mkdir -p /opt/nobrainer/models && cd /opt/nobrainer/models && conda activate bidsonym && datalad datalad clone https://github.com/neuronets/trained-models && cd trained-models && git-annex enableremote osf-storage && datalad get -s osf-storage ."

And it fails by telling me:

> [ 5/13] RUN bash -c 'mkdir -p /opt/nobrainer/models && cd /opt/nobrainer/models && conda activate bidsonym && datalad datalad clone https://github.com/neuronets/trained-models && cd trained-models && git-annex enableremote osf-storage && datalad get -s osf-storage .':                                                                                                                 
#0 2.056                                                                                                                        
#0 2.056 CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.                             
#0 2.056 To initialize your shell, run
#0 2.056 
#0 2.056     $ conda init <SHELL_NAME>
#0 2.056 
#0 2.056 Currently supported shells are:
#0 2.056   - bash
#0 2.056   - fish
#0 2.056   - tcsh
#0 2.056   - xonsh
#0 2.056   - zsh
#0 2.056   - powershell
#0 2.056 
#0 2.056 See 'conda init --help' for more information and options.
#0 2.056 
#0 2.056 IMPORTANT: You may need to close and restart your shell after running 'conda init'.
#0 2.056 
#0 2.056 
------
ERROR: failed to solve: executor failed running [/bin/sh -c bash -c 'mkdir -p /opt/nobrainer/models && cd /opt/nobrainer/models && conda activate bidsonym && datalad datalad clone https://github.com/neuronets/trained-models && cd trained-models && git-annex enableremote osf-storage && datalad get -s osf-storage .']: exit code: 1
@stebo85
Copy link
Collaborator

stebo85 commented May 23, 2023

Could you install the conda packages to the base environment instead of your bidsonym environment? Then you wouldn't need to activate it?

This should work?

   --miniconda \
         version=latest \
         conda_install='python=3.10 numpy nipype nibabel pandas' \
         pip_install='deepdefacer tensorflow scikit-image pydeface==2.0.2 nobrainer==0.4.0 quickshear==1.2.0 datalad datalad-osf' \

@Remi-Gau
Copy link
Collaborator Author

Will try

@github-actions
Copy link
Contributor

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Aug 23, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2023
@Remi-Gau Remi-Gau reopened this Sep 6, 2023
@github-actions github-actions bot removed the stale label Sep 7, 2023
Copy link
Contributor

github-actions bot commented Nov 6, 2023

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants