letmaik / lensfunpy

📷 Lens distortion correction for Python, a wrapper for lensfun
https://pypi.python.org/pypi/lensfunpy
MIT License
145 stars 18 forks source link

Empty database on Linux #15

Closed ArcticSnow closed 6 years ago

ArcticSnow commented 6 years ago

Hi, Using linux Mint, I followed your installation protocol with apt-get for lensfun, and then install the lensfunpy library with pip. The python library loads just fine but its database is empty when querying for a camera such as the one in the Readme example.

This is for instance my input and output in ipython:

import lensfunpy

cam_maker = 'NIKON CORPORATION'
cam_model = 'NIKON D3S'
lens_maker = 'Nikon'
lens_model = 'Nikkor 28mm f/2.8D AF'

db = lensfunpy.Database()
cam = db.find_cameras(cam_maker, cam_model)[0]
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 2883, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-3cb54c3ab96e>", line 9, in <module>
    cam = db.find_cameras(cam_maker, cam_model)[0]
IndexError: list index out of range

Any idea where should I look to solve the problem? Thanks

letmaik commented 6 years ago

I could reproduce the problem in Ubuntu. Indeed the database is empty. Let me see where the problem is.

letmaik commented 6 years ago

I'm really a bit puzzled by this. There was another issue with the binary wheels for Linux. They were missing the bundled db files. If you can use wheels (just using pip install lensfunpy) then you would work around your problem as it would then use the bundled ones and you don't have to install liblensfun. I'll release a new alpha soon so you can try that.

letmaik commented 6 years ago

Actually, this only seems to happen with the wheels. Doing a source compile using pip install lensfunpy --no-binary lensfunpy solves it for me. Given that the Linux wheels were missing bundled db files this would be fixed by the next lensfunpy version anyway for the standard wheel installation scenario (pip install lensfunpy). And building from source doesn't have this problem, so that is fine as it is.

Side note: I suspect that the underlying problem of not locating system-installed db files (which was the original observation) was that lensfun switched the location where db files are stored (looking at the docs it seems to include the db version number now in the folder name), and since the wheels were compiled with the latest lensfun version but your system-installed version was likely older, the locations didn't match up anymore.

letmaik commented 6 years ago

I just released a new alpha version, you can try it out with pip install lensfunpy==1.7.0a2. Let me know if it works, then we can close this issue.

ArcticSnow commented 6 years ago

Super, it works great with your latest version. Thanks so much for your very quick fix!

CapPow commented 5 years ago

For reference I encountered a similar issue on Windows 10 where only the lens data was not discovered. Using the same pip install lensfunpy==1.7.0a2 suggested by @letmaik solved the issue. Thanks!

Ir1d commented 5 years ago

pip install lensfunpy==1.7.0a2 solves this on Ubuntu 18.04