nf-core / hlatyping

Precision HLA typing from next-generation sequencing data
https://nf-co.re/hlatyping
MIT License
63 stars 30 forks source link

No executable found for solver 'cbc' #161

Closed DarkoCucin closed 6 months ago

DarkoCucin commented 8 months ago

Description of the bug

Hi all,

When I tried to run nf-core/hlatyping I encountered an issue. An issue is related to the integer programming solver which is used in the optytipe module. On the official page glpk and cbc are described as solvers that can be used. But when I tried to use cbc solver the same issue popped up in different use cases. I will attach information about the simplest use case which is running the test profile option.

Thanks a lot for your help!

Command used and terminal output

nextflow run main.nf --outdir 'test_profile' -profile test,docker --solver 'cbc'

Pipeline completed with errors-
ERROR ~ Error executing process > 'NFCORE_HLATYPING:HLATYPING:OPTITYPE (SAMPLE_PAIRED_END_BAM_T1)'

Caused by:
  Process `NFCORE_HLATYPING:HLATYPING:OPTITYPE (SAMPLE_PAIRED_END_BAM_T1)` terminated with an error exit status (1)

Command executed:

  # Create a config for OptiType on a per sample basis with task.ext.args2

  #Doing it old school now
  echo "[mapping]" > config.ini
  echo "razers3=razers3" >> config.ini
  echo "threads=2" >> config.ini
  echo "[ilp]" >> config.ini
  echo "solver=cbc" >> config.ini
  echo "threads=1" >> config.ini
  echo "[behavior]" >> config.ini
  echo "deletebam=true" >> config.ini
  echo "unpaired_weight=0" >> config.ini
  echo "use_discordant=false" >> config.ini

  # Run the actual OptiType typing with args
  OptiTypePipeline.py -i SAMPLE_PAIRED_END_BAM_T1_1.mapped.bam SAMPLE_PAIRED_END_BAM_T1_2.mapped.bam -c config.ini --dna  --prefix SAMPLE_PAIRED_END_BAM_T1 --outdir SAMPLE_PAIRED_END_BAM_T1

  #Couldn't find a nicer way of doing this
  cat <<-END_VERSIONS > versions.yml
  "NFCORE_HLATYPING:HLATYPING:OPTITYPE":
      optitype: $(cat $(which OptiTypePipeline.py) | grep -e "Version:" | sed -e "s/Version: //g")
  END_VERSIONS

Command exit status:
  1

Command output:
  WARNING: Initializing ordered Set R with a fundamentally unordered data source
      (type: set).  This WILL potentially lead to nondeterministic behavior in
      Pyomo
  WARNING: Could not locate the 'cbc' executable, which is required for solver
      cbc
  WARNING: Solver does not support multi-threading. Please change the config file accordingly. Falling back to single-threading.
  WARNING: Could not locate the 'cbc' executable, which is required for solver
      cbc

Command error:
  WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
  WARNING: Initializing ordered Set R with a fundamentally unordered data source
      (type: set).  This WILL potentially lead to nondeterministic behavior in
      Pyomo
  WARNING: Could not locate the 'cbc' executable, which is required for solver
      cbc
  WARNING: Solver does not support multi-threading. Please change the config file accordingly. Falling back to single-threading.
  WARNING: Could not locate the 'cbc' executable, which is required for solver
      cbc
  Traceback (most recent call last):
    File "/usr/local/bin/model.py", line 149, in solve
      res = self.__solver.solve(self.__instance, options=self.__opts, tee=self.__verbosity)
    File "/usr/local/lib/python3.8/site-packages/pyomo/opt/base/solvers.py", line 516, in solve
      self.available(exception_flag=True)
    File "/usr/local/lib/python3.8/site-packages/pyomo/opt/solver/shellcmd.py", line 118, in available
      raise ApplicationError(msg % self.name)
  pyutilib.common._exceptions.ApplicationError: No executable found for solver 'cbc'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/local/bin/OptiTypePipeline.py", line 416, in <module>
      result = op.solve(args.enumerate)
    File "/usr/local/bin/model.py", line 153, in solve
      res = self.__solver.solve(self.__instance, options={}, tee=self.__verbosity)
    File "/usr/local/lib/python3.8/site-packages/pyomo/opt/base/solvers.py", line 516, in solve
      self.available(exception_flag=True)
    File "/usr/local/lib/python3.8/site-packages/pyomo/opt/solver/shellcmd.py", line 118, in available
      raise ApplicationError(msg % self.name)
  pyutilib.common._exceptions.ApplicationError: No executable found for solver 'cbc'

Work dir:
  /Users/darkocucin/Desktop/nfcore-public/hlatyping-2.0.0_local_2/work/f2/27a5f6fe29441307e30529a02b1e20

Tip: you can replicate the issue by changing to the process work dir and entering the command `bash .command.run`

 -- Check '.nextflow.log' file for details

Relevant files

.nextflow.log

System information

christopher-mohr commented 8 months ago

Hi @DarkoCucin, Thanks a lot for reporting. The documentation seems to be definietly wrong on this. I see this as enhancement that makes a lot of sense. I already set up a mulled-container including OptiType and coincbc and will update the module once this is availalbe.

DarkoCucin commented 8 months ago

Thank you a lot for the answer. Does it mean that cbc option will be available in the next pipeline release?

christopher-mohr commented 8 months ago

Thank you a lot for the answer. Does it mean that cbc option will be available in the next pipeline release?

Yes, at the moment I don't see any issues with that. I will work on the update of the OptiType module next.

christopher-mohr commented 8 months ago

Hi @DarkoCucin, Just to give you a quick update. The updated OptiType module has been merged (https://github.com/nf-core/modules/pull/5015). Next I will update the pipeline accordingly. Probably also have to do a template update first.

DarkoCucin commented 8 months ago

Hi @christopher-mohr, thank you for a quick response. When you update the pipeline I will test this parameter.