Darktable & Lensfun2

Hello there!

I’ve just compiled/installed from master/current lensfun (I have a Fuji XT20 + lenses that are not in my distro’s lensfun package), yet Darktable seems not to recognise the new libraries.

Any Ideas?

Thanks in advance!

run lensfun-update-data

Hello there!

I may have to look into it more deeply. It seems that lensfun-update-data binary in /usr is either the distro package (not the lensfun from master compiled by me), or if installed by “current”/“compiled” lensfun, the scripts Db web address attached to it is wrong/outdated:

Traceback (most recent call last): File "/usr/local/bin/lensfun-update-data", line 135, in <module> read_location("https://lensfun.sourceforge.net/db/

I do not want to be a pain so I will look into it and come back. But if you have any quick/dirty sugestions that would be great. From the outset, and without delving properly into it, it seems to me that either I have to uninstall the distro’s package (and leave my compiled one), or somehow let darktable know that I have a newer package. The first option is a bit convoluted, given that lensfun seems to be a dependency for Darktable (Fedora 30).

Anyway, I’ll come back if I find a solution, and post it here for “the people” to take profit.

you left out the important parts of the error message

In general it works:

$ lensfun-update-data
Reading http://lensfun.sourceforge.net/db/versions.json …
Reading http://wilson.bronger.org/lensfun-db/versions.json …
Successfully updated the database in /var/lib/lensfun-updates/version_1.

Perhaps I should uninstall the “master/compiled” version, it might be messing up with the distro’s package. I will look into it. Still, thanks for the update. Tell me what you think, if you have the time

Thanks in advance!

Reading https://lensfun.sourceforge.net/db/versions.json …
Traceback (most recent call last):
  File "/usr/lib64/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib64/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib64/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/usr/lib64/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/usr/lib64/python3.7/http/client.py", line 1384, in connect
    super().connect()
  File "/usr/lib64/python3.7/http/client.py", line 928, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib64/python3.7/socket.py", line 727, in create_connection
    raise err
  File "/usr/lib64/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/lensfun-update-data", line 135, in <module>
    read_location("https://lensfun.sourceforge.net/db/")
  File "/usr/local/bin/lensfun-update-data", line 118, in read_location
    response = urllib.request.urlopen(base_url + "versions.json")
  File "/usr/lib64/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib64/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/usr/lib64/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib64/python3.7/urllib/request.py", line 1360, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib64/python3.7/urllib/request.py", line 1319, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>```

it is weird that you get a connection refused given it works for me. maybe some network configuration on your side. like a firewall.

To get rid of errors, comment out the line in lensfun-update-data:
read_location(“https://lensfun.sourceforge.net/db/”)

Project Lensfun moved to Github.

1 Like

That is one of the early thoughts I had. As soon as I have time, I will try it and come back and share results.

Thanks in advance!

Hello there!

I have fixed the issue. It is most certainly a dirty fix. Here is what I have done:

Before we begin: Darktable seems to check ONLY lensfun1 database

Point [1.2] is probably what most people want to do. As it has been pointed by darix and others.

  1. I have both lensfun packages installed (the distro package and the compilled one from master).
    1.1Probably [1] is bad idea, given that lensfun-update-data seems to work fine otherwise. Do not install from master, keep your distro package and update from command-line with lensfun-update-data
    1.2. If you try lensfun-update-data and returns an error, open the file (/usr/bin/lensfun-update-data) with a text editor and comment out/delete the sourceforge address. Then run the command again (the textfile asks to do it with “sudo/su/root privileges”).

  2. If you are masochistic like me, you have compiled the thing, have two lensfun binaries installed, and for whatever reason you want to keep booth, update lensfun1 (not lensfun2) database by hand.
    2.1 Open with a text-editor /usr/share/lensfun/version_1 (and whatever file.xml is of your interest to update (i.e. mil-fujifilm.xml). And copy from /usr/share/lensfun/version_2 whatever you want to update in version 1 of the database.
    2.2 Do the same for lenses, etc…

Can someone knowleageble tell me if what i have done is terribly wrong? -i.e. the maths from databases 1&2 are not compatible with each other, or something, and I am currently applying the wrong corrections? (I guess, they are compatible, but asking does not hurt, does it?

Thanks for all your help.

By the way… forgive my english, it is not my first language.

Thanks very much for the excellent directions. I, too, had compiled and installed the master branch of lensfun in an attempt to update the lens files, but this installation left me with a broken version of lensfun-update-data that reported a socket error when I ran it.

As Cultura-Difusa recommended, editing the file to remove the refence to sourceforge fixes the problem.

In my system’s case, this installation left me with TWO versions of the lensfun-update-data file:
./usr/local/bin/lensfun-update-data
./usr/bin/lensfun-update-data

Removing the “sourceforge” line from only ./usr/bin/lensfun-update-data did not work. But removing the “sourceforge” line from the ./usr/local/bin/lensfun-update-data DID work.

Thanks to all!

2 Likes

I have a lens which is not in the list of known lenses in darktable (Olympus Zuiko Digital ED 50-200mm f/2.8-3.5 SWD).
By checking my current lensfun data it showed that that lens is already supported.


inhalt-datei

Does anybody know why it is not shown in dt? I which folder is dt searching for the lensfun data?

Does the lens name in the raw exif data match exactly the name in lensfun?

Have you updated your lensfun database?

Was the lensfun profile made on a body with a different sensor size?

@paperdigits All questions get a yes

I found out that lensfun database consists of two files regarding olympus lenses:
mil-olympus.xml & slr.olympus.xml
the first contains all mft lenses, the second all older ft lenses.

The lens in question is located in the second file. Darktable shows only the lenses which are in the first one.

It seems to me that darktable only reads the first file. I copied the data of the lens in question into the first file and now I can see and use it :slight_smile:

I don’t know why there are two files containing lens data (the mil and the slr) and only one is being used.

However this is a workaround for all who are missing olympus ft lenses in darktable.