nperraud / download-celebA-HQ

Python script to download the celebA-HQ dataset from google drive
139 stars 27 forks source link

Windows 10 Compatibility #15

Closed p-funk closed 5 years ago

p-funk commented 5 years ago

To get this to work on Windows 10 I had to do the following:

Create a new environement

conda activate celebaHQ

Install the packages

conda  install -c anaconda jpeg=8d tqdm requests pillow==3.1.1 urllib3 numpy cryptography scipy

I had to add a if __name__ == '__main__': line just before num_workers.

if __name__ == '__main__':

    num_workers = mp.cpu_count() - 1
    print('Starting a pool with {} workers'.format(num_workers))
    with mp.Pool(processes=num_workers) as pool:
        pool.map(do_the_work, list(range(expected_dat)))
    if len(glob.glob(os.path.join(delta_dir, '*.npy'))) != 30000:
        raise ValueError('Expected to find {} npy files\n Something went wrong!'.format(30000))
# Remove the dat files
    for filepath in glob.glob(os.path.join(delta_dir, '*.dat')):
        os.remove(filepath)
    print('All done! Congratulations!')
nperraud commented 5 years ago

Hi @p-funk , Thanks a lot for your contribution. I would like to add it to the README. But before I do that, can you tell me:

  1. Did you have 7zip installed, or another software?
  2. What whould happen if you wouild not add the if __name__ == '__main__'?
p-funk commented 5 years ago

I have 7zip installed. Without that line, I get the following:

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.    exitcode = _main(fd)
nperraud commented 5 years ago

Ok thanks, I have made the updated...