r/PyPy • u/[deleted] • Oct 15 '19
PyPy3 opencv installation
I tried installing opencv in PyPy3 using pypy3 -m pip install opencv-python Didn't work.
How can I install opencv-python? Any help?
2
Upvotes
1
u/extraymond Oct 19 '19
I've been trying to get that working for years....
Hope someone shed some light on this.
2
u/extraymond Oct 21 '19 edited Oct 21 '19
Ya! I got it working now.
For anyone wishing to build the package for pypy, here's my procedure.
Prerequisite: Install numpy before opencv-python, it won't try to build it if you already have numpy installed.
Clone the opencv-python repo.
Setup a pypy venv, I created one with pyenv virtual-env pypy3-7.2.0 cv_env
cd into the opencv-python folder
Append CMAKE_ARGS="-D PYTHON3_LIBRARY=~/.pyenv/versions/pypy3.6-7.2.0/lib/libpypy-c.so" before python setup.py bdist_wheel.
The above step is crucial, so make sure it's pointing to the correct libpython equivalent file(libpypy-c.so at the moment). If cmake can't discover the correct python3-library, it will not build and produce the python3 wheel, which is why some users find the following output:
If you encounter such error, remember to delete _skbuild folder first, else the cmake options are cached and you will try to build with same config.
Prove that it works: img
TLDR: