iqbal-lab/Mykrobe-predictor

Error with install on linux / python 3.6

Closed this issue · 2 comments

doing pip install with pip3 and python 3.6 returns the following after test-running:
mykrobe genotype --tmp ./tmp/ --keep_tmp --skeleton_dir ./s/ -1 /sample1_R* --mccortex31_path /tools/git.repositories/Mykrobe-predictor/mccortex/bin/mccortex31 sample1 /panel.fasta

DEBUG:mykatlas.cortex.mccortex:Setting path to mccortex exacutable
DEBUG:mykatlas.cortex.mccortex:Suggested path to mccortex exacutable is valid: /tools/git.repositories/Mykrobe-predictor/mccortex/bin/mccortex31
DEBUG:mykatlas.cortex.mccortex:Running coverages command:
/tools/git.repositories/Mykrobe-predictor/mccortex/bin/mccortex31 geno -t 1 -m 1GB -k 21 -o ./tmp/sample1-21_CC398_standard_PhiSa3_Av_czrC.covgs -I ./s/panel_21.ctx -s sample-21 -1 sample1_R1.fastq.gz -1 sample1_R2.fastq.gz -c panel.fasta ./tmp/sample1-21_panel.ctx
Traceback (most recent call last):
  File "/tools/linuxbrew/bin/mykrobe", line 11, in <module>
    sys.exit(main())
  File "/tools/linuxbrew/opt/python3/lib/python3.6/site-packages/mykrobe/mykrobe_predictor.py", line 125, in main
    args.func(parser, args)
  File "/tools/linuxbrew/opt/python3/lib/python3.6/site-packages/mykrobe/mykrobe_predictor.py", line 34, in run_subtool
    run(parser, args)
  File "/tools/linuxbrew/opt/python3/lib/python3.6/site-packages/mykatlas/cmds/genotype.py", line 75, in run
    print(json.dumps(run_main(parser, args), indent=1))
  File "/tools/linuxbrew/opt/python3/lib/python3.6/site-packages/mykatlas/cmds/genotype.py", line 40, in run_main
    cp.run()
  File "/tools/linuxbrew/opt/python3/lib/python3.6/site-packages/mykatlas/typing/typer/genotyper.py", line 73, in run
    self._run_cortex()
  File "/tools/linuxbrew/opt/python3/lib/python3.6/site-packages/mykatlas/typing/typer/genotyper.py", line 90, in _run_cortex
    self.mc_cortex_runner.run()
  File "/tools/linuxbrew/opt/python3/lib/python3.6/site-packages/mykatlas/cortex/mccortex.py", line 179, in run
    self._run_cortex()
  File "/tools/linuxbrew/opt/python3/lib/python3.6/site-packages/mykatlas/cortex/mccortex.py", line 196, in _run_cortex
    self._run_coverage_if_required()
  File "/tools/linuxbrew/opt/python3/lib/python3.6/site-packages/mykatlas/cortex/mccortex.py", line 254, in _run_coverage_if_required
    self._execute_command(self.coverages_cmd)
  File "/tools/linuxbrew/opt/python3/lib/python3.6/site-packages/mykatlas/cortex/mccortex.py", line 232, in _execute_command
    sys.stdout.write(nextline)
TypeError: write() argument must be str, not bytes

The issue can be fixed a substitution on line 230-233 in the [...]/lib/python3.6/site-packages/mykatlas/cortex/mccortex.py file from :

if nextline == '' and process.poll() is not None:
    break
sys.stdout.write(nextline)
sys.stdout.flush()

to

if nextline == b'' and process.poll() is not None:
    break
sys.stdout.write(nextline.decode('utf-8'))
sys.stdout.flush()

cc @rffrancon @Phelimb