3rd / image.nvim

🖼️ Bringing images to Neovim.
MIT License
811 stars 35 forks source link

issue with installing magic rock #91

Open MichaelC001 opened 7 months ago

MichaelC001 commented 7 months ago

Mac os , lua 5.4

image.nvim: magick rock not found, please install it and restart your editor luarocks install magick: To check if it is available for other Lua versions, use --check-lua-versions.

it seems that magic rock only support lua 5.1

How to solve it? Can I run neovim without magic rock?

thank you. This plugin is amazing ,its a game changer!

3rd commented 7 months ago

Hey, I'm not sure how things work on macOS, does this help you? https://github.com/3rd/image.nvim/issues/18#issuecomment-1826976752

MichaelC001 commented 7 months ago

Hey, I'm not sure how things work on macOS, does this help you? #18 (comment)

this I tried. still not working

CleanShot_2023_11_28_235610

3rd commented 7 months ago

Neovim is supposed to come with LuaJIT, and it should works in its context, your external Lua version doesn't matter. Check if nvim --version says it has LuaJIT, and preferably Neovim itslef is v0.10

Gabz-Araujo commented 7 months ago

I had the same problem, and this did the trick: brew install lua51 luarocks --lua-version=5.1 install magick

neuromaancer commented 6 months ago

I have tried this but it didn't work. Which chip you are using? M or intel? @Gabz-Araujo

spring-haru commented 6 months ago

I followed @Gabz-Araujo and it worked. But, nvim --clean -c ":luafile minimal-setup.lua" for minimal-setup.lua does NOT show the image. I use Apple M1.

benlubas commented 5 months ago

@spring-haru you will likely have to follow some instructions in the pinned issue if you're on macos

pbower commented 4 months ago

Hi there. It happens on Ubuntu 22.04. Does it relate to the 'magick' command being replaced by convert in 'imagemagick' package?

3rd commented 4 months ago

no, it's using the magick lua rock, you can check if your setup worked by running :lua require("magick") in neovim, without loading the plugin

Stianhn commented 3 months ago

I had the same problem, and this did the trick: brew install lua51 luarocks --lua-version=5.1 install magick

This no longer seems to be an option.

Error: lua@5.1 has been disabled because it is deprecated upstream!

Luckily compiling it from source is quite simple.

mesa123123 commented 3 months ago

Getting a similar error on install:

Error detected while processing VIMINIT:
image.nvim: magick rock not found, please install it and restart your editor
[LSP] Format request failed, no matching language servers.

Here's my package path extension:

-- Package Path Upgrade
----------
-- Rocks installed through luarocks.nvim
package.path = package.path .. ";" .. plugin_path .. "/luarocks.nvim/.rocks/share/lua/5.1/?.lua"
package.path = package.path .. ";" .. plugin_path .. "/luarocks.nvim/.rocks/share/lua/5.1/?/init.lua"
-- Rocks installed through local luarocks
package.path = package.path .. ";" .. fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?/init.lua"
package.path = package.path .. ";" .. fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?.lua"
-- Literally Pointing to my magick install
package.path = package.path .. ";" .. fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/magick/init.lua"
----------

Plugin just doesn't seem to be able to find magick/init.lua???

3rd commented 3 months ago

Plugin just doesn't seem to be able to find magick/init.lua???

Updated it so it shows the loading error for the rock, it might point you in the right direction.

xell commented 3 months ago

I tried this on my M2 chip Macbook and it worked, see https://github.com/3rd/image.nvim/issues/9#issuecomment-1637153929

change the magick/wand/lib.lua try_to_load as, for example:

lib = try_to_load("/opt/homebrew/lib/libMagickWand-7.Q16HDRI.dylib", function()
  -- local lname = get_flags():match("-l(MagickWand[^%s]*)")
  -- local suffix
  -- if ffi.os == "OSX" then
  --   suffix = ".dylib"
  -- elseif ffi.os == "Windows" then
  --   suffix = ".dll"
  -- else
  --   suffix = ".so"
  -- end
  -- return lname and "lib" .. lname .. suffix
end)
FunnyGhost commented 2 months ago

I also have a similar issue. However, I only get image.nvim: magick not found when I try to run the demo. I'm on MacOs, on an M2 Pro chip. I'm running Neovim: 0.9.5

Here's my image.lua file:

return {
  "3rd/image.nvim",
  dependencies = { "luarocks.nvim" },
}

and here's my rocks.lua file:

return {
  "vhyrro/luarocks.nvim",
  priority = 1000, -- Very high priority is required, luarocks.nvim should run as the first plugin in your config.
  config = true,
}

If I run magick from the terminal, it works, so the path is set correctly, I think 🤔

benlubas commented 2 months ago

If you want to use luarocks.nvim you have to tell it to install the magick rock. Image.nvim doesn't do it automatically like some other plugins do.

Take a look at the image.nvim readme for an example

FunnyGhost commented 2 months ago

If you want to use luarocks.nvim you have to tell it to install the magick rock. Image.nvim doesn't do it automatically like some other plugins do.

Take a look at the image.nvim readme for an example

Sorry, you're right. I somehow forgot to add options. Here's my updated rocks.lua file:

return {
  "vhyrro/luarocks.nvim",
  priority = 1000, -- Very high priority is required, luarocks.nvim should run as the first plugin in your config.
  opts = {
    rocks = { "magick" },
  },
}

The issue is still happening. I did restart the terminal.

benlubas commented 2 months ago

Probably need to run :Lazy build luarocks.nvim to install the rock

FunnyGhost commented 2 months ago

Probably need to run :Lazy build luarocks.nvim to install the rock

Yeah, I also thought so. Didn't help 🤔 . How can I check if the build command worked? Because when I run it, it pops-up the Lazy panel.

benlubas commented 2 months ago

Did you follow the other steps for Mac os from the readme? The installing magic part in particular? There's a note about brew installing something in a place that nvim doesn't check and how to fix it

FunnyGhost commented 2 months ago

Did you follow the other steps for Mac os from the readme? The installing magic part in particular? There's a note about brew installing something in a place that nvim doesn't check and how to fix it

Yep. I did that:

export DYLD_LIBRARY_PATH="/opt/homebrew/lib/"

and if I check with echo $DYLD_LIBRARY_PATH it shows the correct path.

benlubas commented 2 months ago

What's your exact error? You should get something more than just image.nvim: magick rock not found I think. and if you don't, make sure you're up to date with the latest version of image.nvim.

3rd commented 2 months ago

@FunnyGhost solved it like https://github.com/3rd/image.nvim/issues/91#issuecomment-2025287226

FunnyGhost commented 2 months ago

@benlubas Yes, solved with @3rd's help on Discord. Sorry for the late reply. Thanks a ton for the help 🙏

drmoc commented 2 months ago

@mesa123123 About this: image.nvim: magick rock not found, please install it and restart your editor

I listened to @Gabz-Araujo's suggestion:

luarocks --lua-version=5.1 install magick

The solution I found was the following: modify the excerpt from the file '.luarocks/share/lua/5.1/magick/wand/lib.lua':

lib = try_to_load(
"/opt/homebrew/Cellar/imagemagick/7.1.1-30/lib/libMagickWand-7.Q16HDRI.dylib",
"/opt/homebrew/Cellar/imagemagick@6/6.9.13-7/lib/libMagickWand-6.Q16.dylib",
"/opt/homebrew/bin/imagemagick/7.1.1-25/lib/libMagickWand-7.Q16HDRI.dylib"
)

In my case, in the first line:

"/opt/homebrew/Cellar/imagemagick/7.1.1-30/lib/libMagickWand-7.Q16HDRI.dylib", read 7.1.1-29.

Checking the path I realized it should be 7.1.1-30 It worked

destngx commented 1 month ago

after a while try reinstalling lua/luajit and install pkg-config using brew, mine finally works in MacAir M1