OpenMP error on PHP 8.2 · Issue #64 · CodeWithKyrian/transformers-php · GitHub
Skip to content

OpenMP error on PHP 8.2 #64

Open
Open

Description

@timwhitlock

System Info

Running on my Mac Mini (M2 chip) macOS Sonoma (14.6.1).

This occurs in PHP 8.2, but PHP 8.3 seems unaffected.

PHP Version

8.2.19

Environment/Platform

  • Command-line application
  • Web application
  • Serverless
  • Other (please specify)

Description

OMP: Error #15: Initializing libomp.dylib, but found libomp.dylib already initialized.

OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://openmp.llvm.org/

Abort trap: 6

Reproduction

$e = Codewithkyrian\Transformers\Pipelines\pipeline (
    task: Codewithkyrian\Transformers\Pipelines\Task::Embeddings,
    modelName: 'Xenova/all-MiniLM-L6-v2',
);
$e( 'Hello World', normalize: true, pooling: 'mean');

Activity

  1. CodeWithKyrian commented on Aug 29, 2024

    @CodeWithKyrian
    Owner

    Which version of the package are you running with?

  2. timwhitlock commented on Aug 29, 2024

    @timwhitlock
    ContributorAuthor

    Sorry, I should have said. I'm currently on 0.5.1, but I noticed it when upgrading from 0.4.4 (which seems unaffected) to 0.5.0 Also happens on current main branch.

    It's possible there's some problem with the FFI extension in my PHP 8.2 setup, but I just recompiled and upgraded to PHP 8.2.22. Same problem.

    As mentioned, there's no problem under my PHP 8.3 setup, so the issue will go away for me. I thought it was worth reporting anyway.

  3. cappuc commented on Sep 2, 2024

    @cappuc

    I had the same problem but with php 8.3.
    After some tests I found that disabling imagick extension fixed the problem.

  4. timwhitlock commented on Sep 2, 2024

    @timwhitlock
    ContributorAuthor

    I can confirm that my PHP 8.2 environment has imagick installed, but my 8.3 env does not!

  5. CodeWithKyrian commented on Sep 4, 2024

    @CodeWithKyrian
    Owner

    I have tried for a couple of days now to reproduce the problem on my device and I haven't been able to. I have imagick installed and enabled for both PHP 8.2 and 8.3 on my MacBook Air M1 and I still haven't been able to hit the error.

    Is there any more relevant information you could give me to experiment further on my end like how you installed PHP and imagick?

  6. cappuc commented on Sep 5, 2024

    @cappuc

    I installed the extension from https://github.com/shivammathur/homebrew-extensions not with pecl

  7. timwhitlock commented on Sep 5, 2024

    @timwhitlock
    ContributorAuthor

    I installed the imagemagick library via Homebrew (7.1.1-38). I compiled the imagick PHP extension (3.7.0) from source (downloaded from PECL). These are all the latest versions.

    I'm out of my depth here, but happy to provide any info you need, or try things / recompile things.

  8. Toflar commented on Aug 20, 2025

    @Toflar

    I can reproduce that as well. Also using https://github.com/shivammathur/homebrew-extensions.
    libomp is apparently a dependency of imagick. For PHP 8.3 for example, you can run brew deps shivammathur/extensions/imagick@8.3 to see the dependencies and there, libomp is part of the list 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions