Opened 15 months ago

Closed 14 months ago

Last modified 14 months ago

#66942 closed defect (fixed)

opencv4 @4.6.0_2+contrib extract failure

Reported by: fmw42 (Fred Weinhaus) Owned by: stromnov (Andrey Stromnov)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc: mascguy (Christopher Nielsen)
Port: opencv4

Description (last modified by fmw42 (Fred Weinhaus))

I am on Mac OSX Monterey on M1 Mac (Mini)

I am trying to upgrade my existing ports that I have been using for quite a while.

I have done the sudo port selfupdate. Then upgraded most of my relevant ports. Then tried numerous times to upgrade either opencv4 or py39-opencv4. Other ports that try to upgrade opencv4 also report this error. I keep getting an error:

"Error: Failed to extract opencv4: extract.rename: multiple directories exist in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_opencv4/opencv4/work: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_opencv4/opencv4/work/opencv-opencv-8a18519 /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_opencv4/opencv4/work/opencv-opencv_contrib-5f1f482
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_opencv4/opencv4/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a
bug."

How do I get around this issue. Sorry for my ignorance.

Attachments (3)

macports_opencv4_error.txt (30.7 KB) - added by fmw42 (Fred Weinhaus) 15 months ago.
Error message and list of installed ports
install_opencv4.txt (26.5 KB) - added by fmw42 (Fred Weinhaus) 14 months ago.
python_inpaint_text.py (1.1 KB) - added by fmw42 (Fred Weinhaus) 14 months ago.

Download all attachments as: .zip

Change History (18)

Changed 15 months ago by fmw42 (Fred Weinhaus)

Attachment: macports_opencv4_error.txt added

Error message and list of installed ports

comment:1 Changed 15 months ago by fmw42 (Fred Weinhaus)

Description: modified (diff)

comment:2 Changed 15 months ago by jmroot (Joshua Root)

Cc: stromnov@… stromnov mascguy@… removed
Keywords: Failed to extract opencv4 removed
Owner: set to stromnov
Status: newassigned
Summary: Cannot Upgrade OpenCV4opencv4 @4.6.0_2+contrib extract failure

This inherits extract.rename yes from the github portgroup, but has multiple distfiles with +contrib and does its own renaming.

comment:3 Changed 15 months ago by fmw42 (Fred Weinhaus)

So what do I do to fix it. I am sorry, but I do not understand your comment.

comment:4 Changed 14 months ago by ryandesign (Ryan Carsten Schmidt)

Josh's comment was an explanation to the maintainer of the port (to whom this ticket was assigned) about how to fix it. Wait for the maintainer to fix it.

comment:5 Changed 14 months ago by fmw42 (Fred Weinhaus)

After doing the above, none of my scripts work any more. So I am dead in the water.

It is complaining about importing cv2

Traceback (most recent call last):
  File "/Users/fred/Desktop/tmp.py", line 1, in <module>
    import cv2
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/cv2/python-3.9/cv2.cpython-39-darwin.so, 0x0002): Library not loaded: '/opt/local/lib/libtiff.5.dylib'
  Referenced from: '/opt/local/lib/opencv4/libopencv_imgcodecs.4.6.0.dylib'
  Reason: tried: '/opt/local/lib/libtiff.5.dylib' (no such file), '/usr/local/lib/libtiff.5.dylib' (no such file), '/usr/lib/libtiff.5.dylib' (no such file)

Last edited 14 months ago by fmw42 (Fred Weinhaus) (previous) (diff)

comment:6 Changed 14 months ago by ryandesign (Ryan Carsten Schmidt)

That is a different problem and should be filed in a separate ticket.

comment:7 Changed 14 months ago by fmw42 (Fred Weinhaus)

OK. But would it not be fixed automatically when the "Failed to extract opencv4" original problem was fixed and I could then properly install opencv4?

Last edited 14 months ago by fmw42 (Fred Weinhaus) (previous) (diff)

comment:8 Changed 14 months ago by ryandesign (Ryan Carsten Schmidt)

You seem to be encountering two different problems which will need two separate investigations and two separate fixes. It is nice to have one ticket per problem, that way each ticket can be closed when each problem is fixed, because a single developer may not immediately know how to fix both issues but they may know how to fix one of them.

comment:9 in reply to:  8 Changed 14 months ago by jmroot (Joshua Root)

Replying to ryandesign:

You seem to be encountering two different problems which will need two separate investigations and two separate fixes.

If opencv4 hasn't been upgraded on the reporter's system since before [41000ab0296c57c01f3aba71bcdf5aa52b68ceb3/macports-ports], it would make sense for this to be the result if the other installed ports have since been upgraded.

comment:10 Changed 14 months ago by jmroot (Joshua Root)

Resolution: fixed
Status: assignedclosed

In 56d8249cffda7149c7a3c6df293ceffaf1ecfacf/macports-ports (master):

opencv4: fix extracting with +contrib

Maintainer timeout.

Closes: #66942

comment:11 Changed 14 months ago by fmw42 (Fred Weinhaus)

If I remove the +contrib, should I then be able to update py39-opencv4?

comment:12 Changed 14 months ago by jmroot (Joshua Root)

If you sync the current portfile it should work with or without +contrib.

comment:13 Changed 14 months ago by fmw42 (Fred Weinhaus)

Sorry for my ignorance, but could you explain more about syncing opencv4. I am not that versed in all the features of MacPorts.

I did the self update previous to my attempts to upgrade. Was self update not redundant with port sync? According to the documentation: "The sync action performs a subset of selfupdate. It synchronizes the ports tree, as does selfupdate, but it does not check for MacPorts upgrades. On macOS, unless there is a special reason not to do so, run selfupdate instead"

Last edited 14 months ago by fmw42 (Fred Weinhaus) (previous) (diff)

comment:14 Changed 14 months ago by fmw42 (Fred Weinhaus)

port sync failed

sudo port selfupdate
--->  MacPorts base is already the latest version

port sync
Error: Synchronization of the local ports tree failed doing rsync
port sync failed: Synchronization of 1 source failed
Last edited 14 months ago by fmw42 (Fred Weinhaus) (previous) (diff)

comment:15 Changed 14 months ago by fmw42 (Fred Weinhaus)

I have been successful in upgrading py39-opencv4 +readline, that is, without specifying +contrib. The installation however, seems to be installing opencv4+contrib (perhaps it is packaged in the py39-opencv4). And so perhaps the extra +contrib that I used before (py39-opencv4 +contrib +readling) was the issue. The upgrade shows the following (see the attachment also): "---> INSTALLING OPENCV4 @4.6.0_2+CONTRIB"

However, trying to run a script with the contributed library app cv2.xphoto.inpaint() fails to find cv2.xphoto (see attached script).

python3.9 python_inpaint_text.py
Traceback (most recent call last):
  File "/Users/fred/Desktop/python_inpaint_text.py", line 25, in <module>
    cv2.xphoto.inpaint(img, thresh, result3, cv2.xphoto.INPAINT_FSR_FAST)
AttributeError: module 'cv2' has no attribute 'xphoto'

Am I missing something or misunderstanding the above about contrib being installed?

Last edited 14 months ago by fmw42 (Fred Weinhaus) (previous) (diff)

Changed 14 months ago by fmw42 (Fred Weinhaus)

Attachment: install_opencv4.txt added

Changed 14 months ago by fmw42 (Fred Weinhaus)

Attachment: python_inpaint_text.py added
Note: See TracTickets for help on using tickets.