Arquivo não encontrado ao instalar a partir do pip

0

Eu tenho tentado resolver um problema que encontrei ao tentar instalar um pacote python no Lubuntu 17.04.

O pacote é para python 3.5 64bits. É chamado RawPy e depende da biblioteca LibRaw. Instalei a biblioteca LibRaw, mas ao tentar instalar o RawPy, ele não consegue encontrar alguns arquivos da instalação do LibRaw:

lubuntu@lubuntu:~$ sudo -H pip3 install rawpy
Collecting rawpy
  Using cached rawpy-0.9.0.tar.gz
Requirement already satisfied: numpy in /usr/local/lib/python3.5/dist-packages (from rawpy)
Building wheels for collected packages: rawpy
  Running setup.py bdist_wheel for rawpy ... error
  Complete output from command /usr/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pyqrhjz2/rawpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp9a3kr8dtpip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.5
  creating build/lib.linux-x86_64-3.5/rawpy
  copying rawpy/__init__.py -> build/lib.linux-x86_64-3.5/rawpy
  copying rawpy/_version.py -> build/lib.linux-x86_64-3.5/rawpy
  copying rawpy/enhance.py -> build/lib.linux-x86_64-3.5/rawpy
  running build_ext
  building 'rawpy._rawpy' extension
  creating build/temp.linux-x86_64-3.5
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-7CCmgg/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -D_HAS_LIBRAW_CONFIG_H=0 -I/usr/local/lib/python3.5/dist-packages/numpy/core/include -I/usr/include/python3.5m -c _rawpy.cpp -o build/temp.linux-x86_64-3.5/_rawpy.o
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  In file included from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1788:0,
                   from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                   from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                   from _rawpy.cpp:482:
  /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
   #warning "Using deprecated NumPy API, disable it by " \
    ^~~~~~~
  In file included from _rawpy.cpp:484:0:
  def_helper.h:1:28: fatal error: libraw_version.h: No such file or directory
   #include "libraw_version.h"
                              ^
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for rawpy
  Running setup.py clean for rawpy
Failed to build rawpy
Installing collected packages: rawpy
  Running setup.py install for rawpy ... error
    Complete output from command /usr/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pyqrhjz2/rawpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-byii91yd-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/rawpy
    copying rawpy/__init__.py -> build/lib.linux-x86_64-3.5/rawpy
    copying rawpy/_version.py -> build/lib.linux-x86_64-3.5/rawpy
    copying rawpy/enhance.py -> build/lib.linux-x86_64-3.5/rawpy
    running build_ext
    building 'rawpy._rawpy' extension
    creating build/temp.linux-x86_64-3.5
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-7CCmgg/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -D_HAS_LIBRAW_CONFIG_H=0 -I/usr/local/lib/python3.5/dist-packages/numpy/core/include -I/usr/include/python3.5m -c _rawpy.cpp -o build/temp.linux-x86_64-3.5/_rawpy.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    In file included from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1788:0,
                     from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                     from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from _rawpy.cpp:482:
    /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
     #warning "Using deprecated NumPy API, disable it by " \
      ^~~~~~~
    In file included from _rawpy.cpp:484:0:
    def_helper.h:1:28: fatal error: libraw_version.h: No such file or directory
     #include "libraw_version.h"
                                ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pyqrhjz2/rawpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-byii91yd-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-pyqrhjz2/rawpy/
lubuntu@lubuntu:~$

Eu verifiquei e os arquivos ausentes existem em usr / local / lib / libraw. Tentei adicionar essa rota usando ldconfig mas isso não funcionou.

O LibRaw parece estar instalado. Quando escrevo ldconfig -p , obtenho:

libraw1394.so.11 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libraw1394.so.11
libraw_r.so.16 (libc6,x86-64) => /usr/local/lib/libraw_r.so.16
libraw_r.so.16 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libraw_r.so.16
libraw_r.so (libc6,x86-64) => /usr/local/lib/libraw_r.so
libraw.so.16 (libc6,x86-64) => /usr/local/lib/libraw.so.16
libraw.so.16 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libraw.so.16
libraw.so (libc6,x86-64) => /usr/local/lib/libraw.so

E, de fato:

lubuntu@lubuntu:~$ sudo apt install libraw-dev 
Reading package lists... 
Done Building dependency tree        
Reading state information... 
Done libraw-dev is already the newest version (0.18.1-1). 
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 
lubuntu@lubuntu:~$

As localizações do arquivo são estas:

lubuntu@lubuntu:~$ sudo find / -name libraw_version.h
/usr/include/libraw/libraw_version.h
/usr/local/include/libraw/libraw_version.h
/home/lubuntu/libraw/libraw/libraw_version.h
find: ‘/run/user/999/gvfs’: Permission denied
lubuntu@lubuntu:~$

O terceiro local é a pasta de download do código-fonte do GitHub. Eu também compilei a última versão do código, mas não funcionou

Existe alguma maneira de explicitamente dizer ao pip para procurar em determinado caminho por dependências? Eu até pensei em mudar a fonte para explicitamente dizer o caminho, mas eu não acho que é a correção adequada.

Alguém tem alguma ideia?

    
por mareram 24.04.2017 / 14:14

2 respostas

1

Aviso: sou o desenvolvedor do rawpy.

Não tenho certeza sobre o problema específico que você tem, mas lancei recentemente uma nova versão que fornece pacotes binários (rodinhas) para o Linux (além do Windows e do macOS), portanto não é necessária mais compilação ou instalação manual da libraw. Basta reinstalar o rawpy e ele deve funcionar imediatamente.

    
por letmaik 31.07.2017 / 20:40
0

Experimente echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/99local.conf

seguido por sudo ldconfig .

Isso é feito nas instruções de instalação para rawpy.

    
por Shagun Sodhani 30.04.2017 / 14:55

Tags