Reputation: 599
I have just installed debian 10 as well as vscode. I have been struggling with this for 3 days now.. I installed texlive from terminal with the following command:
sudo apt install texlive
I then installed the latex workshop extension in vscode and tried building a .tex
file. The following error popped up:
Recipe terminated with fatal error: spawn latexmk ENOENT.
I then preceded to install latexmk from terminal with:
sudo apt install latexmk
The same error kept popping up after that. The output showed this.
[14:59:34] Recipe step env: {}
[14:59:34] cwd: /home/phoenix/Documents/stellies/year4/2021/s&s-414/pracs/prac-4/report
[14:59:34] LaTeX build process spawned. PID: undefined.
[14:59:35] LaTeX fatal error: spawn latexmk ENOENT, . PID: undefined.
[14:59:35] Does the executable exist? PATH: /app/bin:/usr/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/node/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/cargo/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/python/bin
[14:59:35] The environment variable $SHELL: /bin/sh
I then proceded to review the texlive website. I noticed that i did not set the path variable to include the texlive binaries. The texlive website gives the following path to the binary files : PATH=/usr/local/texlive/2021/bin/x86_64-linux:$PATH
however /usr/local/texlive
does not exist on my system for some reason. Where can i find the correct path to the texlive binaries on Debian 10?
Upvotes: 50
Views: 140063
Reputation: 341
the simplest sloution is delete all the auto-generated files except -main.tex, and preamble.tex and now rebuild it
Upvotes: 0
Reputation: 6396
I got the same issue , seems to be a misbehaving from Vscode on MacOS
-which command_you are running
example which latexmk
If this output is something that means you have your latex installed, otherwise go and install it and make sure it is accessible via the command line. If not make sure to add it into the PATH.
Upvotes: 3
Reputation: 11
Faced a similar problem, and the situation is funny:
-> latex crashes with error can't find latexmk
-> which latexmk says /usr/bin/latexmk
Error text ->
Does the executable exist? $PATH: ... :/usr/bin: ...
The secret is that I installed VSCode via Gnome Applications, which installed it via flatpak (in its own container) and therefore it doesn't care about all environment variables, all settings and so on - it has its own atmosphere.
Cured by reinstalling vscode from the official site directly without flatpak
Upvotes: 1
Reputation: 1
Using Ubuntu + VSCode + Texlive (2019, 2021 or 2023) From the command line, my tex-v is working.
I had the same problem, you can try it by stopping all VSCode programs, then check the file naming and try opening it again. (This solved a lot of the problems I had)
I made this behavior upfront, which I think is also important
sudo visudo
add
/usr/local/texlive/2023/bin/x86_64-linux
to PATH
Note the colon split.
Upvotes: 0
Reputation: 86
For those with TexLive installed on WSL2 and using Latex Workshop via VSCode Remote Development, note that the extension may mistakedly be searching for latexmk
in your Windows $PATH
instead of in the WSL path. To circumvent this, you can explicitly pass in a full path to your LaTeX command:
Latex: Tools
in your Vs Code Settings. Click Edit in settings.json
. In the first command
value, paste the full path to latexmk
, e.g."latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "/usr/local/texlive/..your-path../latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
...
]
Upvotes: 0
Reputation: 1
Similar to ychen's answer.
Since you have installed the texlive, you can check the path where the texlive is installed in texlive utility's preference, there should be an option to show you the path.
After that, you may try to "cd"
to that path and "which latexmk"
or "which pdftex"
in the terminal (I used OS X) and check if it can return something.
Then you need to add this path to the environment variable of your OS by referring to "https://gist.github.com/nex3/c395b2f8fd4b02068be37c961301caa7"
. Sometimes you need to refresh the $PATH
and make it done automatically.
Reopen the vscode and "latexkm"
the tex files just in the built-in terminal and change some settings in "latex tools"
of texshop extension.
These are what I have done to solve this problem.
Upvotes: 0
Reputation: 51
I had a similar problem. I needed to install some extra packages on Linux.
sudo apt install texlive-extra-utils
sudo apt install latexmk
sudo apt-get install -y texlive-science
And then restart VSCode.
Upvotes: 5
Reputation: 492
If you run into this error on Arch Linux: The Tex Live package has been re-organized a few days ago (June 18th, 2023) as this note shows.
This might cause some annoying behaviour because some commands that were part of previous packages might have been transferred into packages that you first need to install before you can use those commands again. Furthermore, one is not notified about this upon system update.
latexmk
is an example of this. This thread here documents that it has been transferred to the texlive-binextra package. Install it via
pacman -S texlive-binextra
and VSCODE will find latexmk
again...
Upvotes: 20
Reputation: 1
When everything seems to be set fine, but it still doesn't work well. Please remember to set the default terminal for VScode, and then reboot your computer. The fix worked well with my MacOS.
command+shift+P : setting
open user setting
add
"terminal.integrated.defaultProfile.osx": "zsh",
"terminal.integrated.defaultProfile.windows": "PowerShell"
at the end of the file, just like the picture shown below:
Upvotes: 0
Reputation: 1
The error message "Recipe terminated with fatal error: spawn latexmk ENOENT" suggests that the latexmk command cannot be found in the system path.
To resolve this issue, you can add the path to latexmk to your system environment variables:
Open the Start menu and search for "Environment Variables". Click on "Edit the system environment variables". Click on the "Environment Variables" button. Under "System Variables", scroll down and find the "Path" variable. Click on "Edit" and then "New". Enter the path to the directory where latexmk is installed (e.g. C:\Program Files\MiKTeX 2.9\miktex\bin) and click "OK". Restart Visual Studio Code and try compiling your LaTeX document again. If latexmk is not installed on your system, you can install it using a LaTeX distribution such as MiKTeX or TeX Live. Once installed, the path to latexmk should be automatically added to your system environment variables.
If the issue persists, you can try specifying the full path to latexmk in your LaTeX Workshop settings by adding the following line to your settings.json file:
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "C:/Program Files/MiKTeX 2.9/miktex/bin/latexmk.exe",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
],
"env": {}
}
]
Make sure to update the path to latexmk to match the location where it is installed on your system.
Upvotes: 0
Reputation: 31
Had a similar error and came across this post when looking for a solution.
I wanted to use texlive on Vscode with WSL2 on Windows 10. Installing texlive-full
in wsl fixed this error for me.
Upvotes: 3
Reputation: 1221
I recently encountered the same problem on MacOS Monterrey (M1 based). I used basictex
(just for the context). As required by the installation instruction,
latexmk
package to the TeX distribution.However, still got the same error as OP.
Afte reading the wiki again more carefully, what finally worked for me was as simple as restarting VS Code and MacOS. Everything works as expected after a reboot of the MAC.
Upvotes: 15
Reputation: 843
I had the same problem. The root cause was: (1) software's bin folder missing from PATH; (2) bad file privileges. Consequently, VSC couldn't access latexmk
, which explains the error messages.
In my case, the problem occurred on a mac, and specifically after I installed MacTex, which, in turn, installs Tex Live. I believe the same solution may apply to linux distros too.
Solution:
Claim file ownership (which was originally root) under folder /usr/local/texlive
: sudo chown -R <username> /usr/local/texlive
, where <username>
is the OS-level user name. The fix will work for this specific user. If it is not enough, try instead setting group owner appropriately, and/or consider Step 3.
Add /usr/local/texlive/2021/bin/<software_dialect>
to PATH. <software_dialect>
depends on the installed software version: in my case it is universal-darwin
; on linux it might be x86_64-linux
.
If the problem persists, try to change file access permissions under /usr/local/texlive
using chmod
.
EDIT: As a final step, restart VSC for changes to take effect.
Upvotes: 41
Reputation: 229
On Mac, this is a way to fix the issue
Step1: reinstall mactex by downloading it from this link: http://www.tug.org/mactex/mactex-download.html
Step2: In your terminal do cd /usr/local
, you should see texlive folder
Step3: In your terminal do sudo vim etc/paths
to set the environment. Details are in this link: https://www.architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/
Step4: In your terminal do /usr/local/texlive/2021/bin/x86_64-linux
at the bottom. check the folder to see if the year is correct. Details in: http://www.tug.org/texlive/quickinstall.html.
Step5: Quit VC code completely, and reopen it.
Upvotes: 3
Reputation: 93
I had this same problem on Mac recently, the fix that worked for me was to uninstall and reinstall the LaTeX Workshop extension.
Upvotes: 2