I couldn't find a way to make LyX find refstyle. How to reproduce: 1 - Install the texlive and lyx packages 2 - Load the bug.lyx file (or any other file that makes it add \usepackage{refstyle} to the generated TeX file). 3 - Press Ctrl+R to compile the file. 4 - You will get an error saying that refstyle.sty could not be found. You can however use LyX to produce a .tex file, and the run pdflatex from the terminal and it will work. Since it loaded inputenc, the package just before refstyle, from /gnu/store/wy5865kh09qak63rpq3v47wnxv2gj1y0-texlive-union-49435/share/texmf-dist/tex/latex/base/inputenc.sty, and /gnu/store/wy5865kh09qak63rpq3v47wnxv2gj1y0-texlive-union-49435/ does not contain refstyle, I think that the problem is that LyX uses the pdflatex from this textlive-union instead of the one from the full texlive. LyX has a reconfigure option (Tools -> Reconfigure) but it does not seem to help.