Giter Site home page Giter Site logo

Comments (39)

exploitJ avatar exploitJ commented on June 18, 2024 9

I've installed pkg-config via homebrew and now it works.

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024 6

Edit: using this solution might break when homebrew updates/moves things around. For a more permanent fix, see solutions at the bottom of the thread

So the exact command that someone else might run to fix it might vary. But this is the one that I used:

sudo ln -sv /opt/homebrew/Cellar/imagemagick/7.1.1-15_1/lib/libMagickWand-7.Q16HDRI.dylib /usr/local/lib/libMagickWand-7.Q16HDRI.dylib

You just need to link the libMagick dylib file that your neovim is looking for to a spot nvim can find it.
The way that I found this file was by going into the magick rock and adding some print statements.

I hope that helps someone in the future.

from image.nvim.

ad-chaos avatar ad-chaos commented on June 18, 2024 5

adding export DYLD_LIBRARY_PATH=/opt/homebrew/lib/ to .zshrc also solves the problem

from image.nvim.

ray-x avatar ray-x commented on June 18, 2024 3

For anyone using fish/zsh+kitty under MacOS

eval "$(luarocks path --bin)"   # you can also add LUA_PATH based on your own setup
set -gx DYLD_LIBRARY_PATH /opt/homebrew/lib  # you should see libMagickxxxx lib files in this folder

from image.nvim.

spicyzboss avatar spicyzboss commented on June 18, 2024 3

set DYLD_LIBRARY_PATH to "(brew --prefix)/lib" that solved the issue for me

from image.nvim.

neuromaancer avatar neuromaancer commented on June 18, 2024 2

I tried literally everything above, but it still doesn't work.

from image.nvim.

neuromaancer avatar neuromaancer commented on June 18, 2024 1

Yeah, actually, it didn't load the magick, but I tried to symlink the lib mentioned by @benlubas

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024

I have this working on PopOS. So must be a missing dependency on the Mac side.

from image.nvim.

3rd avatar 3rd commented on June 18, 2024

I think it's ok, the files should only be in ~/.luarocks/share/lua/5.1/magick.
I'm not sure what's happening on mac, can you try to load the magick rock in Lua outside of Neovim?

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024

This works when I just run it with luajit:

package.path = package.path .. ";" .. "/Users/benlubas/.luarocks/share/lua/5.1/?/init.lua"
package.path = package.path .. ";" .. "/Users/benlubas/.luarocks/share/lua/5.1/?.lua"

local ok, err = pcall(require, "magick")

if ok then
  print("that worked")
else
  print("that failed")
end

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024

after looking at this more, the real error is .luarocks/share/lua/5.1/magick/wand/lib.lua:220: Failed to load ImageMagick (MagickWand)

Which is still only happening in NeoVim. I don't get that when I run the thing with luajit

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024

Problem is definitely something do with homebrew installing it somewhere unexpected.

from image.nvim.

jmbuhr avatar jmbuhr commented on June 18, 2024

Hi @benlubas, since you mentioned having this working on pop-os, which I'm also running, may I ask if there where any major steps to make it work?
I can't see to get this to work. The individual pieces should be in place. The kitty image kitten displays images, the imagemagick luarock is found and image.nvim successfully uses it to create a cropped version of the image in the /tmp folder, from which it can indeed be displayed manually outside of nvim with the image kitten, but image.nvim doesn't show anything.

PS: I'm excited about what you are doing with molten-nvim! Looks like it will complement quarto-nvim immensly! Asking if you can show code results and plots directly under the cells is probably the question I get the most.

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024

It sounds like you have the dependencies all setup, so I wouldn't worry about that.

what does your config look like, and what file are you opening to try to see an image?

@jmbuhr

PS: You can send those people to Molten starting in a day or two. I just finished up a PR that makes the last set of breaking changes that I wanted to make, going to merge it after a day or two of driving it to make sure I didn't break the whole thing :P

from image.nvim.

jmbuhr avatar jmbuhr commented on June 18, 2024

I tried it as part of my quarto-nvim-kickstarter config and with the minimal setup: https://github.com/3rd/image.nvim?tab=readme-ov-file#try-it-out-with-a-minimal-setup

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024

Did you add the quarto file type to the file type list for the markdown integration if you're opening a quarto document. Because that's not a supported file type out of the box with the minimal config.

from image.nvim.

3rd avatar 3rd commented on June 18, 2024

Should we enable it by default?

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024

Eh, I'm more in favor of just letting people know they can enable it so it's clear that they can add any filetype that uses the markdown parser, not just the ones that we list.

But I that's not a strong opinion

from image.nvim.

jmbuhr avatar jmbuhr commented on June 18, 2024

I did, but the minimal example is plain markdown anyways.

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024

I guess one other quick thing to check, sometimes I have to make an edit to the file to get an image to show up in markdown. Like pressing o<esc> above the image, just to move the image link down a line.

from image.nvim.

jmbuhr avatar jmbuhr commented on June 18, 2024

sorry to hijack this thread, btw.

starting kitty from the terminal itself shows the following errors when opening the minimal example:

$ kitty --config /dev/null 
[282 18:12:19.795825] [PARSE ERROR] Malformed GraphicsCommand control block, invalid key character: 0x55
[282 18:12:19.795837] [PARSE ERROR] Unsupported screen mode:  2026 (private)
...

image

The same png displays fine with kitty +kitten icat, as shown in the terminal below.

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024

what kitty version are you on? 0x55 is U which is the command for unicode placeholder which was introduced in version 28 I think

from image.nvim.

jmbuhr avatar jmbuhr commented on June 18, 2024

0.21.2

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024

Update, latest is 30.x lol

from image.nvim.

jmbuhr avatar jmbuhr commented on June 18, 2024

That works indeed! I had assumed that you were also on the latest version from the pop-os apt repo, which is 0.21.

from image.nvim.

jmbuhr avatar jmbuhr commented on June 18, 2024

Thanks! :) Exciting times for terminal data science!

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024

Great! Glad that worked. I put up a PR to add this requirement to the readme as I wasn't aware of it either

from image.nvim.

jmbuhr avatar jmbuhr commented on June 18, 2024

Uh, it also works in Wezterm out of that box, since that supports the kitty graphics protocoll!

from image.nvim.

benlubas avatar benlubas commented on June 18, 2024

I'll refer you to this comment.

#23 (comment)

As much as I want to use wezterm, I had a much worse experience with it. That said, I haven't tried it in a while, so maybe it works better now?

from image.nvim.

phcerdan avatar phcerdan commented on June 18, 2024

I had imagemagick installed in a non default location ($HOME/.local). I solved this adding

export PKG_CONFIG_PATH="$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH"

I found this error because I see a lua error when opening vim in a corner, bad formatted, saying that couldn't find ImageMagick.pc.
I wonder if image.nvim could capture these lua errors and show them properly in :messages. Or in a :checkhealth.

from image.nvim.

MichaelC001 avatar MichaelC001 commented on June 18, 2024

after looking at this more, the real error is .luarocks/share/lua/5.1/magick/wand/lib.lua:220: Failed to load ImageMagick (MagickWand)

I tried run lib.lua. get these error messages

image

from image.nvim.

3rd avatar 3rd commented on June 18, 2024

@neuromaancer what's your Neovim version?
do you have a working Neovim + luarocks setup?

from image.nvim.

neuromaancer avatar neuromaancer commented on June 18, 2024

Mine is the stable version of nvim (0.9.4) and the lastest version of luarocks (3.9.2), but I used luarocks --local --lua-version 5.1 install magick to install magick.

from image.nvim.

3rd avatar 3rd commented on June 18, 2024

version should be ok, other people seem to have it working on mac #91 (comment)
can your nvim load any luarock? maybe there's something weird going on with package.path

from image.nvim.

isvicy avatar isvicy commented on June 18, 2024

I've installed pkg-config via homebrew and now it works.

this works for me.

from image.nvim.

eo1989 avatar eo1989 commented on June 18, 2024

Has anyone managed to get image.nvim to run with linuxbrew via wsl2? Tried the export DYLD_LIBRARY_PATH without success. Have magick installed via luarocks and homebrew (imagemagick), via luarocks I went ahead and installed the same version into the local and system scope (tried to cover all the bases in case I missed something). Plugin still shows ascii/gibberish when neo-tree previews a png, or molten/quarto try to run a visual. nvim nightly, kitty 0.32.0, ubuntu 20.04.3 LTS Jammy.

from image.nvim.

3rd avatar 3rd commented on June 18, 2024

@eo1989 does this help? #93 (reply in thread)

from image.nvim.

eo1989 avatar eo1989 commented on June 18, 2024

No unfortunately it makes no difference.

from image.nvim.

liyiyuian avatar liyiyuian commented on June 18, 2024

set DYLD_LIBRARY_PATH to "(brew --prefix)/lib" that solved the issue for me

This one works for me. Just for people who might have the same setup to mine.

  • MacOS 14.2.1 (M3 Max)
  • NVIM v0.9.5
  • [email protected] (installed with brew)
  • luarocks (installed with brew)
  • magick is installed with `luarocks --local --lua-version=5.1 install magick

Actually, I have tried everything above, and still not able to get the image. But after trying everything, Neovim is able to load the magick.

from image.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.