LaTeX error · Packages, files and fonts

LaTeX Error: File `graphix.sty' not found

Quick answer

LaTeX could not find the .sty file for a package (or the .cls file for a class). Either the name is wrong, as in \usepackage{graphix} instead of graphicx, or the package is not installed in your TeX distribution. Check the spelling on CTAN; if it is right, install it with tlmgr install <name> on TeX Live or the MiKTeX console, or put the .sty file next to your document. Online editors such as Octree come with a full TeX Live, so there a missing file almost always means a typo.

The error in the log

This is how the message appears in the .log file (and in the compile output). The line starting with l. is the line number where TeX noticed the problem; the real mistake is there or just before it.

! LaTeX Error: File `graphix.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 
! Emergency stop.

Why it happens

  • A typo in the package name: graphix for graphicx, amsmaths for amsmath, hyperrefs for hyperref.
  • A package that is not installed, typical of minimal TeX Live, BasicTeX or TinyTeX installations.
  • A custom class or style file from a journal or university template that was not copied next to the main file.
  • An old package that was renamed or removed from CTAN (for example epsfig or subfigure on some systems).

How to fix it

Correct the name. CTAN (ctan.org) lists every package; the file name is what goes in \usepackage.

If the name is right, install the package: tlmgr install graphics on TeX Live (the package that contains a file is shown by tlmgr search --global --file graphicx.sty), or let MiKTeX install it on the fly. For a template class, upload the .cls or .sty to the same folder as the document.

Broken: reproduces the error

\documentclass{article}
\usepackage{graphix}
\begin{document}
Text.
\end{document}

Try this in Octree — free LaTeX editor with AI, compiles in your browser

Fixed: compiles cleanly

\documentclass{article}
\usepackage{graphicx}
\begin{document}
Text.
\end{document}

Related errors

Frequently Asked Questions

How do I install a missing LaTeX package?

On TeX Live run tlmgr install <package> (with sudo on Linux and macOS system installs). MiKTeX installs missing packages automatically or through the MiKTeX Console. You can also download the .sty from CTAN and place it in the same folder as your .tex file.

What does "File `x.cls' not found" mean?

The document class is missing. Journal and thesis templates often ship their own .cls file: copy it next to your main file, or correct the name in \documentclass.

Why is the package missing online but not on my computer?

It may be a local file you never uploaded, such as a custom .sty in your project folder. Upload it alongside the document. Standard CTAN packages are already installed in online editors with a full TeX Live.

Paste your document into Octree — compile errors get a Fix with AI button

When a compile fails, Octree shows the error next to the line that caused it and offers a one-click fix that you can review before applying. Free, nothing to install.

Fix it in Octree →