How to fix «fopen(): Filename cannot be empty» when installing with sample data

When installing Magento 2.0 with sample data I got the failure:

Installation is incomplete.
Check the console log for errors before trying again.

In Console Log I see:

Warning: fopen(): Filename cannot be empty in dev/tools/Magento/Tools/SampleData/Helper/Csv/Reader.php on line 64

I first encoutered the failure in 0.74.0-beta7, but for the latest 0.74.0-beta16 it yet not fixed in core.
So I fixed in manually with the following hack.

Magento 2.0 for some reason mangled the first letter of some sample data files.
For example, the name «Catalog/SimpleProduct/products_gear_bags.csv» mangled to «@atalog/SimpleProduct/products_gear_bags.csv».

Therefore, the installer can not find the mangled files by it names.

My quick & dirty fix:

  • File: app/code/Magento/SampleData/Helper/Fixture.php

  • Line: 16

  • What to look for:

    public function getPath($subPath)
    {
        return realpath(__DIR__ . '/../fixtures/' . ltrim($subPath, '/'));
    }
    
  • Replace to:

    public function getPath($subPath)
    {
        $subPath = strtr($subPath, array(
            '@ales' => 'Sales'
            ,'Pales' => 'Sales'
            ,'@undle' => 'Bundle'
            ,'@ownloadable' => 'Downloadable'
            ,'Drouped' => 'Grouped'
            , '@' => 'C'
        ));
        return realpath(__DIR__ . '/../fixtures/' . ltrim($subPath, '/'));
    }