`:checkhealth molten`
```
molten-nvim ~
- OK NeoVim >=0.9
- OK Python >=3.10
- OK Python module pynvim found
- OK Python module jupyter-client found
- OK Python module cairosvg found
- WARNING Optional python module pnglatex not found
- ADVICE:
- pip install pnglatex
- OK Python module plotly found
- OK Python module kaleido found
- OK Python module pyperclip found
- OK Python module nbformat found
```
`:checkhealth provider` (the python parts)
```
Python 3 provider (optional) ~
- `g:python3_host_prog` is not set. Searching for python3 in the environment.
- Executable: /usr/bin/python3
- Python version: 3.11.6
- pynvim version: 0.5.0
- OK Latest pynvim is installed.
Python virtualenv ~
- OK no $VIRTUAL_ENV
```
Description
When using the default floating windows to display outputs, images do not appear.
If I add plt.show() at the end the output simply changes for "Done". I also tried not using subplots, with and without an explicit plt.figure(), but none of those worked.
The issue is fairly similar to #92, although pyenv is not involved, so I tried the minimal config provided by @bpnordin and the issue persisted. I also tried some of the solutions proposed there (adding a new line below the sent snippet, entering the output, scrolling with <C-e> and <C-y>).
After exploring the docs a bit more, I tried some of the options in the notebook setup guide. Setting vim.g.molten_virt_text_output = true is the only way I found to display the image. Personally I'm happy with this fix, but I guess it does not address the root of the issue.
Minimal config from issue #92
```lua
-- Example for configuring Neovim to load user-installed installed Lua rocks:
package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?/init.lua;"
package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?.lua;"
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- install plugins
local plugins = {
{ "folke/tokyonight.nvim",},
{
"benlubas/molten-nvim",
version = "^1.0.0", -- use version <2.0.0 to avoid breaking changes
dependencies = { "3rd/image.nvim" },
build = ":UpdateRemotePlugins",
init = function()
-- these are examples, not defaults. Please see the readme
vim.g.molten_image_provider = "image.nvim"
vim.g.molten_output_win_max_height = 20
end,
},
{ "3rd/image.nvim",
opts = {
backend = "kitty", -- Kitty will provide the best experience, but you need a compatible terminal
integrations = {}, -- do whatever you want with image.nvim's integrations
max_width = 100, -- tweak to preference
max_height = 12, -- ^
max_height_window_percentage = math.huge, -- this is necessary for a good experience
max_width_window_percentage = math.huge,
window_overlap_clear_enabled = true,
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" },
},
version = "1.1.0", },
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"markdown",
"markdown_inline",
},
})
end,
},
}
require("lazy").setup(plugins)
vim.cmd.colorscheme("tokyonight")
```
Reproduction Steps
Running this snippet using the config above is enough to reproduce on my side. I was able to reproduce using the system Python (which is the one I use as neovim provider) as well as a virtual environment.
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1,2,3,4])
`:checkhealth molten`
``` molten-nvim ~ - OK NeoVim >=0.9 - OK Python >=3.10 - OK Python module pynvim found - OK Python module jupyter-client found - OK Python module cairosvg found - WARNING Optional python module pnglatex not found - ADVICE: - pip install pnglatex - OK Python module plotly found - OK Python module kaleido found - OK Python module pyperclip found - OK Python module nbformat found ````:checkhealth provider` (the python parts)
``` Python 3 provider (optional) ~ - `g:python3_host_prog` is not set. Searching for python3 in the environment. - Executable: /usr/bin/python3 - Python version: 3.11.6 - pynvim version: 0.5.0 - OK Latest pynvim is installed. Python virtualenv ~ - OK no $VIRTUAL_ENV ```Description
When using the default floating windows to display outputs, images do not appear.
If I add
plt.show()
at the end the output simply changes for "Done". I also tried not using subplots, with and without an explicitplt.figure()
, but none of those worked.The issue is fairly similar to #92, although pyenv is not involved, so I tried the minimal config provided by @bpnordin and the issue persisted. I also tried some of the solutions proposed there (adding a new line below the sent snippet, entering the output, scrolling with
<C-e>
and<C-y>
).After exploring the docs a bit more, I tried some of the options in the notebook setup guide. Setting
vim.g.molten_virt_text_output = true
is the only way I found to display the image. Personally I'm happy with this fix, but I guess it does not address the root of the issue.Minimal config from issue #92
```lua -- Example for configuring Neovim to load user-installed installed Lua rocks: package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?/init.lua;" package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?.lua;" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release lazypath, }) end vim.opt.rtp:prepend(lazypath) -- install plugins local plugins = { { "folke/tokyonight.nvim",}, { "benlubas/molten-nvim", version = "^1.0.0", -- use version <2.0.0 to avoid breaking changes dependencies = { "3rd/image.nvim" }, build = ":UpdateRemotePlugins", init = function() -- these are examples, not defaults. Please see the readme vim.g.molten_image_provider = "image.nvim" vim.g.molten_output_win_max_height = 20 end, }, { "3rd/image.nvim", opts = { backend = "kitty", -- Kitty will provide the best experience, but you need a compatible terminal integrations = {}, -- do whatever you want with image.nvim's integrations max_width = 100, -- tweak to preference max_height = 12, -- ^ max_height_window_percentage = math.huge, -- this is necessary for a good experience max_width_window_percentage = math.huge, window_overlap_clear_enabled = true, window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" }, }, version = "1.1.0", }, { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", config = function() require("nvim-treesitter.configs").setup({ ensure_installed = { "markdown", "markdown_inline", }, }) end, }, } require("lazy").setup(plugins) vim.cmd.colorscheme("tokyonight") ```Reproduction Steps
Running this snippet using the config above is enough to reproduce on my side. I was able to reproduce using the system Python (which is the one I use as neovim provider) as well as a virtual environment.
Pip freeze output of a simple venv I used to reproduce
``` annotated-types==0.6.0 asttokens==2.4.1 attrs==23.2.0 black==23.12.1 click==8.1.7 colorama==0.4.6 comm==0.2.1 contourpy==1.2.0 copier==9.1.0 cycler==0.12.1 debugpy==1.8.0 decorator==5.1.1 dunamai==1.19.0 executing==2.0.1 fastjsonschema==2.19.1 flake8==7.0.0 flake8-bugbear==23.12.2 fonttools==4.47.0 funcy==2.0 ipdb==0.13.13 ipykernel==6.28.0 ipython==8.19.0 isort==5.13.2 jedi==0.19.1 Jinja2==3.1.2 jinja2-ansible-filters==1.3.2 jsonschema==4.20.0 jsonschema-specifications==2023.12.1 jupyter_client==8.6.0 jupyter_core==5.7.0 jupytext==1.16.0 kiwisolver==1.4.5 markdown-it-py==3.0.0 MarkupSafe==2.1.3 matplotlib==3.8.2 matplotlib-inline==0.1.6 mccabe==0.7.0 mdit-py-plugins==0.4.0 mdurl==0.1.2 mypy-extensions==1.0.0 nbformat==5.9.2 nest-asyncio==1.5.8 numpy==1.26.3 packaging==23.2 parso==0.8.3 pathspec==0.12.1 pexpect==4.9.0 pillow==10.2.0 platformdirs==4.1.0 plumbum==1.8.2 prompt-toolkit==3.0.43 psutil==5.9.7 ptyprocess==0.7.0 pure-eval==0.2.2 pycodestyle==2.11.1 pydantic==2.5.3 pydantic_core==2.14.6 pyflakes==3.2.0 Pygments==2.17.2 pyparsing==3.1.1 PyQt5==5.15.10 PyQt5-Qt5==5.15.2 PyQt5-sip==12.13.0 python-dateutil==2.8.2 PyYAML==6.0.1 pyyaml-include==1.3.2 pyzmq==25.1.2 questionary==1.10.0 referencing==0.32.1 rpds-py==0.16.2 six==1.16.0 stack-data==0.6.3 toml==0.10.2 tornado==6.4 traitlets==5.14.1 typing_extensions==4.9.0 wcwidth==0.2.13 ```P.S.: Thanks for the plugin, it's really nice to have this workflow available directly in Neovim :)