Ubuntu: File not found when installing from pip



Question:

I have been trying to solve an issue that I've found when trying to install a python package in Lubuntu 17.04.

The package is for python 3.5 64bits. It's called RawPy and depends on the LibRaw library. I have installed the LibRaw library but when trying to install RawPy, it is not able to find some files of the LibRaw installation:

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:~$  

I have checked and that missing files exist at usr/local/lib/libraw. Tried to add that route using ldconfig but that didn't work.

LibRaw do seems to be installed. When I write ldconfig -p, I get:

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  

And indeed:

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:~$  

The locations of the file are these:

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:~$  

The third location is the download folder of the source code from GitHub. I also compiled the last version of the code but it didnt work

Is there any way to explicitly tell pip to look in certain path for dependencies? I have even thought oh changing the source to explicitly tell the path but I don't think that is the proper fix.

Someone any idea?


Solution:1

Disclaimer: I'm the developer of rawpy.

I'm not sure about the specific issue you have but I released a new version recently which provides binary packages (wheels) for Linux (in addition to Windows and macOS), so no more compilation or manual installation of libraw needed. Just reinstall rawpy and it should work out of the box.


Solution:2

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

followed by sudo ldconfig.

This is tken from the installation instructions for rawpy.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »