elisemercury / Duplicate-Image-Finder

difPy - Python package for finding duplicate or similar images within folders
https://difpy.readthedocs.io
MIT License
420 stars 65 forks source link

difPy.build() throws RuntimeError #89

Closed devilteo911 closed 4 months ago

devilteo911 commented 5 months ago

I was testing this library with your easiest example:

import difPy

dif = difPy.build("a/")
search = difPy.search(dif)

the "a/" folder is a relative path to the candidate folder with has two identical images in it. I've this error:

Exception has occurred: RuntimeError       (note: full exception trace is shown but execution is paused at: <module>)

        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

        To fix this issue, refer to the "Safe importing of main module"
        section in https://docs.python.org/3/library/multiprocessing.html

  File "C:\Users\matte\Documents\Python_Scripts\image-downloader\find_duplicates.py", line 3, in <module>
    dif = difPy.build("a/")
          ^^^^^^^^^^^^^^^^^
  File "<string>", line 1, in <module> (Current frame)
RuntimeError: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

        To fix this issue, refer to the "Safe importing of main module"
        section in https://docs.python.org/3/library/multiprocessing.html

My current environment is:

python 3.11.6
Windows 11 23H2
difPy 4.0.1

If duplicate, I apologize and feel free to refer me to the current thread and close this one.

elisemercury commented 4 months ago

Hi @devilteo911,

Thanks for your question. difPy v4.1.0 has been release and I would recommend testing it on your dataset to see if you can see some improvements.

Let me know if the issue should it still persist even though you've updated.

Thanks, Elise