jcvi icon indicating copy to clipboard operation
jcvi copied to clipboard

issue with latex was not able to process the following string: b'lp'

Open yanhaidong1 opened this issue 1 year ago • 7 comments

Hey,

I tried to run the 'jcvi.compara.catalog ortholog' but failed with latex was not able to process the following string: b'lp'

Would you help to figure it out. Thanks

Best wishes, Haidong

(base) hy17471@ss-sub2 02_make_synteny_plot_062822$ python -m jcvi.compara.catalog ortholog --cpus 1 grape peach --no_strip_names [12:38:30] INFO Set text.usetex=False. Font styles may be inconsistent. base.py:404 DEBUG File peach.prj exists. Computation skipped. cbook.py:70 DEBUG lastal -u 0 -P 1 -i3G -f BlastTab peach grape.cds >./grape.peach.last base.py:1185 [12:41:24] DEBUG Assuming --qbed=grape.bed --sbed=peach.bed synteny.py:499 DEBUG Load file grape.bed base.py:33 DEBUG Load file peach.bed base.py:33 [12:41:25] DEBUG Load BLAST file grape.peach.last (total 515965 lines) blastfilter.py:47 DEBUG Load file grape.peach.last base.py:33 [12:41:28] DEBUG running the cscore filter (cscore>=0.70) .. blastfilter.py:108 [12:41:29] DEBUG after filter (379462->50584) .. blastfilter.py:111 DEBUG running the local dups filter (tandem_Nmax=10) .. blastfilter.py:116 [12:41:30] DEBUG after filter (50584->21696) .. blastfilter.py:156 DEBUG Assuming --qbed=grape.bed --sbed=peach.bed synteny.py:499 DEBUG Load file grape.bed base.py:33 DEBUG Load file peach.bed base.py:33 [12:41:31] DEBUG Load file grape.peach.last.filtered base.py:33 DEBUG A total of 21696 BLAST imported from grape.peach.last.filtered. synteny.py:387 DEBUG Chaining distance = 20 synteny.py:1931 DEBUG Load file grape.peach.anchors base.py:33 A total of 14279 (NR:14160) anchors found in 687 clusters. Stats: Min=4 Max=269 N=687 Mean=20.78 SD=35.36 Median=8.0 Sum=14279 NR stats: Min=4 Max=268 N=687 Mean=20.61 SD=35.11 Median=8.0 Sum=14160 DEBUG Load file grape.bed base.py:33 DEBUG Load file peach.bed base.py:33 [12:41:32] DEBUG Load file grape.peach.last base.py:33 [12:41:35] DEBUG A total of 379462 BLAST imported from grape.peach.last. synteny.py:387 DEBUG Load file grape.peach.anchors base.py:33 [12:41:36] DEBUG A total of 14279 anchors imported. synteny.py:412 DEBUG 31884 new pairs found (dist=10). synteny.py:2009 DEBUG Removed 6 existing anchors. synteny.py:93 DEBUG Corrected scores for 1523 anchors. synteny.py:94 DEBUG Anchors written to grape.peach.lifted.anchors. synteny.py:95 DEBUG Load file grape.peach.lifted.anchors base.py:33 A total of 46157 (NR:18271) anchors found in 687 clusters. Stats: Min=4 Max=1002 N=687 Mean=67.19 SD=110.65 Median=27.0 Sum=46157 NR stats: Min=4 Max=356 N=687 Mean=26.60 SD=43.05 Median=11.0 Sum=18271 [12:41:37] DEBUG Assuming --qbed=grape.bed --sbed=peach.bed synteny.py:499 DEBUG Load file grape.bed base.py:33 DEBUG Load file peach.bed base.py:33 [12:41:38] DEBUG Showing a random subset of 10000 data points (total 14279) for clarity. dotplot.py:229 DEBUG xsize=26346 ysize=47089 dotplot.py:338 WARNING findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans. font_manager.py:1357 [12:41:39 PM] DEBUG Dot plot title: Inter-genomic comparison: grape vs peach (14,279 gene pairs) dotplot.py:381 INFO savefig failed. Reset usetex to False. base.py:288 latex was not able to process the following string: b'lp'

yanhaidong1 avatar Jul 05 '22 16:07 yanhaidong1

@yanhaidong1

This is a common LaTeX related issue. Perhaps check: https://stackoverflow.com/questions/31214214/matplotlib-error-latex-was-not-able-to-process-the-following-string-lp

tanghaibao avatar Jul 05 '22 21:07 tanghaibao

I have the same problem, and installing latex outside of Conda like suggested in the link didn't work.

I ended up here: https://github.com/conda-forge/texlive-core-feedstock/issues/19 -- still haven't found a solution…

aersoares81 avatar Sep 19 '22 12:09 aersoares81

Small update. Now I can plot stuff, even with a bunch of WARNING findfont: Generic family 'sans-serif' not found because none of the following families were found: Helvetica font_manager.py:1418 errors.

How: removed texlive from your Conda env and ask your nice admin to do this:

sudo apt-get install -y texlive texlive-latex-extra texlive-latex-recommended dvipng cm-super msttcorefonts

Small suggestion: Leave a note about this in the installation instructions? :)

aersoares81 avatar Sep 19 '22 15:09 aersoares81

I solved this issue by using tectonic instead of texlive. Texlive is not working properly in conda envs conda install -c conda-forge tectonic

SJ-Smit avatar Jan 30 '23 11:01 SJ-Smit

Currently no solution for this issue for users using conda on MacOS.

@tanghaibao it seems like this line in jcvi.graphics.base is supposed to catch these issues and turn off latex processing but isn't for some reason. https://github.com/tanghaibao/jcvi/blob/main/jcvi/graphics/base.py#L321

I've made a few other attempts to turn off usetex either at the module level or inside the savefig function, including:

mpl.rcParams.update({"text.usetex": False})
mpl.rcParams.update(mpl.rcParamsDefault)
mpl.rcParams["text.usetex"] = False

None of these worked.

Adamtaranto avatar Feb 15 '23 06:02 Adamtaranto

@Adamtaranto

Thanks for digging into this. I have not looked at this issue recently but I also recall something weird with resetting usetex last time I checked.

tanghaibao avatar Feb 17 '23 04:02 tanghaibao

Issue seems to be solved with latest @tanghaibao's latest commit 09c8c87.

  • If latex is not installed then the usetex setting in matplotlib is turned off,
  • If latex is installed but faulty as is currently the case for the conda distribution of texlive-core see issue here: https://github.com/conda-forge/texlive-core-feedstock/issues/19, then users should set the --notex flag to force usetex to be deactivated.

Note: You will probably get a lot of missing font warnings as @aersoares81 noted, but the image should still render.

Adamtaranto avatar Feb 18 '23 02:02 Adamtaranto