While installing the sample data for Magento 2, I encounter this error.

[Magento\Setup\SampleDataException] Error during sample data installation: Class Magento\Sales\Model\Service\OrderFactory does not exist

Can anyone guide me in proper direction? Any help will be appreciated.

class doesnt exists

3 Answers 3


Finally.. I got the sample data installed and working. I had installed the developer branch of magento2 setup, which was not stable.

I then, downloaded the stable master version and the setup is now installed :)


Magento 2 should auto-generate any missing factory methods like that, but maybe the setup process does not do so.

You can run the code generation process manually, which might fix the issue. From the directory shown in your screenshot, run:

php magento setup:di:compile

Then try the installation again.

Note: you can remove the failed attempt with php magento setup:uninstall.

  • Thanks for the reply. I tried to compile using php magento setup:di:compile from the bin directory. But it gives me these set of exceptions. imgur.com/msLcR8D Aug 11, 2015 at 5:15

First of all, currently sample data is comparable with stable (master branch) version of Magento2. If you want to use it on developer branch, you need install magento from master branch with sample data and then update magento to developer branch version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.