lua-vips icon indicating copy to clipboard operation
lua-vips copied to clipboard

vips.Image.text : no such operation

Open piface314 opened this issue 4 years ago • 6 comments

I recently installed vips-8.10.5, and tried rendering text, but I got an error:

> vips = require 'vips'
> image = vips.Image.text("Hello <i>World!</i>", {dpi = 300})
/usr/local/share/lua/5.1/vips/voperation.lua:155: no such operation
VipsOperation: class "text" not found

stack traceback:
	[C]: in function 'error'
	/usr/local/share/lua/5.1/vips/voperation.lua:155: in function 'text'
	stdin:1: in main chunk
	[C]: at 0x5649cc4771d0

(this is the example taken from README, run in luajit interactive mode)

I installed vips with just ./configure && make && sudo make install && sudo ldconfig. Did I miss something? Is there a proper way to uninstall and try again, maybe trying an older version?

piface314 avatar Jan 12 '21 11:01 piface314

Hello @piface314,

Your example works for me:

john@kiwi:~$ luajit
LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
JIT: ON SSE2 SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse
> vips = require 'vips'
> image = vips.Image.text("Hello <i>World!</i>", {dpi = 300})
> 

My guess would be that libvips failed to find the various libraries it needs to enable text rendering during configure. Check the output carefully and keep adding dependencies until you see yes in the summary table at the end. pangoft2-dev is probably the main one.

What platform are you using?

jcupitt avatar Jan 12 '21 11:01 jcupitt

I'm using Ubuntu 20.04. It's weird that I checked for pango before installing, it seems to be there:

$ apt search pangoft2
Sorting... Done
Full Text Search... Done
libpangoft2-1.0-0/focal,now 1.44.7-2ubuntu4 amd64 [installed,automatic]
  Layout and rendering of internationalized text

Is it the wrong package? Now that you said it, I really noticed that running ./configure again showed that it's missing:

...
text rendering with pangoft2: 		no

piface314 avatar Jan 12 '21 12:01 piface314

You need the -dev package to get the headers for compilation.

Ubuntu 20.04 comes with an OK libvips, I would just use that unless you have a very strong reason to make your own.

jcupitt avatar Jan 12 '21 12:01 jcupitt

Oh, I wasn't aware of that. How should I properly remove this current misconfigured installation? Is enough to just delete the binaries? At /usr/local/bin/vips and /usr/local/bin/vips-8.10.

piface314 avatar Jan 12 '21 12:01 piface314

You can do make uninstall, as long as you've not touched the libvips area since you did make install.

Otherwise, I'd do:

find /usr/local/ -name "*vips*"

And remove everything that looks vipsy.

jcupitt avatar Jan 12 '21 13:01 jcupitt

Thanks! That solved it, and now I'm using vips 8.9.1 which is in apt.

piface314 avatar Jan 12 '21 14:01 piface314

Closing, since the issue has been solved.

rolandlo avatar Mar 10 '24 06:03 rolandlo

Nice job clearing the weeds @rolandlo !

jcupitt avatar Mar 10 '24 12:03 jcupitt