Skip to content

Building with pip wheel fails from repeated patch application #314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
uSpike opened this issue Apr 8, 2020 · 0 comments · Fixed by #315
Closed

Building with pip wheel fails from repeated patch application #314

uSpike opened this issue Apr 8, 2020 · 0 comments · Fixed by #315

Comments

@uSpike
Copy link
Contributor

uSpike commented Apr 8, 2020

Expected behaviour

pip wheel path/to/opencv-python should work the same as python setup.py bdist_wheel

Actual behaviour

pip wheel https://github.com/skvark/opencv-python@34#egg=opencv-python fails because patches are applied multiple times. The patch command is run each time setup.py main() is called, and pip wheel calls setup.py multiple times.

Steps to reproduce

On a system that applies patches (currently sys.platform == 'darwin' or sys.platform.startswith('linux') and not x64), run pip wheel https://github.com/skvark/opencv-python#egg=opencv-python. The resultant output:

  ERROR: Command errored out with exit status 1:
   command: /home/me/src/piwheels/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-6he24q5u/setup.py'"'"'; __file__='"'"'
/tmp/pip-req-build-6he24q5u/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code,
 __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-oeddjr7s
       cwd: /tmp/pip-req-build-6he24q5u/
  Complete output (21 lines):
<snip>
    ['python/cv2[^/]*%(ext)s' % {'ext': re.escape(sysconfig.get_config_var('SO'))}],
  patching file opencv/3rdparty/openexr/IlmImf/ImfSystemSpecific.cpp
  Reversed (or previously applied) patch detected!  Assume -R? [n]
  Apply anyway? [n]
  Skipping patch.
  4 out of 4 hunks ignored -- saving rejects to file opencv/3rdparty/openexr/IlmImf/ImfSystemSpecific.cpp.rej
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-req-build-6he24q5u/setup.py", line 398, in <module>
      main()
    File "/tmp/pip-req-build-6he24q5u/setup.py", line 160, in main
      subprocess.check_call("patch -p0 < patches/patchOpenEXR", shell=True)
    File "/home/me/.pyenv/versions/3.8.2/lib/python3.8/subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command 'patch -p0 < patches/patchOpenEXR' returned non-zero exit status 1.

I would suggest updating setup.py to only patch when "bdist_wheel" in sys.argv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant