Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Python 3.73 cannot install py3exiv2

1,446 views
Skip to first unread message

Ken Martell

unread,
May 1, 2019, 12:55:24 PM5/1/19
to
I’m a retired aerospace engineer. I’m a Windows 10 user & have zero experience with Python. My goal is to learn, get this working & run lens distortion correction routines using Python. I’ve tried or many hours and read as much as I can but cannot get the py3exiv2 module to install. Other needed modules installed fine. It appears the Python version 2 of evix2 is needed as a dependent for the version 3 but neither pip or pip3 will install old or new. Sorry for taking your time but I’m a newbie just trying to help my fellow photographers correct lens distortion problems in post-processing as well as my own.

Any help much appreciated!

Thank you
Ken Martell

This is the error I get :

D:\>pip3 install py3exiv2
Collecting py3exiv2
  Using cached https://files.pythonhosted.org/packages/eb/c4/675823a2c23d8f138e7dc2b7574d09f26959f641d0b59c3ec7faa65764e5/py3exiv2-0.7.0.tar.gz
Installing collected packages: py3exiv2
  Running setup.py install for py3exiv2 ... error
    Complete output from command d:\apps\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Ken\\AppData\\Local\\Temp\\pip-install-swqqye4_\\py3exiv2\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Ken\AppData\Local\Temp\pip-record-4ki8wmrk\install-record.txt --single-version-externally-managed --compile:
    FIND: Invalid switch
    FIND: Invalid switch
    FIND: Invalid switch
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\pyexiv2
    copying src\pyexiv2\exif.py -> build\lib.win-amd64-3.7\pyexiv2
    copying src\pyexiv2\iptc.py -> build\lib.win-amd64-3.7\pyexiv2
    copying src\pyexiv2\metadata.py -> build\lib.win-amd64-3.7\pyexiv2
    copying src\pyexiv2\preview.py -> build\lib.win-amd64-3.7\pyexiv2
    copying src\pyexiv2\utils.py -> build\lib.win-amd64-3.7\pyexiv2
    copying src\pyexiv2\xmp.py -> build\lib.win-amd64-3.7\pyexiv2
    copying src\pyexiv2\__init__.py -> build\lib.win-amd64-3.7\pyexiv2
    running build_ext
    building 'libexiv2python' extension
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\src
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:\apps\python37\include -Id:\apps\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /EHsc /Tpsrc/exiv2wrapper.cpp /Fobuild\temp.win-amd64-3.7\Release\src/exiv2wrapper.obj -g
    cl : Command line warning D9002 : ignoring unknown option '-g'
    exiv2wrapper.cpp
    c:\users\ken\appdata\local\temp\pip-install-swqqye4_\py3exiv2\src\exiv2wrapper.hpp(32): fatal error C1083: Cannot open include file: 'exiv2/image.hpp': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "d:\apps\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Ken\\AppData\\Local\\Temp\\pip-install-swqqye4_\\py3exiv2\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Ken\AppData\Local\Temp\pip-record-4ki8wmrk\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Ken\AppData\Local\Temp\pip-install-swqqye4_\py3exiv2\
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.


Sent from Mail for Windows 10

Terry Reedy

unread,
May 1, 2019, 5:51:25 PM5/1/19
to
On 5/1/2019 9:12 AM, Ken Martell wrote:
> I’m a retired aerospace engineer. I’m a Windows 10 user & have zero experience with Python. My goal is to learn, get this working & run lens distortion correction routines using Python. I’ve tried or many hours and read as much as I can but cannot get the py3exiv2 module to install. Other needed modules installed fine. It appears the Python version 2 of evix2 is needed as a dependent for the version 3 but neither pip or pip3 will install old or new.

I don't believe that this is the case. exiv2 is a C++ library.
'pyexiv2' is a python 2 wrapper that makes it accessible from python
2.7. 'py3exiv2' is an python 3 wrapper based on pyexiv2, but it should
be independent of pyexiv2. https://pypi.org/project/py3exiv2/
This is the reason for the failure. Either the build instruction is
incorrect, or the file is missing. The py3exiv2 author is listed on the
web page. I forwarded you post to him.

>     error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
>
>     ----------------------------------------
> Command "d:\apps\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Ken\\AppData\\Local\\Temp\\pip-install-swqqye4_\\py3exiv2\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Ken\AppData\Local\Temp\pip-record-4ki8wmrk\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Ken\AppData\Local\Temp\pip-install-swqqye4_\py3exiv2\
> You are using pip version 19.0.3, however version 19.1 is available.
> You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Many package authors write and test on *nix, especially when the package
includes C or C++ code that needs to be compiled. Compiling on Windows
with VSC++ instead of gcc required additional expertise.

https://www.lfd.uci.edu/~gohlke/pythonlibs/
Unofficial Windows Binaries for Python Extension Packages
has a build for pyexiv2, for 2.7. I suggested to Christoph that he add
py3exiv2 for 3.x. While I normally highly recommend starting with 3.x,
you could try the prebuilt 2.7 version until you can either build or
download py3exiv.

--
Terry Jan Reedy


dieter

unread,
May 2, 2019, 1:30:39 AM5/2/19
to
Ken Martell <darkn...@gmail.com> writes:
> ...
> D:\>pip3 install py3exiv2
> Collecting py3exiv2
> ...
>     C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:\apps\python37\include -Id:\apps\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /EHsc /Tpsrc/exiv2wrapper.cpp /Fobuild\temp.win-amd64-3.7\Release\src/exiv2wrapper.obj -g
> ...
> c:\users\ken\appdata\local\temp\pip-install-swqqye4_\py3exiv2\src\exiv2wrapper.hpp(32): fatal error C1083: Cannot open include file: 'exiv2/image.hpp': No such file or directory

"pip" (and "pip3") is a tool to install Python extensions.
It does quite a good job for "pure Python" extensions.

But, some extensions are not "pure Python" but rely on
"external" C/C++ libraries. Those must be installed
in your system -- typically in a development variant
(i.e. together with header files describing the interfaces) --
before "pip" can successfully install the Python extension.

Apparently, this is your case. The external C/C++ library
is likely named "exiv2". You must install it before "pip"
can install "py3exiv2".


If you are lucky, then "py3exiv2" comes with installation instructions
which tell you where and how to obtain the dependent libraries.
Otherwise, you would need other ways to get the necessary information --
maybe search the internet.

Vincent Vande Vyvre

unread,
May 2, 2019, 11:48:50 AM5/2/19
to
Le 1/05/19 à 15:12, Ken Martell a écrit :
> I’m a retired aerospace engineer. I’m a Windows 10 user & have zero experience with Python. My goal is to learn, get this working & run lens distortion correction routines using Python. I’ve tried or many hours and read as much as I can but cannot get the py3exiv2 module to install. Other needed modules installed fine. It appears the Python version 2 of evix2 is needed as a dependent for the version 3 but neither pip or pip3 will install old or new. Sorry for taking your time but I’m a newbie just trying to help my fellow photographers correct lens distortion problems in post-processing as well as my own.
>
> Any help much appreciated!
>
> Thank you
> Ken Martell
>
>
>
> Sent from Mail for Windows 10
>
>

The package available on PyPI is for *nix machines.

I don't have access to a Windows machine nor the knowledge to build an
executable for Windows.

But, recently an user send me how it has successfully compiled py3exiv2
for Windows.



Hello Vincent,

 I’ve run through the trouble of building py3exiv2 on Windows and was
successful in doing so,

therefore I’d like to present you the steps I’ve taken to get there, so
that you can alter setup.py and give some instructions on how to install
it on Windows.

This is a copy of his mail:
-----------------------------------------------------------------------------------
 The key part in making this work is
https://github.com/Microsoft/vcpkg, it has both exiv2 and boost-python.

Here’s what I did:

 [INSTALLING PYEXIV3 ON WINDOWS]
- install GIT-2.21.0-64-bit.exe
- install VSCodeUserSetup-x64-1.33.1.exe
- clone vcpkg, note the folder name
    $ git clone https://github.com/Microsoft/vcpkg.git
- install vcpkg by running .\bootstrap-vcpkg.bat
- run vcpkg.exe install boost-python:x64-windows
- run vcpkg.exe install exiv2:x64-windows
- make sure to add /installed/x64-windows/bin to the PATH (for dll import)
- get the pyexiv2 sources from here: http://py3exiv2.tuxfamily.org/downloads
- replace setup.py with my version
- set the environment variable VCPKG to the folder where you installed it
- run pip install -e <py3exiv2-folder>

I’ve attached my modified version of setup.py. It’s very rough since I
don’t know much about setuptools at all, but it essentially involves
bypassing `get_libboost_name` which fails completely on windows and
using the environment variable VCPGK that has to be set by the user to
point at the vcpkg directory. There’s probably a cleaner way of doing
this, like accepting a command line argument. But again, I have no idea
how setuptools handles this so hopefully you can clean it up a bit.
`boost_python37-vc140-mt` is also completely hardcoded, you’d probably
have to modify `get_libboost_name` to work on Windows.

 While I’m at this, I’ve noticed the lack of support for custom xmp
tags. For now I’ve resorted to abusing various IPTC Tags for my purpose,
but that’s a rather terrible solution. I’d appreciate it if you could
prioritize adding that feature in the future.

 with best regards,

Vic

setup.py

#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys
import os
import glob
import subprocess

from setuptools import setup, find_packages, Extension

from codecs import open
from os import path

here = path.abspath(path.dirname(__file__))

# Get the long description from the relevant file
with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f:
    long_description = f.read()

def get_libboost_name():
    """Returns the name of the lib libboost_python 3

    """
    # libboost libs are provided without .pc files, so we can't use
pkg-config
    places = ('/usr/lib/', '/usr/local/lib/', '/usr/')
    for place in places:
        cmd = ['find', place, '-name', 'libboost_python*']
        rep = subprocess.Popen(cmd,
stdout=subprocess.PIPE).communicate()[0]
        if not rep:
            continue

        # rep is type bytes
        libs = rep.decode(sys.getfilesystemencoding()).split('\n')
        for l in libs:
            _, l = os.path.split(l)
            if '.so' in l:
                l = l.split('.so')[0]
                # Assume there's no longer python2.3 in the wild
                if '3' in l[-2:]:
                    return l.replace('libboost', 'boost')

if os.name == 'nt':
    basep = os.environ["VCPKG"] + r"\installed\x64-windows"
    os.environ["INCLUDE"] = basep + r"\include"
    libboost = basep + r"\lib\boost_python37-vc140-mt"
    libexiv = basep + r"\lib\exiv2"
    extra_compile_args = []
else:
    libboost = get_libboost_name()
    extra_compile_args = []
    libexiv = 'exiv2'

setup(
    name='py3exiv2',
    version='0.7.0',
    description='A Python3 binding to the library exiv2',
    long_description=long_description,
    url='https://launchpad.net/py3exiv2',
    author='Vincent Vande Vyvre',
    author_email='vincent.v...@oqapy.eu',
    license='GPL-3',

    # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'Topic :: Software Development',
        'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
        'Programming Language :: C++',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
        'Programming Language :: Python :: 3.8'
    ],
    keywords='exiv2 pyexiv2 EXIF IPTC XMP image metadata',
    packages = find_packages('src'),
    package_dir = {'': 'src'},
    package_data={'':['src/*.cpp', 'src/*.hpp',]},
    #cmdclass={'install': install}
    ext_modules=[
    Extension('libexiv2python',
        ['src/exiv2wrapper.cpp', 'src/exiv2wrapper_python.cpp'],
        include_dirs=[],
        library_dirs=[],
        libraries=[libboost, libexiv],
        extra_compile_args=extra_compile_args
        )
    ],
)
--------------------------------------------------------------------------------

Vincent


0 new messages