elisemercury / Duplicate-Image-Finder

difPy - Python package for finding duplicate and similar images
https://difpy.readthedocs.io
MIT License
465 stars 67 forks source link

A new process has started before the current process has finished its bootstrapping phase #85

Closed pauljohn2000 closed 1 week ago

pauljohn2000 commented 11 months ago

Ran a simple example using pif.py on a Mac (Intel) running Sonoma 14.1.1 and Python 3.11.1.

Code: import difPy dif = difPy.build("/Users/paul/Pictures/New/") search = difPy.search(dif, in_folder=True)

Results: The error repeated continually until I terminated the execution. See attached file for output. results.txt

pantegra commented 11 months ago

I have the same issue running it on a Mac OS 14.1.2 m2 pro chip. I get the same results when running it with python 3.11.x or 3.9.x, the Python version is not a factor. The result is the same. Please fix this quickly. I have about 2k photos to try to clean out before I can post them.

pauljohn2000 commented 11 months ago

I cloned the difpy repo and executed dif.py from the command line (once I had installed the setuptools module). It worked fine and produced 3 JSON files. difPy_20231203142307_results.json correctly displayed the duplicate pictures. There must be something different in my config (?) that trips dif.py up when called from within another Python script.

elisemercury commented 11 months ago

Hi @pauljohn2000

Thanks a lot for flagging this! We will investigate this and consider it with the next difPy release.

Thanks, Elise

SurajBhari commented 10 months ago

Any update about this. as i can see. its still happening.

pauljohn2000 commented 9 months ago

I came back to looking at this issue and implemented the change that the Python runtime had suggested (duh!) and was successful. So it would be helpful to add the implementation details in the difPy documentation.

Here's my code example (that worked):

`from multiprocessing import freeze_support import difPy

if name == 'main': freeze_support() dif = difPy.build(['/SourceDir1/','/SourceDir2/']) search = difPy.search(dif)
for i in search.result: source = search.result[i]['location'] for j in search.result[i]['matches']: print(source, 'matches', search.result[i]['matches'][j]['location'])

elisemercury commented 9 months ago

Hi all,

difPy v4.1.0 has been released and I would recommend testing it to see if you can see some improvements.

Feel free to reopen the issue should it still persist even though you've updated.

Thanks, Elise

n1lech commented 8 months ago

difPy v4.1.0 has been released and I would recommend testing it to see if you can see some improvements.

I am running 4.1.0 on a mac m1 python3.11 and still have that issue.

However with the poc from @pauljohn2000 , it works.

import difPy
from multiprocessing import freeze_support

if __name__ == '__main__':
    freeze_support()
    dif = difPy.build('my/path')
    search = difPy.search(dif)
    print(search)
Shnugs commented 8 months ago

Running diffPy v4.1.0 on python3.12 and still have this issue.

Just confirming that the POC that @pauljohn2000 posted works for py312.

michaelcaterisano commented 7 months ago

Same issue here. I didn't need everything in https://github.com/elisemercury/Duplicate-Image-Finder/issues/85#issuecomment-1927871788. The following works for me:

import difPy

if __name__ == "__main__":
    dif = difPy.build("path/to/images")
    search = difPy.search(dif)
    print(search.result)
elisemercury commented 1 month ago

Hi all,

Sorry for the delay on this issue and thanks all for your contributions to this!

I'm happy to let you know that difPy just got a new version update v4.1.1 which incorporates freeze_support() by default before starting a difPy build or search process. Thanks for this suggestion @pauljohn2000 and thanks all for validating the fix.

This should hopefully provide a fix for the issue. Our tests have shown no issues - please let me know if you do still encounter these from you end.

Best, Elise