modules icon indicating copy to clipboard operation
modules copied to clipboard

nf-core install could not detect work dir

Open an-altosian opened this issue 1 year ago • 0 comments

Have you checked the docs?

Description of the bug

I want to add the module trimgalore into my workflow. However, the command nf-core modules install trimgalore --dir $PWD returned me error saying PermissionError: [Errno 13] Permission denied: '/.nf-core.yml'. It seems like it could not solve the workding directory and tried to modify the root directory /.

PS: Removing --dir $PWD did not solve the problem.

Command used and terminal output

$echo $PWD
/weka/dhe/projects/discovery_seq_analysis

$ nf-core modules install trimgalore --dir $PWD

                                          ,--./,-.
          ___     __   __   __   ___     /,-._.--~\
    |\ | |__  __ /  ` /  \ |__) |__         }  {
    | \| |       \__, \__/ |  \ |___     \`-._,-`-,
                                          `._,._,'

    nf-core/tools version 2.14.1 - https://nf-co.re


WARNING  'repository_type' not defined in .nf-core.yml                                                                                                                                                                                                                
? Is this repository an nf-core pipeline or a fork of nf-core/modules? Pipeline
INFO     To avoid this prompt in the future, add the 'repository_type' key to your .nf-core.yml file.                                                                                                                                                                 
? Would you like me to add this config now? [y/n] (y): 
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /usr/conda/envs/nf-core/bin/nf-core:10 in <module>                                               │
│                                                                                                  │
│    7                                                                                             │
│    8 if __name__ == '__main__':                                                                  │
│    9 │   sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])                       │
│ ❱ 10 │   sys.exit(run_nf_core())                                                                 │
│   11                                                                                             │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/nf_core/__main__.py:150 in run_nf_core      │
│                                                                                                  │
│    147 │   │   │   log.debug(f"Could not check latest version: {e}")                             │
│    148 │   │   stderr.print("\n")                                                                │
│    149 │   # Launch the click cli                                                                │
│ ❱  150 │   nf_core_cli(auto_envvar_prefix="NFCORE")                                              │
│    151                                                                                           │
│    152                                                                                           │
│    153 @tui()                                                                                    │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/rich_click/rich_command.py:367 in __call__  │
│                                                                                                  │
│   364 │   │   # Include this here because I run into a false warning                             │
│   365 │   │   # in the PyCharm IDE otherwise; for some reason PyCharm doesn't                    │
│   366 │   │   # seem to think RichGroups are callable. (No issues with Mypy, though.)            │
│ ❱ 367 │   │   return super().__call__(*args, **kwargs)                                           │
│   368                                                                                            │
│   369                                                                                            │
│   370 class RichCommandCollection(CommandCollection, RichGroup):                                 │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/click/core.py:1157 in __call__              │
│                                                                                                  │
│   1154 │                                                                                         │
│   1155 │   def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Any:                           │
│   1156 │   │   """Alias for :meth:`main`."""                                                     │
│ ❱ 1157 │   │   return self.main(*args, **kwargs)                                                 │
│   1158                                                                                           │
│   1159                                                                                           │
│   1160 class Command(BaseCommand):                                                               │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/rich_click/rich_command.py:152 in main      │
│                                                                                                  │
│   149 │   │   try:                                                                               │
│   150 │   │   │   try:                                                                           │
│   151 │   │   │   │   with self.make_context(prog_name, args, **extra) as ctx:                   │
│ ❱ 152 │   │   │   │   │   rv = self.invoke(ctx)                                                  │
│   153 │   │   │   │   │   if not standalone_mode:                                                │
│   154 │   │   │   │   │   │   return rv                                                          │
│   155 │   │   │   │   │   # it's not safe to `ctx.exit(rv)` here!                                │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/click/core.py:1688 in invoke                │
│                                                                                                  │
│   1685 │   │   │   │   super().invoke(ctx)                                                       │
│   1686 │   │   │   │   sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)                    │
│   1687 │   │   │   │   with sub_ctx:                                                             │
│ ❱ 1688 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))               │
│   1689 │   │                                                                                     │
│   1690 │   │   # In chain mode we create the contexts step by step, but after the                │
│   1691 │   │   # base command has been invoked.  Because at that point we do not                 │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/click/core.py:1688 in invoke                │
│                                                                                                  │
│   1685 │   │   │   │   super().invoke(ctx)                                                       │
│   1686 │   │   │   │   sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)                    │
│   1687 │   │   │   │   with sub_ctx:                                                             │
│ ❱ 1688 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))               │
│   1689 │   │                                                                                     │
│   1690 │   │   # In chain mode we create the contexts step by step, but after the                │
│   1691 │   │   # base command has been invoked.  Because at that point we do not                 │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/click/core.py:1434 in invoke                │
│                                                                                                  │
│   1431 │   │   │   echo(style(message, fg="red"), err=True)                                      │
│   1432 │   │                                                                                     │
│   1433 │   │   if self.callback is not None:                                                     │
│ ❱ 1434 │   │   │   return ctx.invoke(self.callback, **ctx.params)                                │
│   1435 │                                                                                         │
│   1436 │   def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]:  │
│   1437 │   │   """Return a list of completions for the incomplete value. Looks                   │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/click/core.py:783 in invoke                 │
│                                                                                                  │
│    780 │   │                                                                                     │
│    781 │   │   with augment_usage_errors(__self):                                                │
│    782 │   │   │   with ctx:                                                                     │
│ ❱  783 │   │   │   │   return __callback(*args, **kwargs)                                        │
│    784 │                                                                                         │
│    785 │   def forward(                                                                          │
│    786 │   │   __self, __cmd: "Command", *args: t.Any, **kwargs: t.Any  # noqa: B902             │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/click/decorators.py:33 in new_func          │
│                                                                                                  │
│    30 │   """                                                                                    │
│    31 │                                                                                          │
│    32 │   def new_func(*args: "P.args", **kwargs: "P.kwargs") -> "R":                            │
│ ❱  33 │   │   return f(get_current_context(), *args, **kwargs)                                   │
│    34 │                                                                                          │
│    35 │   return update_wrapper(new_func, f)                                                     │
│    36                                                                                            │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/nf_core/__main__.py:839 in modules_install  │
│                                                                                                  │
│    836 │   from nf_core.modules import ModuleInstall                                             │
│    837 │                                                                                         │
│    838 │   try:                                                                                  │
│ ❱  839 │   │   module_install = ModuleInstall(                                                   │
│    840 │   │   │   dir,                                                                          │
│    841 │   │   │   force,                                                                        │
│    842 │   │   │   prompt,                                                                       │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/nf_core/modules/install.py:16 in __init__   │
│                                                                                                  │
│   13 │   │   no_pull=False,                                                                      │
│   14 │   │   installed_by=False,                                                                 │
│   15 │   ):                                                                                      │
│ ❱ 16 │   │   super().__init__(                                                                   │
│   17 │   │   │   pipeline_dir,                                                                   │
│   18 │   │   │   "modules",                                                                      │
│   19 │   │   │   force=force,                                                                    │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/nf_core/components/install.py:35 in         │
│ __init__                                                                                         │
│                                                                                                  │
│    32 │   │   no_pull=False,                                                                     │
│    33 │   │   installed_by=False,                                                                │
│    34 │   ):                                                                                     │
│ ❱  35 │   │   super().__init__(component_type, pipeline_dir, remote_url, branch, no_pull)        │
│    36 │   │   self.force = force                                                                 │
│    37 │   │   self.prompt = prompt                                                               │
│    38 │   │   self.sha = sha                                                                     │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/nf_core/components/components_command.py:40 │
│ in __init__                                                                                      │
│                                                                                                  │
│    37 │   │   self.modules_repo = ModulesRepo(remote_url, branch, no_pull, hide_progress)        │
│    38 │   │   self.hide_progress = hide_progress                                                 │
│    39 │   │   self.no_prompts = no_prompts                                                       │
│ ❱  40 │   │   self._configure_repo_and_paths()                                                   │
│    41 │                                                                                          │
│    42 │   def _configure_repo_and_paths(self, nf_dir_req: bool = True) -> None:                  │
│    43 │   │   """                                                                                │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/nf_core/components/components_command.py:53 │
│ in _configure_repo_and_paths                                                                     │
│                                                                                                  │
│    50 │   │                                                                                      │
│    51 │   │   try:                                                                               │
│    52 │   │   │   if self.dir:                                                                   │
│ ❱  53 │   │   │   │   self.dir, self.repo_type, self.org = get_repo_info(self.dir, use_prompt=   │
│    54 │   │   │   else:                                                                          │
│    55 │   │   │   │   self.repo_type = None                                                      │
│    56 │   │   │   │   self.org = ""                                                              │
│                                                                                                  │
│ /usr/conda/envs/nf-core/lib/python3.12/site-packages/nf_core/components/components_utils.py:47   │
│ in get_repo_info                                                                                 │
│                                                                                                  │
│    44 │   │   # Save the choice in the config file                                               │
│    45 │   │   log.info(f"To avoid this prompt in the future, add the 'repository_type' key to    │
│    46 │   │   if rich.prompt.Confirm.ask("[bold][blue]?[/] Would you like me to add this confi   │
│ ❱  47 │   │   │   with open(config_fn, "a+") as fh:                                              │
│    48 │   │   │   │   fh.write(f"repository_type: {repo_type}\n")                                │
│    49 │   │   │   │   log.info(f"Config added to '{config_fn.name}'")                            │
│    50                                                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
PermissionError: [Errno 13] Permission denied: '/.nf-core.yml'

Relevant files

N/A

System information

nf-core, version 2.14.1

nextflow version 24.04.4.5917

Hardware: An AWS instance

executor: local

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy

an-altosian avatar Sep 29 '24 18:09 an-altosian