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

LLPStartPreview doesn't start #12

Closed
linuscl opened this issue Nov 24, 2015 · 35 comments
Closed

LLPStartPreview doesn't start #12

linuscl opened this issue Nov 24, 2015 · 35 comments
Labels

Comments

@linuscl
Copy link

linuscl commented Nov 24, 2015

Error in "function <SNR>34_Compile":
Line   10:

That's the error I received, and evince (pdf viewer) says that it cannot find the pdf file.

@paynito
Copy link

paynito commented Feb 10, 2016

starting $vim main.tex after enabling your plugin in .vimrc.
Error detected while processing function <SNR>28_Initialize: line 10: E887: Sorry, this command is disabled, the Python's site module could not be loaded.

@xuhdev
Copy link
Owner

xuhdev commented Feb 10, 2016

@paynito This is because your Vim installation does not have Python feature enabled (or the python feature is broken). Please try to reinstall Vim. You can search for E887 online, the solution is the same, regardless of the plugin.

@thebabush
Copy link

I just want to add that I have VIM compiled with python3 and it seems that I have to :%s/python/python3/g on my xenial machine.

@luchaoo7
Copy link

luchaoo7 commented Jun 3, 2017

Hello does anyone know why when I type :LLPStartPreview in VIM it says "Not an editor command"

@xuhdev
Copy link
Owner

xuhdev commented Jun 3, 2017

@luchaoo7 You probably didn't have the plugin loaded. You can check by running :script.

@luchaoo7
Copy link

luchaoo7 commented Jun 4, 2017

@xuhdev thanks for your reply, It is loaded
54: ~/.vim/bundle/vim-latex-suite/plugin/remoteOpen.vim
55: ~/.vim/bundle/vim-latex-live-preview/plugin/latexlivepreview.vim

The only tag I see in ~/.vim/bundle/vim-latex-live-preview/doc/tag is "vim-latex-live-preview.txt"

In the "latexlivepreview.vim" file on line command! 184 is the following:
command! LLPStartPreview call s:StartPreview()

I can't seem to spot why its not working.

@xuhdev
Copy link
Owner

xuhdev commented Jun 4, 2017

As long as it's loaded, it should be available. Tags are just indices for quick lookup. Perhaps you wanna check your typing of the command?

@jestin
Copy link

jestin commented Jun 8, 2017

I'm seeing the same thing. script says that it is loaded:

~/.config/vim/plugged/vim-latex-live-preview/plugin/latexlivepreview.vim

but vim's command autocomplete doesn't pick it up, and I get Not an editor command: LLPStartPreview.

As you can see, I installed this using the vim-plug plugin manager, but I hope that isn't the issue.

UPDATE: I see that the script looks specifically for 'python' support, and not 'python' and 'python3'. That's why I was never seeing the commands available. Any chance of adding python3 support?

@kunlilin2991
Copy link

I have encounter the same problem
I use vundle to manage plugin
in vimrc
Plugin 'xuhdev/vim-latex-live-preview'
the info in vim :script is as following
77: ~/.vim/bundle/vim-latex-live-preview/plugin/latexlivepreview.vim
however when i type LLPStartPreview
this problem appeared as following
E492: not an editor command :LLPStartPreview
this pluginin seems not work.

@badouralix
Copy link
Collaborator

badouralix commented Jul 18, 2017

@kunlilin2991 thanks for the feedback !
vundle doesn't seem to be the issue (a section to the readme should be added about that actually)

Could you provide some info about your system and your vim ? Also, what does :echo g:loaded_vim_live_preview output ?

badouralix added a commit that referenced this issue Jul 19, 2017
This commit follows users' usecases in #12
@badouralix badouralix added the bug label Jul 19, 2017
@ghost
Copy link

ghost commented Jul 21, 2017

Having the same problem here. VIM 8.0 installed on macOS Sierra through Homebrew, relevant features: +python3 -python.
Plugin installed through vundle. Configured the previewer and the updatetime as per the instructions.
Doing :echo g:loaded_vim_live_preview returns 1.

Going through ~/.vim/bundle/vim-latex-live-preview/plugin/latexlivepreview.vim and replacing all "python" calls with "python3" and reloading, everything works perfect.

Looks like the if(!has('python')[...] block should be extended to test for both +python and +python3 features. Also, the python command should be dynamically set as either 'python' or 'python3', depending on the existing feature.

@ranguli
Copy link
Contributor

ranguli commented Jul 24, 2017

Also having the same issue as @vicentius, @kunlilin2991, @luchaoo7 and @jestin. :script is saying the plugin is in fact being loaded, but :LLPStartPreview with or without a filename returns the E492: Not an editor command: LLPStartPreview.

I'm running Xubuntu 16.04, with Vim 7.4 compiled with support for +python and +python3

@badouralix
Copy link
Collaborator

badouralix commented Jul 24, 2017

Thanks @vicentius for the python3 checking! Then this should be easy to fix. Otherwise, maybe we can look for a way to get rid of python and only use vim internal functions...

@ranguli @kunlilin2991 : digging into E492, I found this post VundleVim/Vundle.vim#486 (comment). Could you check whether our issue is somehow related to this one? If so, it can be fixed using a .gitattributes file.

@ranguli
Copy link
Contributor

ranguli commented Jul 24, 2017

@badouralix Thanks for this. Lots of interesting points brought up in that thread, personally (and for future reference) the later output of :version for me returns:

   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"  

Where $VIM is seemingly undefined. Furthermore, there's no vimrc actually present in /~.vim/vimrc. What this has to do with our issue, maybe nothing, but something to keep in mind in case we hit a dead end. It shouldn't be confusing my ~/.vimrc with the ~/.vim/vimrc if the latter doesn't really exist.

I tried running the git config --global core.autocrlf input as recommended in the plugin directory and it didn't change anything.

For someone reading this in the future, VundleVim/Vundle.vim#492
may also be your problem as well, just not in our case specifically.

I also tried this suggestion in VundleVim/Vundle.vim#486
set rtp+=$HOME/.vim/bundleVundle.vim
Where $HOME used to be ~, also with no luck.

There's a chance it would work if I followed the suggestion from the above thread, of re-installing Vundle, but for end users it will likely be more appealing if they don't have to do so. In which case moving away from Python and towards Vim script, or the python3 checking that @vicentius mentioned sounds like the best options.

@ranguli
Copy link
Contributor

ranguli commented Jul 24, 2017

Regarding @vicentius's suggestion of changing the instances of python to python3, I couldn't get it to work for me personally, but the following happened.

if (!has('python') . . .) will throw the error E492: Not an editor command: LLPStartPreview

However, if(!has('python3') . . .) will throw Failed to compile

@ghost
Copy link

ghost commented Jul 24, 2017

Failed to compile is a big step ahead. That means the external python calls worked, but the selected tex engine failed to compile your document. You now have something else to debug / investigate :)

@ranguli
Copy link
Contributor

ranguli commented Jul 24, 2017

Nice. All that was required to resolve Failed to compile was just supplying a proper LaTeX document, of course! The fix has worked for @vicentius and I, but I couldn't speak to whether or not this would add any regressions. I can make a pull request of my changes and we can go from there with any kind of adjustments it may need.

And for future reference, the issue of vim picking up a second .vimrc file seemed to be an unrelated thing, as did the effect of the git command (both documented above).

@badouralix
Copy link
Collaborator

Cool! Cool cool cool! So for now, let's get a fix to support both +python and +python3, and we'll see later for maybe avoiding using python. @vicentius please go ahead 😃

And also, we absolutely need to get some decent debug info, because the current way of investigation is crazy hard...

@ranguli
Copy link
Contributor

ranguli commented Jul 25, 2017

It sounds like supporting both +python and +python3 will remove support for Debian-based systems, according to this StackOverflow thread, that I found here.

I can attest to compiling Vim with support for both python versions and having neither work. It looks like we will need to pick just the one version (or switch to pure Vim script if that's even possible).

@ranguli
Copy link
Contributor

ranguli commented Jul 25, 2017

@badouralix: And also, we absolutely need to get some decent debug info, because the current way of investigation is crazy hard...

Is this the same as #34? I agree, I think in trying to accomplish this we may need a better understanding of what's actually happening. I might try and try improve documentation too, as I haven't taken a good solid look at the script and could personally benefit from better docs.

badouralix pushed a commit that referenced this issue Jul 25, 2017
* Update README.md

Added more commonly known Issues, referencing Issue #12 and #24

* Fixed mistakes in Known Issues section.
@badouralix
Copy link
Collaborator

It sounds like supporting both +python and +python3 will remove support for Debian-based systems, according to this StackOverflow thread, that I found here.

As far as I understand, as long as one gets a working vim with python features enable, a vimscript can dynamically dispatch calls to python. For instance plug.vim#1341


Another issue: as you were talking about debian-based systems, I took a look at the features embedded in the latest vim package in debian. It comes with -python and -python3... 😢

Btw, to test multi-platforms, I go with docker. But we can also set up vader tests to run on travis.

@ranguli
Copy link
Contributor

ranguli commented Jul 26, 2017

As far as I understand, as long as one gets a working vim with python features enable, a vimscript can dynamically dispatch calls to python. For instance plug.vim#1341

Okay, nice! So the check to see if python is installed here needs to be expanded for both versions, then the reference to python throughout the rest of the code needs to also be changed dynamically, as in my case it only works as python3

Another issue: as you were talking about debian-based systems, I took a look at the features embedded in the latest vim package in debian. It comes with -python and -python3... 😢

Ouch, so it sounds like we can just accept the fact that users will need to compile Vim with Python support, which isn't that bad seen as how other plugins require this step too.

Setting up tests to run on Travis will be super nice. I'll add Vader and a Testing section to the README. If the dockerfiles have anything of interest feel free to track them, just to keep things uniform.

@kunlilin2991
Copy link

Sorry to reply so late, I use ubuntu 16.04 with vim 8.0 and enable both python and python3, also, there is only one .vimrc file in my computer. what information can I offer about vim and plugin to solve the bug?

@ranguli
Copy link
Contributor

ranguli commented Jul 26, 2017

@kunlilin2991 Pasting the output of :version and :script should be everything we'd need!

@kunlilin2991
Copy link

kunlilin2991 commented Jul 31, 2017

the :script is list as following
77: ~/.vim/bundle/vim-latex-live-preview/plugin/latexlivepreview.vim

and the version about python and vimrc file is list as following:
+python/dyn +python3/dyn
I also have two vimrc files as following
system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/usr/local/share/vim"
for the 2nd file, it does not exit.

I have checked python version list as following:
Python 2.7.12
python3 version:
'Python 3.5.2'

@masroorrasheed
Copy link

I edited my all "python" instances to "python3" in ~/.vim/bundle/vim-latex-live-preview/plugin/latexlivepreview.vim. The preview worked.

@xuhdev
Copy link
Owner

xuhdev commented Sep 22, 2017

I think we need to allow for customizing python version in this case...

@xuhdev
Copy link
Owner

xuhdev commented Sep 22, 2017

@badouralix This fix actually might cause some issues. The reason is that, as long as either python or python3 is initialized, the other one cannot. Therefore, if some other plugins relies on python, but we initialize python3, we will break them. Same thing happens in the other way around.

@badouralix
Copy link
Collaborator

I couldn't make things break. In all my tests, I was able to use both python and python3, whenever vim-llp was loaded or not.
The reason I believe this fix works is that this py_exe trick is actually used in plug.vim#L1341, and such an issue would have been reported long time ago with this plugin. Nonetheless, just to be sure, we can switch test for python before test for python3.

@D0048
Copy link

D0048 commented Oct 8, 2017

Encountering the same here. Could anyone help?
Doing :echo g:loaded_vim_live_preview returns 1.

Edit:

Changing python version is not working.

The command :LLPStartPreview does appear after commenting the following code:

"if exists("g:loaded_vim_live_preview")
"    finish
"endif

And it works. However, any error message will not appear. Opening a new issue reporting it.

badouralix added a commit that referenced this issue Sep 15, 2018
@bmikaili
Copy link

Why is this closed? I still get this.

@ylatex
Copy link

ylatex commented Apr 21, 2019

Hi, guys
today i install this plugin in my mac, but it can not work, which always prompt "fail to compile". could you help me to solve this issue?

@Nillerh
Copy link

Nillerh commented Apr 21, 2019

Hi, guys
today i install this plugin in my mac, but it can not work, which always prompt "fail to compile". could you help me to solve this issue?

Probably just a latex syntax error. Try compile a latex example.

@mtoohey31
Copy link

Sorry to comment on an old closed issue like this, but I thought I should leave what I found somewhere on this repo. For me, I was also experiencing this error, but in my case, the solution to the problem was to uninstall the mactex-no-gui cask and install the normal mactex cask instead.

@DaveAlsina
Copy link

I'm using Manjaro and the reason why it wasn't working for me was because I forgot to install latex compiler, hope you are not in the same situation haha check: https://archlinux.org/groups/x86_64/texlive-most/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests