'LaTeX Error: File `type1cm.sty' not found

I need to export a figure from matplotlib without type 3 fonts on MacOS. I found that I have to set the following rc parameters:

    matplotlib.rcParams['pdf.fonttype'] = 42
    matplotlib.rcParams['ps.fonttype'] = 42

However, the legend of my plot still remains a type 3 font

Therefore I tried

    matplotlib.rcParams['ps.useafm'] = True
    matplotlib.rcParams['pdf.use14corefonts'] = True
    matplotlib.rcParams['text.usetex'] = True

Unfortunately, this produces the following error message

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

    Here is the full report generated by latex:
    This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=latex)
     restricted \write18 enabled.
    entering extended mode
    (/Users/FPJ21JY/.matplotlib/tex.cache/a35fe2eb053428dbc0f7479b65fdb72f.tex
    LaTeX2e <2020-10-01> patch level 4
    L3 programming layer <2021-02-18>
    (/usr/local/texlive/2021basic/texmf-dist/tex/latex/base/article.cls
    Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
    (/usr/local/texlive/2021basic/texmf-dist/tex/latex/base/size10.clo))
    
    ! LaTeX Error: File `type1cm.sty' not found.
    
    Type X to quit or <RETURN> to proceed,
    or enter new name. (Default extension: sty)
    
    Enter file name: 
    ! Emergency stop.
    <read *> 
             
    l.5 \usepackage
                   {type1ec}^^M
    No pages of output.
    Transcript written on a35fe2eb053428dbc0f7479b65fdb72f.log.

I installed latex via macports (as proposed in this thread) with

sudo port install texlive texlive-latex-extra

however, the problem still remains.

After the latex installation and rebooting my system I receive the following error

    RuntimeError: latex was not able to process the following string:
b'\\n\\\\begin{figure}\\n  \\\\centering\\\\leavevmode\\n  \\\\psfrag{psmarker0}[bl][bl][1][0.000000]{\\\\fontsize{8.000000}{10.000000}\\\\color[rgb]{0.150,0.150,0.150} {\\\\sffamily 20 %}}\\n\\\\psfrag{psmarker1}[bl][bl][1][0.000000]{\\\\fontsize{8.000000}{10.000000}\\\\color[rgb]{0.150,0.150,0.150} {\\\\sffamily 40 %}}\\n\\\\psfrag{psmarker2}[bl][bl][1][0.000000]{\\\\fontsize{8.000000}{10.000000}\\\\color[rgb]{0.150,0.150,0.150} {\\\\sffamily 60 %}}\\n\\\\psfrag{psmarker3}[bl][bl][1][0.000000]{\\\\fontsize{8.000000}{10.000000}\\\\color[rgb]{0.150,0.150,0.150} {\\\\sffamily 80 %}}\\n\\\\psfrag{psmarker4}[bl][bl][1][0.000000]{\\\\fontsize{8.000000}{10.000000}\\\\color[rgb]{0.150,0.150,0.150} {\\\\sffamily 100 %}}\\n\\\\psfrag{psmarker5}[bl][bl][1][0.000000]{\\\\fontsize{8.000000}{10.000000}\\\\color[rgb]{0.150,0.150,0.150} {\\\\sffamily Training Progress}}\\n\\\\psfrag{psmarker6}[bl][bl][1][0.000000]{\\\\fontsize{8.000000}{10.000000}\\\\color[rgb]{0.150,0.150,0.150} {\\\\sffamily 0 %}}\\n\\\\psfrag{psmarker7}[bl][bl][1][0.000000]{\\\\fontsize{8.000000}{10.000000}\\\\color[rgb]{0.150,0.150,0.150} {\\\\sffamily 20 %}}\\n\\\\psfrag{psmarker8}[bl][bl][1][0.000000]{\\\\fontsize{8.000000}{10.000000}\\\\color[rgb]{0.150,0.150,0.150} {\\\\sffamily 40 %}}\\n\\\\psfrag{psmarker9}[bl][bl][1][0.000000]{\\\\fontsize{8.000000}{10.000000}\\\\color[rgb]{0.150,0.150,0.150} {\\\\sffamily 60 %}}\\n\\\\psfrag{psmarker10}[bl][bl][1][90.000000]{\\\\fontsize{8.000000}{10.000000}\\\\color[rgb]{0.150,0.150,0.150} {\\\\sffamily Accuracy of the adversary network}}\\n  \\\\includegraphics*[angle=0]{/private/var/folders/dh/pdrb38k971x8m88wytxg4klw0000gq/T/tmp_0z8vuur/tmp.ps}\\n\\\\end{figure}'

Can anybody please help me?



Solution 1:[1]

You seem to be missing a latex package (type1cm). This might not have been part of the texlive or texlive-latex-extra packages that you already installed. Try to install texlive-type1cm using sudo port install texlive-type1cm which should provide the missing package.

Solution 2:[2]

Try installing both 'texlive-latex-extra' and 'cm-super'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 BanDoP
Solution 2 Mano