Giter VIP home page Giter VIP logo

Comments (7)

jcupitt avatar jcupitt commented on June 16, 2024

Sorry, Anaconda is its own weird thing, it can't use standard pip packages.

Someone needs to make a special conda package that installs the libvips binary plus the Python part of the binding. There have been a few attempts, but it's not happened yet.

from pyvips.

jcupitt avatar jcupitt commented on June 16, 2024

I meant to say, until there's a conda package the workaround is to install standard Python and use pyvips from that.

from pyvips.

dougwood avatar dougwood commented on June 16, 2024

Thanks John. I tried installing on one of our servers as follows:
C:\Users\Doug>pip install pyvips
Collecting pyvips
Downloading https://files.pythonhosted.org/packages/5c/6e/df4a34a9c8b349e40d6400bd4ac40558b3497732795fa0399596155b18b1/pyvips-2.1.2.tar.gz
Collecting cffi>=1.0.0 (from pyvips)
Downloading https://files.pythonhosted.org/packages/05/3f/abc53d8f0c7362181d809c913c2b348e41c193eff84c2f0445da2b615f69/cffi-1.11.5-cp36-cp36m-win32.whl (155kB)
100% |████████████████████████████████| 163kB 3.3MB/s
Collecting pycparser (from cffi>=1.0.0->pyvips)
Downloading https://files.pythonhosted.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz (245kB)
100% |████████████████████████████████| 256kB 3.3MB/s
Installing collected packages: pycparser, cffi, pyvips
Running setup.py install for pycparser ... done
Running setup.py install for pyvips ... done
Successfully installed cffi-1.11.5 pycparser-2.18 pyvips-2.1.2
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Note I did not use the --user option because I expect this will be used by all users on this server.

Next, I tried the following:

C:\Users\Doug>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import logging
logging.basicConfig(level=logging.DEBUG)
import pyvips
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'pyvips'
quit()

C:\Users\Doug>pip search pyvips
pyvips (2.1.2) - binding for the libvips image processing library, API mode
INSTALLED: 2.1.2 (latest)
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\Doug>vips --version
vips-8.6.3-Thu Mar 8 15:18:35 UTC 2018


Any idea what is the issue? There may be other versions of python on this machine.

Thanks again for your help.
Doug

from pyvips.

dougwood avatar dougwood commented on June 16, 2024

I installed Python 3.7 and tried again in my Windows 10 Pro running in Parallels and this is what happened:

C:\Users\dougwood>pip install --user pyvips
Collecting pyvips
Collecting cffi>=1.0.0 (from pyvips)
  Downloading https://files.pythonhosted.org/packages/2d/9e/9d84a78d4ea3d0fa94f6d0e4bcd88406709312949f48f3853f26f8f52ebe/cffi-1.11.5-cp37-cp37m-win32.whl (154kB)
    100% |████████████████████████████████| 163kB 6.6MB/s
Collecting pycparser (from cffi>=1.0.0->pyvips)
  Using cached https://files.pythonhosted.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz
Installing collected packages: pycparser, cffi, pyvips
  Running setup.py install for pycparser ... done
Successfully installed cffi-1.11.5 pycparser-2.18 pyvips-2.1.2
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\dougwood>
C:\Users\dougwood>vips --version
vips-8.6.5-Wed Jul 25 09:46:22 UTC 2018

C:\Users\dougwood>python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import  logging
>>> logging.basicConfig(level=logging.DEBUG)
>>> import pyvips
DEBUG:pyvips:Binary module load failed: No module named '_libvips'
DEBUG:pyvips:Falling back to ABI mode
Traceback (most recent call last):
  File "C:\Users\dougwood\AppData\Roaming\Python\Python37\site-packages\pyvips\__init__.py", line 19, in <module>
    import _libvips
ModuleNotFoundError: No module named '_libvips'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\dougwood\AppData\Roaming\Python\Python37\site-packages\pyvips\__init__.py", line 53, in <module>
    gobject_lib = ffi.dlopen(_gobject_libname)
  File "C:\Users\dougwood\AppData\Roaming\Python\Python37\site-packages\cffi\api.py", line 141, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "C:\Users\dougwood\AppData\Roaming\Python\Python37\site-packages\cffi\api.py", line 802, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
  File "C:\Users\dougwood\AppData\Roaming\Python\Python37\site-packages\cffi\api.py", line 798, in _load_backend_lib
    return backend.load_library(path, flags)
OSError: cannot load library 'C:\dev\vips\vips-dev-8.6\bin\libgobject-2.0-0.dll': error 0xc1

I checked and the path to the DLL referenced is correct:

C:\Users\dougwood>dir c:\dev\vips\vips-dev-8.6\bin\libgobject*.*
 Volume in drive C has no label.
 Volume Serial Number is 5A36-DDB8

 Directory of c:\dev\vips\vips-dev-8.6\bin

07/25/18  10:35 AM           604,659 libgobject-2.0-0.dll
               1 File(s)        604,659 bytes
               0 Dir(s)  165,722,181,632 bytes free

C:\Users\dougwood>

from pyvips.

jcupitt avatar jcupitt commented on June 16, 2024

You probably saw this old issue: https://github.com/jcupitt/pyvips/issues/44#issuecomment-390160980

That was with py3.6. I'll have a go with 3.7.

from pyvips.

dougwood avatar dougwood commented on June 16, 2024

Well actually, after cleaning up some path issues (more than one install of Python), I think I have it installing:

C:\Program Files\Python36\Scripts>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.basicConfig(level=logging.DEBUG)
>>> import pyvips
DEBUG:pyvips:Binary module load failed: No module named '_libvips'
DEBUG:pyvips:Falling back to ABI mode
DEBUG:pyvips:Loaded lib <cffi.api._make_ffi_library.<locals>.FFILibrary object at 0x000001A4FF62ACF8>
DEBUG:pyvips:Loaded lib <cffi.api._make_ffi_library.<locals>.FFILibrary object at 0x000001A4FF6155C0>
DEBUG:pyvips:Inited libvips
DEBUG:pyvips:

Does that look correct given the fall back to ABI mode? If so, I will mark this closed.

I did not move v3.7, BTW. I will see if I can start using it in my code.

from pyvips.

jcupitt avatar jcupitt commented on June 16, 2024

Yes, that looks fine. API mode only works if Python can find a working C compiler, which is often tricky on Windows.

from pyvips.

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.