Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot show preview #1103

Closed
bmxbmx3 opened this issue Nov 22, 2019 · 15 comments
Closed

cannot show preview #1103

bmxbmx3 opened this issue Nov 22, 2019 · 15 comments
Labels
support Issues that were migrated to a Discussion.

Comments

@bmxbmx3
Copy link

bmxbmx3 commented Nov 22, 2019

Type of JetBrains IDE (IntelliJ, PyCharm, etc.) and version

intellij 2019.2.4

TeXiFy IDEA version

0.7-alpha.45

What I did (steps to reproduce)

I have followed instructions to install dependencies for showing preview,but the plugin cannot work.

Expected behavior

show preview

Actual behavior

the latex content shows below:

latex内容

when I clicked the menu tools->latex->equation preview on the equation,it showed below:

报错内容

it said cannot run program "pdflatex",but i did install it and added it to the system path,how to solve this?

(if applicable) The full stacktrace of the exception thrown


@PHPirates
Copy link
Collaborator

  • Since it says 'cannot run pdflatex', can you compile normally?
  • And can you run pdflatex from the terminal window or command prompt?
  • Do those Chinese signs in the output say anything useful? :)

There have been permission problems with the preview on Linux, but it looks like you're on Windows? So that wouldn't be it.

@PHPirates PHPirates added the more-info-needed More information is needed from the person filing the issue. label Nov 28, 2019
@bmxbmx3
Copy link
Author

bmxbmx3 commented Nov 29, 2019

after I have installed SumatraPDF and Latexforwindows,the problem has been solved,but...I have to install four softwares just for showing the preview,isn't it too much inconvenient for this plugin?hope it can use some api to solve this problem.

@PHPirates
Copy link
Collaborator

@bmxbmx3 Thanks for reporting back. Yes, it's inconvenient but there's no other easy way to solve it, as far as I know. At least with the release of Inkscape 1.0 it hopefully is one tool (pdf2svg) less to install.

@PHPirates PHPirates added support Issues that were migrated to a Discussion. and removed more-info-needed More information is needed from the person filing the issue. labels Nov 29, 2019
@mirbagheri
Copy link

mirbagheri commented Jun 10, 2020

I get the same error on MacOS.
Texify 0.6.10
Pycharm 2020.1.2

Cannot run program "pdflatex" (in directory "/var/folders/kj/x9cx1gjd4_9b196bqz6mv2xh0000gn/T/tmp719464484879368597.tmp"): error=2, No such file or directory

@PHPirates
Copy link
Collaborator

@mirbagheri How did you install Inkscape? Previously we thought that the system temp directory only didn't work when Inkscape was installed as a snap, but if you installed it in a different way and the system temp directory still doesn't work then that's a new case.

Can you check if the the following plugin version resolves the issue?
TeXiFy-IDEA-0.7-alpha.76-mirbagheri.zip

@mirbagheri
Copy link

mirbagheri commented Jun 10, 2020

@mirbagheri How did you install Inkscape? Previously we thought that the system temp directory only didn't work when Inkscape was installed as a snap, but if you installed it in a different way and the system temp directory still doesn't work then that's a new case.

Can you check if the the following plugin version resolves the issue?
TeXiFy-IDEA-0.7-alpha.76-mirbagheri.zip

I am on MacOS. I installed Inkscape 1.0 using the .dmg file.
Got the same error with the version you attached.

@PHPirates
Copy link
Collaborator

Exactly the same error? I changed it so that it tries in your home directory if it fails in the temp directory, so I would at least expect a different path there or an exception popping up if it fails to catch the first exception.

@mirbagheri
Copy link

This is the error I got with the new version:
Cannot run program "pdflatex" (in directory "/Users/xxx/tmp17736996192068843773.tmp"): error=2, No such file or directory
I have pdflatex, pdf2svg and Inkscape all on the path.

@PHPirates
Copy link
Collaborator

PHPirates commented Jun 11, 2020

Thanks, that does make more sense. It's a bit problematic because we cannot reproduce this on Linux and we don't have a Mac available, but I'm guessing it's a permission issue. Can you run pdflatex from a terminal to compile a document manually in that directory? (Or in your home folder if the temp directory doesn't exist anymore)

Instead of trying to run in all kinds of far away directories, I'm thinking maybe we can just run in the project directory, we might have less permissions issues there. I can change this and upload a new version here, if you want to try that.

@mirbagheri
Copy link

mirbagheri commented Jun 11, 2020

I am able to run pdflatex ./test.tex in both my home directory and the tmp one with no permission-related issues. Why doesn't the error mention anything about permissions if it is related to that?
I will be happy to try the project directory idea.

@PHPirates
Copy link
Collaborator

Hm, then it might not be a permission issue after all. But I have no idea what else it could be.
We were catching some exceptions in order to try again in a different directory if it failed.

The following build does not catch any exception, also does not clean up (to be able to test with the produced files, and see what it did) and runs top-level in your project:
TeXiFy-IDEA-0.7-alpha.76-mirbagheri.2.zip

@mirbagheri
Copy link

Ok with this new version I get the following error:

java.io.IOException: Cannot run program "pdflatex" (in directory "/Users/xxx/project_dir/tmp15457685598173261521.tmp"): error=2, No such file or directory
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
	at java.base/java.lang.Runtime.exec(Runtime.java:592)
	at nl.hannahsten.texifyidea.ui.PreviewFormUpdater.runCommand(PreviewFormUpdater.kt:176)
	at nl.hannahsten.texifyidea.ui.PreviewFormUpdater.access$runCommand(PreviewFormUpdater.kt:18)
	at nl.hannahsten.texifyidea.ui.PreviewFormUpdater$compilePreview$1.invoke(PreviewFormUpdater.kt:75)
	at nl.hannahsten.texifyidea.ui.PreviewFormUpdater$compilePreview$2.invokeSuspend(PreviewFormUpdater.kt:107)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.io.IOException: error=2, No such file or directory
	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
	... 12 more

I checked the directory "/Users/xxx/project_dir/tmp15457685598173261521.tmp" exists and contains the right tex file.

@PHPirates
Copy link
Collaborator

I assume your path does not contain any spaces or other strange characters (currently we do not quote the path, but I think we should fix that anyway).

Do you perhaps also need to specify the path to pdflatex in every run configuration? If so, then I think this is the same issue, that on Mac we cannot run the program 'pdflatex' for some reason.
Then it would be the same issue as #25, and you could try this workaround: #25 (comment)
I can try to find a way such that you can specify the compiler path/path to your LaTeX distribution globally, but this may take a bit more time to do properly.

@mirbagheri
Copy link

Thanks @PHPirates! the open -a pycharm workaround solved the problem for me.
I also tried to test the third solutions mentioned here. However found out with the pycharm being installed through Jetbrain toolbox the absolute path to the IntelliJ IDEA application package is not "/Applications/IntelliJ IDEA 15.app" anymore.
Do you know what would be the equivalent path I should use?

@PHPirates
Copy link
Collaborator

Thanks, I'm glad the workaround works for you until we fixed it properly.
In the toolbox app in settings I think under Tools you can see where it installs the applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Issues that were migrated to a Discussion.
Projects
None yet
Development

No branches or pull requests

3 participants