Skip to content
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

opencv in wexflow #85

Closed
contisummer opened this issue Sep 25, 2024 · 6 comments
Closed

opencv in wexflow #85

contisummer opened this issue Sep 25, 2024 · 6 comments
Assignees

Comments

@contisummer
Copy link

contisummer commented Sep 25, 2024

hello, aelassas , I build success in vs2022 on windows 10 as dll file. but when I run it in wexflow on ubuntu 22, an error . Here is the error log:
2024-09-25 10:00:30.066 INFO - [mycrop / 1] Workflow started - Instance Id: 0d88583d-fa4e-44b4-9c91-6e0efb1ce80e
2024-09-25 10:00:30.073 INFO - [mycrop / 1] [FilesLoader] Loading files...
2024-09-25 10:00:30.073 INFO - [mycrop / 1] [FilesLoader] File loaded: /opt/wexflow/WexflowTesting/ImagesSrcMyTask/image1.jpg
2024-09-25 10:00:30.073 INFO - [mycrop / 1] [FilesLoader] Task finished.
2024-09-25 10:00:30.091 ERROR - An error occured while running the workflow. Error: {id: 176, name: mycrop, enabled: True, launchType: Trigger}
System.IO.FileNotFoundException: Could not load file or assembly 'OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099'. The system cannot find the file specified. File name: 'OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099' at Wexflow.Tasks.MyTask.MyTask.Run() at Wexflow.Core.Workflow.RunTask(Task task) in //src/netcore/Wexflow.Core/Workflow.cs:line 1396 at Wexflow.Core.Workflow.RunSequentialTasks(IEnumerable1 tasks, Boolean& success, Boolean& warning, Boolean& error) in /_/src/netcore/Wexflow.Core/Workflow.cs:line 1431 at Wexflow.Core.Workflow.StartSync(String startedBy, Guid instanceId, Boolean& resultWarning, List1 restVariables) in //src/netcore/Wexflow.Core/Workflow.cs:line 1095.

How to intergrate opnecvsharp into wexflow8.3 ? Please help me. Thank you.

@aelassas aelassas self-assigned this Sep 25, 2024
@aelassas
Copy link
Owner

OpenCVSharp runtime for Ubuntu 22.04 is not available. So you cannot make it work on Ubuntu 22.04.

But you can make it work on Ubuntu 18.04:

  1. Add OpenCvSharp4 and OpenCvSharp4.runtime.ubuntu.18.04-x64 packages to your custom task.
  2. Run: dotnet publish .\Wexflow.Tasks.MyNetCoreTask\Wexflow.Tasks.MyNetCoreTask.csproj --runtime ubuntu.18.04-x64 --configuration Release --force --output .\output (Replace Wexflow.Tasks.MyNetCoreTask with your custom task name)
  3. Copy/Paste Wexflow.Tasks.MyNetCoreTask.dll, OpenCvSharp.dll, libOpenCvSharpExtern.so and other dependencies from .\output to /opt/wexflow/Wexflow.Server
  4. Go to: cd /opt/wexflow/Wexflow.Server
  5. Run: ldd libOpenCvSharpExtern.so
  6. Install missing libraries
  7. Restart the server: sudo systemctl restart wexflow.service
  8. Save & Run your custom workflow

@contisummer
Copy link
Author

OpenCVSharp runtime for Ubuntu 22.04 is not available. So you cannot make it work on Ubuntu 22.04.

But you can make it work on Ubuntu 18.04:

  1. Add OpenCvSharp4 and OpenCvSharp4.runtime.ubuntu.18.04-x64 packages to your custom task.
  2. Run: dotnet publish .\Wexflow.Tasks.MyNetCoreTask\Wexflow.Tasks.MyNetCoreTask.csproj --runtime ubuntu.18.04-x64 --configuration Release --force --output .\output (Replace Wexflow.Tasks.MyNetCoreTask with your custom task name)
  3. Copy/Paste Wexflow.Tasks.MyNetCoreTask.dll, OpenCvSharp.dll, libOpenCvSharpExtern.so and other dependencies from .\output to /opt/wexflow/Wexflow.Server
  4. Go to: cd /opt/wexflow/Wexflow.Server
  5. Run: ldd libOpenCvSharpExtern.so
  6. Install missing libraries
  7. Restart the server: sudo systemctl restart wexflow.service
  8. Save & Run your custom workflow

OK. Thank you. I will try it .If any result, I will info you.

@contisummer
Copy link
Author

contisummer commented Sep 28, 2024

hello, aelassas. I do it follow your steps. but when it at step 3, it not have the file libOpenCvSharpExtern.so in .\output folder ,is there any wrong ? where to find the libOpenCvSharpExtern.so file?

@contisummer
Copy link
Author

hello, aelassas. I do it follow your steps. but when it at step 3, it not have the file libOpenCvSharpExtern.so in .\output folder ,is there any wrong ? where to find the libOpenCvSharpExtern.so file?

I find it, :)). But when run it,it has error:
the log as below:
Logs
2024-09-28 14:27:08.784 INFO - [mycrop / 1] Workflow started - Instance Id: 551d7121-2aa2-48c1-b9bb-bdc934a54c9b
2024-09-28 14:27:08.797 INFO - [mycrop / 1] [FilesLoader] Loading files...
2024-09-28 14:27:08.798 INFO - [mycrop / 1] [FilesLoader] File loaded: /opt/wexflow/WexflowTesting/ImagesSrcMyTask/image1.jpg
2024-09-28 14:27:08.798 INFO - [mycrop / 1] [FilesLoader] Task finished.
2024-09-28 14:27:08.801 INFO - [mycrop / 1] [MyTask] Cropping images...
2024-09-28 14:27:09.159 INFO - [mycrop / 1] [MyTask] The image /opt/wexflow/WexflowTesting/ImagesSrcMyTask/image1.jpg was cropped -> /opt/wexflow/Wexflow/Temp/176/2024-09-28/14-27-08-797/image1.jpg
2024-09-28 14:27:09.260 ERROR - [mycrop / 1] [MyTask] An error occured while cropping images: Can't initialize GTK backend
2024-09-28 14:27:09.261 INFO - [mycrop / 1] [MyTask] Task finished
2024-09-28 14:27:09.261 INFO - [mycrop / 1] [FilesMover] Moving files...
2024-09-28 14:27:09.263 ERROR - [mycrop / 1] [FilesMover] Destination file /opt/wexflow/WexflowTesting/ImagesDestMyTask/image1.jpg already exists.
2024-09-28 14:27:09.263 ERROR - [mycrop / 1] [FilesMover] Destination file /opt/wexflow/WexflowTesting/ImagesDestMyTask/image1.jpg already exists.
2024-09-28 14:27:09.263 INFO - [mycrop / 1] [FilesMover] Task finished.
2024-09-28 14:27:09.263 INFO - [mycrop / 1] Workflow finished.

I try the error, but not solved. Could you give me some idea ?Thank you very much.

@aelassas
Copy link
Owner

2024-09-28 14:27:09.260 ERROR - [mycrop / 1] [MyTask] An error occured while cropping images: Can't initialize GTK backend

GTK backend can't be initialized when X11 forwarding is disabled.

Follow instructions here .

@contisummer
Copy link
Author

yes , aelassas . I enable the X11 follow your instruction.
ForwardX11 yes
ForwardX11Trusted yes

But now it have another error: GTK backend is not available
Log as below:
2024-10-07 11:18:37.832 INFO - [mycrop / 1] Workflow started - Instance Id: a2a53370-ecc3-48b6-b816-ffca68357e94
2024-10-07 11:18:37.838 INFO - [mycrop / 1] [FilesLoader] Loading files...
2024-10-07 11:18:37.838 INFO - [mycrop / 1] [FilesLoader] File loaded: /opt/wexflow/WexflowTesting/ImagesSrcMyTask/image1.jpg
2024-10-07 11:18:37.838 INFO - [mycrop / 1] [FilesLoader] Task finished.
2024-10-07 11:18:37.838 INFO - [mycrop / 1] [MyTask] Cropping images...
2024-10-07 11:18:37.857 INFO - [mycrop / 1] [MyTask] The image /opt/wexflow/WexflowTesting/ImagesSrcMyTask/image1.jpg was cropped -> /opt/wexflow/Wexflow/Temp/176/2024-10-07/11-18-37-838/image1.jpg
2024-10-07 11:18:37.864 ERROR - [mycrop / 1] [MyTask] An error occured while cropping images: GTK backend is not available
2024-10-07 11:18:37.865 INFO - [mycrop / 1] [MyTask] Task finished
2024-10-07 11:18:37.865 INFO - [mycrop / 1] [FilesMover] Moving files...
2024-10-07 11:18:37.865 ERROR - [mycrop / 1] [FilesMover] Destination file /opt/wexflow/WexflowTesting/ImagesDestMyTask/image1.jpg already exists.
2024-10-07 11:18:37.865 ERROR - [mycrop / 1] [FilesMover] Destination file /opt/wexflow/WexflowTesting/ImagesDestMyTask/image1.jpg already exists.
2024-10-07 11:18:37.865 INFO - [mycrop / 1] [FilesMover] Task finished.
2024-10-07 11:18:37.865 INFO - [mycrop / 1] Workflow finished.

could you give me some advice ? Thank you very much.

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

No branches or pull requests

2 participants