Closed tim-hilde closed 3 years ago
That's annoying, sorry about that! I don't know for sure what is causing this, but here are a few thoughts:
pandoc
and latex
by themselves, does it say command not found? What is the output of which pandoc
and which latex
?If they both work:
.bashrc
/.zshrc
and you're opening Obsidian outside of a terminal that makes sense.I'll probably have this fixed within a week or so.
Thanks for testing this! I'm glad this was found before it was submitted to the community plugins list
Thank you for your fast replay!
Yes I'm on the most recent version.
latex returns:
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=latex)
restricted \write18 enabled.
Weirdly, pandoc doesn't do anything, but I can manually convert documents via terminal 🤷🏼♂️
btw, I'm on a MacBook Air M1. I don't know if that info is helpful 😅
Okay, I'll try using a different method of testing if the command exists then (note to self: this looks decent). I might also add a setting where you can enter the path to the Pandoc binary (which you can get via which pandoc
in a terminal). This setting would override any other checks whether the command exists, so it should always work.
@tim-hilde I've just spoken to @kg6sxy
on Discord who had the exact same issue, and for them it was a PATH variable problem.
Their solution was to add the line launchctl setenv PATH $PATH
to the end of their ~/.zshenv
file (depending on your terminal setup you could have a ~/.bashrc
or ~/.zshrc
file instead). This makes the modified PATH variable accessible to apps launched in Finder or via Spotlight.
I think what is happening is the PATH variable is changed inside your ~/.zshenv
file to add the Pandoc folder so the terminal knows where the pandoc
executable is, but when you run Obsidian outside of a terminal the ~/.zshenv
file isn't loaded, so my plugin can't find Pandoc.
Let me know if this fixes it, and I'll close this issue and add a "Troubleshooting" section to the documentation which should make it easier for the next person who runs into this issue.
Thanks for reaching out to me, but I'm a little bit lost right now. Where do I find the .zshenv file? And do I have to only add launchctl setenv PATH $PATH
and not change "PATH" or "$PATH"?
Also, do you know why I need to do this? I've used the pandoc installer so I didn't change anything 🤷🏼♂️
Where do I find the .zshenv file?
In your home directory /Users/username
there should be a file called .zshenv
/.bash_profile
(or failing that .zshrc
/.bashrc
- depends whether your terminal is zsh (default) or bash). These will be hidden files, as they have a dot at the start. To see them, you will need to run ls -a
(show all files) in the home directory in the terminal. To edit them, you might need to use Nano in the terminal - eg nano ~/.zshenv
.
And do I have to only add
launchctl setenv PATH $PATH
and not change "PATH" or "$PATH"?
I think so, yes (this worked for someone else on Discord).
Also, do you know why I need to do this? I've used the pandoc installer so I didn't change anything 🤷🏼♂️
When you installed Pandoc, a binary file called pandoc
was saved somewhere on your computer, but it might be in a totally random folder. When you run a command in the terminal like ls
, you're executing a binary file called ls
somewhere on your system. If you've ever searched your entire computer for files, you'll notice it takes a while. Instead of the terminal searching your whole computer for an executable called pandoc
when you run pandoc
in the terminal, we have the PATH variable. The PATH variable is just a list of folders to look for applications in, and when you installed Pandoc presumably the PATH had to be updated, as Pandoc might be in a different folder to other applications.
To edit the PATH, you can use a command like export PATH=$PATH:/another/folder
, and people often do this in a .zshrc
file or similar. However, this only changes the PATH temporarily - if you run that command in a terminal only that terminal is affected and only until it's closed. The issue with changing the PATH in the .zshrc
file is that it's only run when you open a terminal so the computer knows where to look for Pandoc in a terminal, but not in Obsidian (because Obsidian doesn't run the .zshrc
file and thus has the old PATH). (Aside: I suspect if you start Obsidian in a terminal it will work. If the executable is just called obsidian
you can just type that, but it might have a more complicated name.)
I think what has happened is the Pandoc installer has changed the PATH in a weird spot like the .zshrc
file, and it only works in terminals. The launchctl
command will set the Finder/Spotlight PATH to the terminal PATH, and given you can access Pandoc in the terminal this should make it accessible in Obsidian/my plugin. It's a lot of work, in an ideal world it would be plug and play, but there's not much I can do about this on my end if it's a PATH variable issue.
So, to summarise, you could try:
~/.zshenv
file (where ~
is your home directory /Users/someone
)nano ~/.zshenv
(if it doesn't exist you could create it, or edit the ~/.zshrc
instead if that exists)launchctl setenv PATH $PATH
command as the last line (you can do arrow key navigation, but you might need to paste via the context menu instead of Cmd+V)I realise this is a lot of work, so if you can't get it to work I'm planning to add a feature where you can specify exactly where Pandoc is to the plugin. Then all you need to do is run which pandoc
in a terminal to get the file path to Pandoc, and then you will be able to paste that into the plugin settings. This is probably a week or more away though, and it's good to know how PATH variable nonsense works, you run into it all the time on Mac/Linux. But, it will be an option if nothing else works.
Hey Oliver, thank you for your extensive feedback! I really appreciate it!
Unfortunately, I wasn't able to finde the ~/.zshenv
file (or ~/.zshrc
). Therefore I've created it, added the line, but nothing has changed...
Hmm, that's annoying. What I'll do instead then is the second approach of just letting you specify where Pandoc is located in the plugin settings. This way, all you need to do is run which pandoc
and copy the output into the settings. I'll keep you posted on when this fix is ready.
@tim-hilde it should be fixed (only tested on Linux though). Now there's a new setting at the bottom of the settings tab where you should enter the output from which pandoc
when you type that in a terminal. For me, that looks like:
If you have any issues, just let me know 😃
This works just fine. Thank you!
Unfortunately, the Latex path is still not recognized...
Excellent!
Yes, the LaTeX still won't work which is unfortunate - forgot that wasn't working too lol. For now you'll be able to export to LaTeX code and then run pdflatex something.tex
in the terminal to get a PDF. I'll fix LaTeX PATH issue in the next few days which should make the workflow a little less tedious 😛
I've just fixed the second part of this issue, please let me know if it works as I can't easily test the code on my computer
Hey guys, Using on linux and getting Pandoc export failed:
Hi. I'm trying Obsidian on macOS 12.4 on a MacBook Pro M1. I quickly installed Pandoc Plugin, as I use pandoc for several other markdown editors and love its conversion abilities. But the plugin can't localize pandoc, even after putting the "which pandoc" terminal command result in the plugin settings, which is /opt/homebrew/bin/pandoc for me (maybe the problem is there ?). I really need it, in order to make obsidian my defaut notes manager
After some research, it appears that this location of pandoc is provide by panwriter, which I installed for testing. I remove panwriter, which force the dependancies with pandoc, remove pandoc and reinstall from the GitHub package; that works, pandoc is totally recognize by pandoc plugin now. That means the Pandoc path settings doesn't work good, at least on macOS…
I had the same issue, however, using which pandoc and which pdflatex returned with nothing (doesn't exist/couldn't find). For anyone else who comes along that same issue, I had to manually install both pandoc and basictex via homebrew in the terminal. Once i did this, the which commands worked, and i could then use those paths to solve the plugin path issue.
For reference, I am using a macOS M1 system and my obsidian vault is stored in icloud (don't know if this is relevant).
Error message that Pandoc/LaTeX is not installed or accessible on my PATH despite being installed.