ThreatExchange icon indicating copy to clipboard operation
ThreatExchange copied to clipboard

[vpdq] Add support for Windows in vpdq pypy package

Open therreher opened this issue 2 years ago • 5 comments

Does this software work with windows 10. I have ffmpeg and cmake installed but when I try to install I get this error: pip install vpdq Collecting vpdq Using cached vpdq-0.0.8.tar.gz (86 kB) Preparing metadata (setup.py) ... done Requirement already satisfied: cython in c:\users\user\appdata\local\programs\python\python311\lib\site-packages (from vpdq) (3.0.0) Requirement already satisfied: opencv-python in c:\users\user\appdata\local\programs\python\python311\lib\site-packages (from vpdq) (4.8.0.76) Collecting opencv-python-headless (from vpdq) Obtaining dependency information for opencv-python-headless from https://files.pythonhosted.org/packages/70/78/7a13730745684584db53e8aa3c3bd84beef2dcb32bebf627bda0d6df461e/opencv_python_headless-4.8.0.76-cp37-abi3-win_amd64.whl.metadata Using cached opencv_python_headless-4.8.0.76-cp37-abi3-win_amd64.whl.metadata (20 kB) Requirement already satisfied: numpy>=1.21.2 in c:\users\user\appdata\local\programs\python\python311\lib\site-packages (from opencv-python->vpdq) (1.25.2) Using cached opencv_python_headless-4.8.0.76-cp37-abi3-win_amd64.whl (38.0 MB) Building wheels for collected packages: vpdq Building wheel for vpdq (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [4 lines of output] running bdist_wheel running build running build_ext error: [WinError 2] The system cannot find the file specified [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for vpdq Running setup.py clean for vpdq Failed to build vpdq ERROR: Could not build wheels for vpdq, which is required to install pyproject.toml-based projects

therreher avatar Aug 17 '23 02:08 therreher

Hmm, @ianwal had done a series of diffs to add windows support, but I don't think we built a new version at the end, which you've tried to pip install. Let me release a new version and see if that fixes it.

I have a windows machine, so should be able to test it.

Dcallies avatar Aug 17 '23 12:08 Dcallies

The Python bindings I didn't have time to get working fully with Windows. It's a build issue. But, vpdq itself does build and work with Windows.

The way the binding builds with Cython is it passes the libav libraries as the environment variable LIBRARY_DIRS from CMake to Cython. When I tried to build with Windows it seemed like that was missing. It's probably a simple fix.

Here are some of my notes to get vpdq itself to build on Windows with MinGW https://github.com/facebook/ThreatExchange/pull/1331#issuecomment-1641204686

One way this could be done is if the platform is detected as Windows in the build script vpdq/vpdq-release.py, then have the user supply the location of the libav library dirs installed with MinGW. This wouldn't be pretty but it would work.

ianwal avatar Aug 17 '23 12:08 ianwal

Finally repo'd on my side after remembering the correct sequence of installs to get visual studios to build opencv.

@therreher - any concerns with me converting this to a help request to add windows support for the cpp bindings?

Dcallies avatar Aug 17 '23 13:08 Dcallies

That's find but I have another question. I saw in @ianwal notes"Install MinGW toolchain." Does FFmpeg need to be installed through MinGW because I installed it from https://www.gyan.dev/ffmpeg/builds/ and added the path manually.

therreher avatar Aug 17 '23 22:08 therreher

FFmpeg need to be installed through MinGW because I installed it from https://www.gyan.dev/ffmpeg/builds/ and added the path manually.

Not sure. I don't have a lot of experience with MinGW. If it builds it builds. I would prefer to install through a package manager though.

ianwal avatar Aug 18 '23 00:08 ianwal