Python trace when running nf-core modules install or nf-core subworkflows install
### Description of the bug

Installing the latest code on `dev` and running `nf-core modules install` or `nf-core subworkflows install` generates the following trace:

```
$ nf-core modules install 

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

    nf-core/tools version 2.7.dev0 - https://nf-co.re


╭───────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────╮
│ /home/harshil/software/miniconda3/envs/nf-core/bin/nf-core:8 in <module>                                                                                            │
│                                                                                                                                                                     │
│   7 │   sys.argv[0] = re.sub(r'(-script\\.pyw|\\.exe)?$', '', sys.argv[0])                                                                                            │
│ ❱ 8 │   sys.exit(run_nf_core())                                                                                                                                     │
│   9                                                                                                                                                                 │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/nf_core/__main__.py:104 in run_nf_core                                                  │
│                                                                                                                                                                     │
│    103 │   # Launch the click cli                                                                                                                                   │
│ ❱  104 │   nf_core_cli(auto_envvar_prefix="NFCORE")                                                                                                                 │
│    105                                                                                                                                                              │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/core.py:1130 in __call__                                                          │
│                                                                                                                                                                     │
│   1129 │   │   """Alias for :meth:`main`."""                                                                                                                        │
│ ❱ 1130 │   │   return self.main(*args, **kwargs)                                                                                                                    │
│   1131                                                                                                                                                              │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/rich_click/rich_group.py:21 in main                                                     │
│                                                                                                                                                                     │
│   20 │   │   try:                                                                                                                                                   │
│ ❱ 21 │   │   │   rv = super().main(*args, standalone_mode=False, **kwargs)                                                                                          │
│   22 │   │   │   if not standalone_mode:                                                                                                                            │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/core.py:1055 in main                                                              │
│                                                                                                                                                                     │
│   1054 │   │   │   │   with self.make_context(prog_name, args, **extra) as ctx:                                                                                     │
│ ❱ 1055 │   │   │   │   │   rv = self.invoke(ctx)                                                                                                                    │
│   1056 │   │   │   │   │   if not standalone_mode:                                                                                                                  │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/core.py:1657 in invoke                                                            │
│                                                                                                                                                                     │
│   1656 │   │   │   │   with sub_ctx:                                                                                                                                │
│ ❱ 1657 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                  │
│   1658                                                                                                                                                              │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/core.py:1657 in invoke                                                            │
│                                                                                                                                                                     │
│   1656 │   │   │   │   with sub_ctx:                                                                                                                                │
│ ❱ 1657 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                  │
│   1658                                                                                                                                                              │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/core.py:1404 in invoke                                                            │
│                                                                                                                                                                     │
│   1403 │   │   if self.callback is not None:                                                                                                                        │
│ ❱ 1404 │   │   │   return ctx.invoke(self.callback, **ctx.params)                                                                                                   │
│   1405                                                                                                                                                              │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/core.py:760 in invoke                                                             │
│                                                                                                                                                                     │
│    759 │   │   │   with ctx:                                                                                                                                        │
│ ❱  760 │   │   │   │   return __callback(*args, **kwargs)                                                                                                           │
│    761                                                                                                                                                              │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/decorators.py:26 in new_func                                                      │
│                                                                                                                                                                     │
│    25 │   def new_func(*args, **kwargs):  # type: ignore                                                                                                            │
│ ❱  26 │   │   return f(get_current_context(), *args, **kwargs)                                                                                                      │
│    27                                                                                                                                                               │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/nf_core/__main__.py:519 in install                                                      │
│                                                                                                                                                                     │
│    518 │   │   )                                                                                                                                                    │
│ ❱  519 │   │   exit_status = module_install.install(tool)                                                                                                           │
│    520 │   │   if not exit_status and all:                                                                                                                          │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/nf_core/components/install.py:63 in install                                             │
│                                                                                                                                                                     │
│    62 │   │   # Check and verify component name                                                                                                                     │
│ ❱  63 │   │   component = self.collect_and_verify_name(component, self.modules_repo)                                                                                │
│    64 │   │   if not component:                                                                                                                                     │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/nf_core/components/install.py:187 in collect_and_verify_name                            │
│                                                                                                                                                                     │
│   186 │   │   if component is None:                                                                                                                                 │
│ ❱ 187 │   │   │   component = questionary.autocomplete(                                                                                                             │
│   188 │   │   │   │   f"{'Tool' if self.component_type == 'modules' else 'Subworkflow'}                                                                             │
│       name:",                                                                                                                                                       │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/questionary/prompts/autocomplete.py:193 in autocomplete                                 │
│                                                                                                                                                                     │
│   192 │   │   if not choices:                                                                                                                                       │
│ ❱ 193 │   │   │   raise ValueError("No choices is given, you should use Text question.")                                                                            │
│   194 │   │   # use the default completer                                                                                                                           │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: No choices is given, you should use Text question.
```

```
$ nf-core subworkflows install                 

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

    nf-core/tools version 2.7.dev0 - https://nf-co.re


╭───────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────╮
│ /home/harshil/software/miniconda3/envs/nf-core/bin/nf-core:8 in <module>                                                                                            │
│                                                                                                                                                                     │
│   7 │   sys.argv[0] = re.sub(r'(-script\\.pyw|\\.exe)?$', '', sys.argv[0])                                                                                            │
│ ❱ 8 │   sys.exit(run_nf_core())                                                                                                                                     │
│   9                                                                                                                                                                 │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/nf_core/__main__.py:104 in run_nf_core                                                  │
│                                                                                                                                                                     │
│    103 │   # Launch the click cli                                                                                                                                   │
│ ❱  104 │   nf_core_cli(auto_envvar_prefix="NFCORE")                                                                                                                 │
│    105                                                                                                                                                              │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/core.py:1130 in __call__                                                          │
│                                                                                                                                                                     │
│   1129 │   │   """Alias for :meth:`main`."""                                                                                                                        │
│ ❱ 1130 │   │   return self.main(*args, **kwargs)                                                                                                                    │
│   1131                                                                                                                                                              │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/rich_click/rich_group.py:21 in main                                                     │
│                                                                                                                                                                     │
│   20 │   │   try:                                                                                                                                                   │
│ ❱ 21 │   │   │   rv = super().main(*args, standalone_mode=False, **kwargs)                                                                                          │
│   22 │   │   │   if not standalone_mode:                                                                                                                            │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/core.py:1055 in main                                                              │
│                                                                                                                                                                     │
│   1054 │   │   │   │   with self.make_context(prog_name, args, **extra) as ctx:                                                                                     │
│ ❱ 1055 │   │   │   │   │   rv = self.invoke(ctx)                                                                                                                    │
│   1056 │   │   │   │   │   if not standalone_mode:                                                                                                                  │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/core.py:1657 in invoke                                                            │
│                                                                                                                                                                     │
│   1656 │   │   │   │   with sub_ctx:                                                                                                                                │
│ ❱ 1657 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                  │
│   1658                                                                                                                                                              │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/core.py:1657 in invoke                                                            │
│                                                                                                                                                                     │
│   1656 │   │   │   │   with sub_ctx:                                                                                                                                │
│ ❱ 1657 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                  │
│   1658                                                                                                                                                              │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/core.py:1404 in invoke                                                            │
│                                                                                                                                                                     │
│   1403 │   │   if self.callback is not None:                                                                                                                        │
│ ❱ 1404 │   │   │   return ctx.invoke(self.callback, **ctx.params)                                                                                                   │
│   1405                                                                                                                                                              │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/core.py:760 in invoke                                                             │
│                                                                                                                                                                     │
│    759 │   │   │   with ctx:                                                                                                                                        │
│ ❱  760 │   │   │   │   return __callback(*args, **kwargs)                                                                                                           │
│    761                                                                                                                                                              │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/click/decorators.py:26 in new_func                                                      │
│                                                                                                                                                                     │
│    25 │   def new_func(*args, **kwargs):  # type: ignore                                                                                                            │
│ ❱  26 │   │   return f(get_current_context(), *args, **kwargs)                                                                                                      │
│    27                                                                                                                                                               │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/nf_core/__main__.py:1088 in install                                                     │
│                                                                                                                                                                     │
│   1087 │   │   )                                                                                                                                                    │
│ ❱ 1088 │   │   exit_status = subworkflow_install.install(subworkflow)                                                                                               │
│   1089 │   │   if not exit_status and all:                                                                                                                          │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/nf_core/components/install.py:63 in install                                             │
│                                                                                                                                                                     │
│    62 │   │   # Check and verify component name                                                                                                                     │
│ ❱  63 │   │   component = self.collect_and_verify_name(component, self.modules_repo)                                                                                │
│    64 │   │   if not component:                                                                                                                                     │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/nf_core/components/install.py:187 in collect_and_verify_name                            │
│                                                                                                                                                                     │
│   186 │   │   if component is None:                                                                                                                                 │
│ ❱ 187 │   │   │   component = questionary.autocomplete(                                                                                                             │
│   188 │   │   │   │   f"{'Tool' if self.component_type == 'modules' else 'Subworkflow'}                                                                             │
│       name:",                                                                                                                                                       │
│                                                                                                                                                                     │
│ /home/harshil/software/miniconda3/envs/nf-core/lib/python3.10/site-packages/questionary/prompts/autocomplete.py:193 in autocomplete                                 │
│                                                                                                                                                                     │
│   192 │   │   if not choices:                                                                                                                                       │
│ ❱ 193 │   │   │   raise ValueError("No choices is given, you should use Text question.")                                                                            │
│   194 │   │   # use the default completer                                                                                                                           │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: No choices is given, you should use Text question.
```

### Command used and terminal output

_No response_

### System information

_No response_
diff --git a/nf_core/components/install.py b/nf_core/components/install.py
index 3770f6ac..3acf76e2 100644
--- a/nf_core/components/install.py
+++ b/nf_core/components/install.py
@@ -186,7 +186,7 @@ class ComponentInstall(ComponentCommand):
         if component is None:
             component = questionary.autocomplete(
                 f"{'Tool' if self.component_type == 'modules' else 'Subworkflow'} name:",
-                choices=modules_repo.get_avail_components(self.component_type).sort(),
+                choices=sorted(modules_repo.get_avail_components(self.component_type)),
                 style=nf_core.utils.nfcore_question_style,
             ).unsafe_ask()
 
diff --git a/nf_core/modules/modules_json.py b/nf_core/modules/modules_json.py
index 5d4d494d..6acc231e 100644
--- a/nf_core/modules/modules_json.py
+++ b/nf_core/modules/modules_json.py
@@ -639,7 +639,8 @@ class ModulesJson:
         except KeyError:
             repo_component_entry[component_name]["installed_by"] = [installed_by]
         finally:
-            repo_component_entry[component_name]["installed_by"].extend(installed_by_log)
+            new_installed_by = repo_component_entry[component_name]["installed_by"] + installed_by_log
+            repo_component_entry[component_name]["installed_by"] = [*set(new_installed_by)]
 
         # Sort the 'modules.json' repo entries
         self.modules_json["repos"] = nf_core.utils.sort_dictionary(self.modules_json["repos"])
['nf_core/modules/modules_json.py', 'nf_core/components/install.py']