0

I am using pypy3 to compile python project which is related to video streaming. I wanted to speed up the video (want to increase average frames per second).

To run the project, I need to install opencv-python, scipy, ffpyplayer, and pyglet.

I tried installing opencv using just pip, however, it did not work (I tried almost every possibilities).

After research, I figured out that I have to use pip inside pypy folder (../pypy3/bin/pip). However, it gives same error that "Could not find a version that satisfies the requirement opencv-python (from versions: ) No matching distribution found for opencv-python". Also scipy "error: library dfftpack has Fortran sources but no Fortran compiler found".

Have anyone ever used those packages with pypy? I have tried in virtualenv and on my computer too.

Please help me with this since I am working on this for several weeks already. (I have tried on OSX and windows)

Community
  • 1
  • 1
keh
  • 3
  • 3

1 Answers1

0

OpenCV on PyPI (where pip downloads from) provides only binary wheels that are compiled for cpython, not pypy. Unfortunately there is no source for binary wheels for PyPy at this time. You dont' really have any good options at this point in time (Feb 2019):

  • Try compiling from source with CMake, the OpenCV source code, and PyPy, but I wouldn't expect it to work out of the box.
  • Use this CFFI alternative which has not been updated in quite a while
  • Use cpython to interact with OpenCV and somehow pass the result to PyPy via something like pymetabiosis but that project seems unsupported

Have you profiled your code and determined that python is slowing you down? From the packages you named, I would imagine the problem is that you are just trying to do too much in each frame, or that you are not using double buffering to read a frame while processing the previous one.

mattip
  • 2,360
  • 1
  • 13
  • 13
  • Thank you for answering my question. Although I have tired all options you suggested it did not work. I downloaded Ubuntu system on my Window computer and trying installing packages again. However, it still gives error when I install Opencv and Scipy (didn't try other packages yet). Do you have any idea why I am keep getting errors while installing python packages? – keh Mar 06 '19 at 20:00
  • How did you try installing OpenCV? `pip install will not work, you need to clone the OpenCV github repo and build from source, not a task for beginners. – mattip Mar 07 '19 at 22:22
  • scipy should work with pip install, as long as you have pypy3 v7.0 that was released a few weeks ago. – mattip Mar 07 '19 at 22:23
  • I tried installing scipy using pip, however, it gave the error. I did not save error command but a following error is when I install ffpyplayer using pip: "Command "/home/amy/Downloads/pypy3.6/bin/pypy3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-v6znnl3s/ffpyplayer/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-km515ctc/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-v6znnl3s/ffpyplayer/". – keh Mar 08 '19 at 16:42
  • I successfully installed scipy, but no ffpyplayer and opencv yet. I uploaded ffpyplayer error on the other question, so I will link that [here](https://stackoverflow.com/questions/55111373/error-command-gcc-failed-with-exit-status-1-when-installing-ffpyplayer-linux). – keh Mar 12 '19 at 15:23