How to find and eliminate materials that aren't disappearing with orphan data purge The files I work with have gone through a lot of versions and are linked a lot, and aren't that organized. I am trying to set up a new palette of colors and so I stripped off all the materials in a file (this way). When I reloaded the file most of the materials were gone, but there is this list of them that stubbornly remain, including after purging orphan data as explained here.



There are two groups in the scene that may well have been appended or linked from their own files, or the scene may have been created by deleting everything except these pieces, or both. I don't remember. Nothing is linked here anymore, except that Glossy Black material and that I tracked down in another file, where it was also linked from another file, and I don't remember that, and you see where this is going. 

How can I find where those materials are coming from and remove them?

Edit: Ok, the materials seem to be coming from a library that has a broken link. I moved it to a new location, and tried updating the external data links with 'find missing files', but that doesn't seem to have worked for this.  



Edit 2: I fixed the broken link to Materials-Lalande by replacing that file, which had been moved, in the place where it was looking for it. Now it doesn't list the library in the resources. Also, I can delete the materials now, which would just reappear when I reloaded the file when I tried to do that before. This is resolving the problem. There remains no indication where blender lists the materials as being used. Each one has 2 users, but I can't find what those users are.
On a peer material basis.


Try bpy.data.materials['nameofthematerial'].user_clear()
Reload the file.
If still there,

for i in bpy.data.scenes['Scene'].objects.items():
    for j in i[1].material_slots: 
        if j.name == 'nameofthematerial':
            print(i[1].name)


Will give you a list of the objects in the scene that the material is connected to.
Do you have only one scene ? If no you can repeat the operation for each scene, if yes you might find an elegant solution by including another for that will loop through the scenes, but hey got to keep some handwork and this might be futile unless you have ~10 or more scenes.