Skip to content

Vendor::check fails: ONNX Runtime release download returns 404 #13

Open

Description

@Pilskalns

On ankane/onnxruntime v0.3.9, running OnnxRuntime\Vendor::check (as a post-install-cmd script) aborts composer install:

> OnnxRuntime\Vendor::check
Downloading ONNX Runtime...
Script OnnxRuntime\Vendor::check handling the post-install-cmd event terminated with an exception

In Vendor.php line 59:
                                                                                                                                                       
  file_get_contents(https://github.com/microsoft/onnxruntime/releases/download/v1.32.0/onnxruntime-linux-x64-1.32.0.tgz): Failed to open stream: HTTP  
   request failed! HTTP/1.1 404 Not Found                                                                                                              

Some searching around suggests github.com/microsoft/onnxruntime has returned 404 since about 18 November 2026, so the release tarballs can't be downloaded.

Environment: Linux x86_64, PHP 8.4.

Activity

  1. PacificBird commented on Nov 24, 2026

    @PacificBird

    In my docker builds to get around this I've removed the Vendor::check from composer.json and added this after the composer install step:

    RUN curl -L -o onnxruntime.nupkg https://www.nuget.org/api/v2/package/Microsoft.ML.OnnxRuntime.Gpu.Linux/1.32.0 && \
        mkdir -p vendor/ankane/onnxruntime/lib/onnxruntime-linux-x64-1.32.0/lib && \
        unzip -j onnxruntime.nupkg "runtimes/linux-x64/native/libonnxruntime.so" -d vendor/ankane/onnxruntime/lib/onnxruntime-linux-x64-1.32.0/lib/ && \
        mv vendor/ankane/onnxruntime/lib/onnxruntime-linux-x64-1.32.0/lib/libonnxruntime.so vendor/ankane/onnxruntime/lib/onnxruntime-linux-x64-1.32.0/lib/libonnxruntime.so.1.32.0 && \
        rm onnxruntime.nupkg
  2. Pilskalns commented on Nov 24, 2026

    @Pilskalns
    Author

    Yes, I'm doing a similar workaround thing from a Laravel project:

            "post-install-cmd": [
                "@php artisan onnx:install --ansi"
            ],
            "post-update-cmd": [
                "@php artisan onnx:install --ansi"
            ],

    And then downloads one time per environment. My choice of source might not be ideal, but I need it only for a tiny feature running tiny face detection model in a picture. This was easy to cook up, pasting for anyones inspiration while more proper source is suggested or found for this.

    If that library source is evasive, maybe it could be a configurable URL source for the ONNX config.

    <?php
    
    declare(strict_types=1);
    
    namespace App\Console\Commands;
    
    use Illuminate\Console\Attributes\Description;
    use Illuminate\Console\Attributes\Signature;
    use Illuminate\Console\Command;
    use Illuminate\Support\Facades\File;
    use Illuminate\Support\Facades\Http;
    use OnnxRuntime\Vendor;
    use ZipArchive;
    
    /**
     * Installs the ONNX Runtime shared library from the official PyPI wheel (a plain zip).
     *
     * Workaround for OnnxRuntime\Vendor::check, which downloads from github.com/microsoft/onnxruntime
     * releases (offline since 2026-11-18). To update: bump the constants to the wheel matching
     * OnnxRuntime\Vendor::VERSION (cp312 manylinux URLs + sha256 from https://pypi.org/pypi/onnxruntime/{version}/json).
     *
     * @codeCoverageIgnore Real download path isn't exercised in tests; the checksum guard is covered by InstallOnnxRuntimeTest.
     */
    #[Signature('onnx:install {--force : Download again even if the library exists}')]
    #[Description('Downloads the ONNX Runtime library (linux x86_64 / aarch64) from PyPI into storage.')]
    class InstallOnnxRuntime extends Command
    {
        public const VERSION = '1.32.0';
    
        /** Wheel URL and sha256 per `php_uname('m')`. */
        public const WHEELS = [
            'x86_64' => [
                'https://files.pythonhosted.org/packages/a3/81/55845186c20cba59f614991f4065dea148e48eeb9749893768c85ce64327/onnxruntime-1.32.0-cp312-cp312-manylinux_2_28_x86_64.whl',
                '99e1074c4b2197accd5073052a465361be17b89c093b8ffb6e6bd8f986c52df8',
            ],
            'aarch64' => [
                'https://files.pythonhosted.org/packages/4a/8f/1e43fb994513c7c7a9c6965272ef89d963c1bd4080993a6267bf913701d1/onnxruntime-1.32.0-cp312-cp312-manylinux_2_28_aarch64.whl',
                'e36c187006e7a7c8b8d6d57f1a209dd63f52430dca6c282b177718ad6b841054',
            ],
        ];
    
        public const WHEEL_ENTRY = 'onnxruntime/capi/libonnxruntime.so.1.32.0';
    
        public static function libraryPath(): string
        {
            return storage_path('app/onnxruntime/libonnxruntime.so.'.self::VERSION);
        }
    
        public function handle(): int
        {
            if (Vendor::VERSION !== self::VERSION) {
                $this->error('ankane/onnxruntime expects ONNX Runtime '.Vendor::VERSION.', this command installs '.self::VERSION.'. Update its constants.');
    
                return self::FAILURE;
            }
    
            $wheel = PHP_OS_FAMILY === 'Linux' ? (self::WHEELS[php_uname('m')] ?? null) : null;
    
            if ($wheel === null) {
                $this->warn('ONNX Runtime install skipped: only linux '.implode(' / ', array_keys(self::WHEELS)).' is supported.');
    
                return self::SUCCESS;
            }
    
            [$wheelUrl, $wheelSha256] = $wheel;
    
            $target = self::libraryPath();
    
            if (File::exists($target) && ! $this->option('force')) {
                $this->info('ONNX Runtime '.self::VERSION.' found.');
    
                return self::SUCCESS;
            }
    
            $this->line('Downloading ONNX Runtime '.self::VERSION.'…');
    
            File::ensureDirectoryExists(dirname($target));
            $wheelFile = $target.'.whl';
    
            try {
                Http::timeout(300)->sink($wheelFile)->get($wheelUrl)->throw();
    
                if (! hash_equals($wheelSha256, hash_file('sha256', $wheelFile))) {
                    $this->error('Checksum mismatch for '.$wheelUrl);
    
                    return self::FAILURE;
                }
    
                $library = $this->extractLibrary($wheelFile);
    
                if ($library === null) {
                    $this->error(self::WHEEL_ENTRY.' not found in the wheel.');
    
                    return self::FAILURE;
                }
    
                File::put($target.'.tmp', $library);
                File::move($target.'.tmp', $target);
            } finally {
                File::delete($wheelFile);
            }
    
            $this->info("ONNX Runtime installed to {$target}");
    
            return self::SUCCESS;
        }
    
        private function extractLibrary(string $wheel): ?string
        {
            $zip = new ZipArchive;
    
            if ($zip->open($wheel) !== true) {
                return null;
            }
    
            $library = $zip->getFromName(self::WHEEL_ENTRY);
            $zip->close();
    
            return $library === false ? null : $library;
        }
    }
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions