libvips / libvips

A fast image processing library with low memory needs.
https://libvips.github.io/libvips/
GNU Lesser General Public License v2.1
9.66k stars 669 forks source link

Difficulties setting up vips8 binding for python #237

Closed drmaquino closed 9 years ago

drmaquino commented 9 years ago

Hi,

I'm trying to use vips8 binding for python. I followed the steps to install/build vips and i tested it works through terminal using c++ version. however, when i try to set up the python version, I get stuck at this point:

"The libvips typelib, Vips-8.0.typelib, needs to be on your GI_TYPELIB_PATH. It is typically installed somewhere like /usr/local/lib/girepository-1.0"

I can't find that file anywhere. I grep'd and cat'd the whole directory but i couldn't find it. Is it possible that the file might be named after something different? Has this happened to anyone? Any recommendations?

Thanks in advance!

DrMaquino

jcupitt commented 9 years ago

Hi, it should be in $prefix/lib/girepository-1.0. If it's not there, it either hasn't built or your package hasn't installed it.

How did you build vips? If you built yourself, did configure find gobject-introspection?

drmaquino commented 9 years ago

Hi,

This is all I did:

1° git clone git://github.com/jcupitt/libvips.git 2° brew install gtk-doc swig 3°./bootstrap.sh 4° CFLAGS="-g -Wall" CXXFLAGS="-g -Wall" \ ./configure --prefix=/home/john/vips 5° make 6° make install

Mariano

On Thu, Feb 12, 2015 at 1:26 PM, John Cupitt notifications@github.com wrote:

Hi, it should be in $prefix/lib/girepository-1.0. If it's not there, it either hasn't built or your package hasn't installed it.

How did you build vips? If you built yourself, did configure find gobject-introspection?

— Reply to this email directly or view it on GitHub https://github.com/jcupitt/libvips/issues/237#issuecomment-74155998.

jcupitt commented 9 years ago

I don't think that will work. You need to change the --prefix at least, it has to be a valid path on your system. And you'll find you need to install a lot of other packages. Check the output of ./configure, you'll see it reports a lot of stuff is missing.

I would do brew install vips, it will pull in everything you need for you, and set it all up.

The Build on OS X page has some more examples:

http://www.vips.ecs.soton.ac.uk/index.php?title=Build_on_OS_X

drmaquino commented 9 years ago

thanks again for your response, john. I'm sorry, I haven't mentioned that i'm using ubuntu 14.04. I tried linux brew, but i wasn't quite successful yet. By any chance do you hapen to have some instructions for linux users..? thanks in advance!

Mariano

On Fri, Feb 13, 2015 at 12:56 AM, John Cupitt notifications@github.com wrote:

I don't think that will work. You need to change the --prefix at least, it has to be a valid path on your system. And you'll find you need to install a lot of other packages. Check the output of ./configure, you'll see it reports a lot of stuff is missing.

I would do brew install vips, it will pull in everything you need for you, and set it all up.

The Build on OS X page has some more examples:

http://www.vips.ecs.soton.ac.uk/index.php?title=Build_on_OS_X

— Reply to this email directly or view it on GitHub https://github.com/jcupitt/libvips/issues/237#issuecomment-74223100.

jcupitt commented 9 years ago

Ah! OK, then run configure again and check the output. You will probably find you need to add quite a few more packages. When I run configure here I see this at the end:

* build options
native win32:               no
native OS X:                no
open files in binary mode:      no
enable debug:               no
build deprecated components:        yes
build docs with gtkdoc:         no
gobject introspection:          yes
build vips7 Python binding:     yes
install vips8 Python overrides:     yes
  (requires pygobject-3.12.0 or later)

* optional dependencies
use fftw3 for FFT:          yes
Magick package:             MagickWand
file import with libMagick:         yes
accelerate loops with orc:      yes
  (requires orc-0.4.11 or later)
ICC profile support with lcms:      yes (lcms2)
file import with OpenEXR:       yes
file import with OpenSlide:     yes
  (requires openslide-3.3.0 or later)
file import with matio:         yes
file import with cfitsio:       yes
file import/export with libwebp:    yes
text rendering with pangoft2:       yes
file import/export with libpng:     yes (pkg-config libpng >= 1.2.9)
  (requires libpng-1.2.9 or later)
file import/export with libtiff:    yes (pkg-config libtiff-4)
file import/export with libjpeg:    yes
image pyramid export:           yes
  (requires libgsf-1 1.14.27 or later)
use libexif to load/save JPEG metadata: yes

The README has some instructions on building from source.

drmaquino commented 9 years ago

john,

Reviewing, I need to install a version for web develpment. I'm using a new computer with a fresh new ubuntu 14.04.

This are the steps that I followed:

I got this info:

I found those two differences (in bold).

Could you tell how to continue from here?

I'm sorry that I'm asking so much, but I'm quite new to linux, and I'm finding the instructions in the documentation rather difficult to follow.. =(

my actual need is to use the python bindings (or ruby's if I'm not successful in getting the first one).

thanks in advance again!

Mariano

On Wed, Feb 18, 2015 at 1:17 AM, John Cupitt notifications@github.com wrote:

Ah! OK, then run configure again and check the output. You will probably find you need to add quite a few more packages. When I run configure here I see this at the end:

  • build options native win32: no native OS X: no open files in binary mode: no enable debug: no build deprecated components: yes build docs with gtkdoc: no gobject introspection: yes build vips7 Python binding: yes install vips8 Python overrides: yes (requires pygobject-3.12.0 or later)
  • optional dependencies use fftw3 for FFT: yes Magick package: MagickWand file import with libMagick: yes accelerate loops with orc: yes (requires orc-0.4.11 or later) ICC profile support with lcms: yes (lcms2) file import with OpenEXR: yes file import with OpenSlide: yes (requires openslide-3.3.0 or later) file import with matio: yes file import with cfitsio: yes file import/export with libwebp: yes text rendering with pangoft2: yes file import/export with libpng: yes (pkg-config libpng >= 1.2.9) (requires libpng-1.2.9 or later) file import/export with libtiff: yes (pkg-config libtiff-4) file import/export with libjpeg: yes image pyramid export: yes (requires libgsf-1 1.14.27 or later) use libexif to load/save JPEG metadata: yes

The README has some instructions on building from source.

— Reply to this email directly or view it on GitHub https://github.com/jcupitt/libvips/issues/237#issuecomment-74834129.

jcupitt commented 9 years ago

You need to install gobject-introspection and pygobject. Try

sudo apt-get install gobject-introspection

sudo apt-get install python-gobject

If you need to be able to create deepzoom pyramids you need libgsf as well.

Unfortunately I don't know if the pygobject in 14.04 is modern enough, you might need to build that from source as well. The problem is that vips8 is still very new and the packages have not caught up yet. In a six months or so it'll all be updated and much simpler.

Ruby vips has been out for quite a few years and is very stable and well supported. Just do:

gem install ruby-vips

And it'll do everything for you. It's the older vips7 interface which is not as nice and is missing some features, but it works fine, is well-documented, and has a large test suite (which it passes, I hope). On Thu, 19 Feb 2015 at 21:22, drmaquino notifications@github.com wrote:

john,

Reviewing, I need to install a version for web develpment. I'm using a new computer with a fresh new ubuntu 14.04.

This are the steps that I followed:

  • clone libvips project
  • sudo apt-get install all dependencies
  • run ./bootstrap.sh
  • run ./configure

I got this info:

  • build options native win32: no native OS X: no open files in binary mode: no enable debug: no build deprecated components: yes build docs with gtkdoc: no gobject introspection: no build vips7 Python binding: yes install vips8 Python overrides: no (requires pygobject-3.12.0 or later)
  • optional dependencies use fftw3 for FFT: yes Magick package: MagickWand file import with libMagick: yes accelerate loops with orc: yes (requires orc-0.4.11 or later) ICC profile support with lcms: yes (lcms2) file import with OpenEXR: yes file import with OpenSlide: yes (requires openslide-3.3.0 or later) file import with matio: yes file import with cfitsio: yes file import/export with libwebp: yes text rendering with pangoft2: yes file import/export with libpng: yes (pkg-config libpng >= 1.2.9) (requires libpng-1.2.9 or later) file import/export with libtiff: yes (pkg-config libtiff-4) file import/export with libjpeg: yes image pyramid export: no
  • (requires libgsf-1 1.14.27 or later)* use libexif to load/save JPEG metadata: yes

I found those two differences (in bold).

Could you tell how to continue from here?

I'm sorry that I'm asking so much, but I'm quite new to linux, and I'm finding the instructions in the documentation rather difficult to follow.. =(

my actual need is to use the python bindings (or ruby's if I'm not successful in getting the first one).

thanks in advance again!

Mariano

On Wed, Feb 18, 2015 at 1:17 AM, John Cupitt notifications@github.com wrote:

Ah! OK, then run configure again and check the output. You will probably find you need to add quite a few more packages. When I run configure here I see this at the end:

  • build options native win32: no native OS X: no open files in binary mode: no enable debug: no build deprecated components: yes build docs with gtkdoc: no gobject introspection: yes build vips7 Python binding: yes install vips8 Python overrides: yes (requires pygobject-3.12.0 or later)
  • optional dependencies use fftw3 for FFT: yes Magick package: MagickWand file import with libMagick: yes accelerate loops with orc: yes (requires orc-0.4.11 or later) ICC profile support with lcms: yes (lcms2) file import with OpenEXR: yes file import with OpenSlide: yes (requires openslide-3.3.0 or later) file import with matio: yes file import with cfitsio: yes file import/export with libwebp: yes text rendering with pangoft2: yes file import/export with libpng: yes (pkg-config libpng >= 1.2.9) (requires libpng-1.2.9 or later) file import/export with libtiff: yes (pkg-config libtiff-4) file import/export with libjpeg: yes image pyramid export: yes (requires libgsf-1 1.14.27 or later) use libexif to load/save JPEG metadata: yes

The README has some instructions on building from source.

— Reply to this email directly or view it on GitHub https://github.com/jcupitt/libvips/issues/237#issuecomment-74834129.

— Reply to this email directly or view it on GitHub https://github.com/jcupitt/libvips/issues/237#issuecomment-75138842.

drmaquino commented 9 years ago

john, thank you for your time I have made some progress now, and got to this point of the configure, where i think vips is actually working fine, and all the dependencies are ok:

also, now "vips-8.0.typelib" is in "/usr/local/lib/girepository-1.0" and I copied Vips.py to gi/overrides folder

at the end of the .bashrc file I added:

export VIPSHOME=/usr/local export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VIPSHOME/lib export PATH=$PATH:$VIPSHOME/bin export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$VIPSHOME/lib/pkgconfig export MANPATH=$MANPATH:$VIPSHOME/man export PYTHONPATH=$VIPSHOME/lib/python3.4/site-packages export GI_TYPELIB_PATH=$VIPSHOME/lib/girepository-1.0

now, the error is:

Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information.

from gi.repository import vips Traceback (most recent call last): File "", line 2135, in _find_spec AttributeError: 'DynamicImporter' object has no attribute 'find_spec'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.4/site-packages/gi/importer.py", line 53, in find_module 'introspection typelib not found' % namespace) ImportError: cannot import name vips, introspection typelib not found

Any clues...?

Thanks

Mariano

On Fri, Feb 20, 2015 at 2:07 AM, John Cupitt notifications@github.com wrote:

You need to install gobject-introspection and pygobject. Try

sudo apt-get install gobject-introspection

sudo apt-get install python-gobject

If you need to be able to create deepzoom pyramids you need libgsf as well.

Unfortunately I don't know if the pygobject in 14.04 is modern enough, you might need to build that from source as well. The problem is that vips8 is still very new and the packages have not caught up yet. In a six months or so it'll all be updated and much simpler.

Ruby vips has been out for quite a few years and is very stable and well supported. Just do:

gem install ruby-vips

And it'll do everything for you. It's the older vips7 interface which is not as nice and is missing some features, but it works fine, is well-documented, and has a large test suite (which it passes, I hope). On Thu, 19 Feb 2015 at 21:22, drmaquino notifications@github.com wrote:

john,

Reviewing, I need to install a version for web develpment. I'm using a new computer with a fresh new ubuntu 14.04.

This are the steps that I followed:

  • clone libvips project
  • sudo apt-get install all dependencies
  • run ./bootstrap.sh
  • run ./configure

I got this info:

  • build options native win32: no native OS X: no open files in binary mode: no enable debug: no build deprecated components: yes build docs with gtkdoc: no gobject introspection: no build vips7 Python binding: yes install vips8 Python overrides: no (requires pygobject-3.12.0 or later)
  • optional dependencies use fftw3 for FFT: yes Magick package: MagickWand file import with libMagick: yes accelerate loops with orc: yes (requires orc-0.4.11 or later) ICC profile support with lcms: yes (lcms2) file import with OpenEXR: yes file import with OpenSlide: yes (requires openslide-3.3.0 or later) file import with matio: yes file import with cfitsio: yes file import/export with libwebp: yes text rendering with pangoft2: yes file import/export with libpng: yes (pkg-config libpng >= 1.2.9) (requires libpng-1.2.9 or later) file import/export with libtiff: yes (pkg-config libtiff-4) file import/export with libjpeg: yes image pyramid export: no
  • (requires libgsf-1 1.14.27 or later)*

use libexif to load/save JPEG metadata: yes

I found those two differences (in bold).

Could you tell how to continue from here?

I'm sorry that I'm asking so much, but I'm quite new to linux, and I'm finding the instructions in the documentation rather difficult to follow.. =(

my actual need is to use the python bindings (or ruby's if I'm not successful in getting the first one).

thanks in advance again!

Mariano

On Wed, Feb 18, 2015 at 1:17 AM, John Cupitt notifications@github.com wrote:

Ah! OK, then run configure again and check the output. You will probably find you need to add quite a few more packages. When I run configure here I see this at the end:

  • build options native win32: no native OS X: no open files in binary mode: no enable debug: no build deprecated components: yes build docs with gtkdoc: no gobject introspection: yes build vips7 Python binding: yes install vips8 Python overrides: yes (requires pygobject-3.12.0 or later)
  • optional dependencies use fftw3 for FFT: yes Magick package: MagickWand file import with libMagick: yes accelerate loops with orc: yes (requires orc-0.4.11 or later) ICC profile support with lcms: yes (lcms2) file import with OpenEXR: yes file import with OpenSlide: yes (requires openslide-3.3.0 or later) file import with matio: yes file import with cfitsio: yes file import/export with libwebp: yes text rendering with pangoft2: yes file import/export with libpng: yes (pkg-config libpng >= 1.2.9) (requires libpng-1.2.9 or later) file import/export with libtiff: yes (pkg-config libtiff-4) file import/export with libjpeg: yes image pyramid export: yes (requires libgsf-1 1.14.27 or later) use libexif to load/save JPEG metadata: yes

The README has some instructions on building from source.

— Reply to this email directly or view it on GitHub https://github.com/jcupitt/libvips/issues/237#issuecomment-74834129.

— Reply to this email directly or view it on GitHub https://github.com/jcupitt/libvips/issues/237#issuecomment-75138842.

— Reply to this email directly or view it on GitHub.

jcupitt commented 9 years ago

Looks like you're very close! It's "Vips", not "vips", try:

from gi.repository import Vips

Your python3 might not be finding gi.repository either. Make sure you have:

/usr/lib/python3/dist-packages/gi/overrides

as well, and make sure Vips.py is in there.

drmaquino commented 9 years ago

John, thank you very much for your guidance, everything's working perfect now! Sorry for the delayed response!

Mariano

On Sat, Feb 21, 2015 at 6:23 AM, John Cupitt notifications@github.com wrote:

Looks like you're very close! It's "Vips", not "vips", try:

from gi.repository import Vips

Your python3 might not be finding gi.repository either. Make sure you have:

/usr/lib/python3/dist-packages/gi/overrides

as well, and make sure Vips.py is in there.

— Reply to this email directly or view it on GitHub https://github.com/jcupitt/libvips/issues/237#issuecomment-75363548.

jcupitt commented 9 years ago

Great! I'll close the issue.