6

Recently I tried to install Magento 2 with sample data and failed. I added the proper package to the composer.json file and when I run composer update it always fails just before finishing downloading:

  - Installing magento/sample-data-media (0.42.0-beta1)
    Downloading: 90%
Fatal error: Out of memory (allocated 652738560) (tried to allocate 556269568 by
tes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Util/
RemoteFilesystem.php on line 175

I set memory_limit in my php.ini file to 2048MB but it didn't help. I checked in command line that it is set correctly:

c:\WT-NMP\WWW\magento_2>php -r "echo ini_get('memory_limit');"
2048M
c:\WT-NMP\WWW\magento_2>php -r "$a = []; while(true) { $a[] = 'a'; }"

Fatal error: Out of memory (allocated 2019033088) (tried to allocate 24 bytes) i
n Command line code on line 1

Does anyone know what the problem might be? Or maybe you know some hacky way to install sample data without Composer?

1
  • This is not exactly linked to Magento but to PHP. I advise you to use a VM for the installation process since it will make things easier. Later today I will publish an article with a step by step on how to achieve this based on github.com/rgranadino/mage2_vagrant.
    – mbalparda
    Commented Dec 23, 2014 at 15:15

4 Answers 4

5

We apologize for the issues. There have been recent problems with sample data that are now resolved.

We just published updates to the procedure. There are two ways to do it:

Install sample data before installing Magento: http://bit.ly/1FIHnVO

Install sample data after installing Magento: http://bit.ly/1HSALaY

Please let us know if you have questions or issues.

2
  • I am trying to follow those instructions but there is no sampledata:install task for bin/magento script
    – Zefiryn
    Commented Oct 16, 2015 at 11:19
  • The procedure has recently changed. If you clone the Magento 2 CE GitHub repo and the Magento 2 sample data repo, you can install sample data using the Magento develop branch. Try this: devdocs.magento.com/guides/v2.0/install-gde/install/web/… Commented Oct 20, 2015 at 10:41
4

I get the same issue. Plus, the download via composer of the sample data takes 2 eternities until it crashes.
Here is what I did.
Download the sample data from here and unzip what you donwload in dev/tools/Magento/Tools/SampleData/.
Then download the media images for the sample data from here and unzip what you download to pub/media.
Then, when installing Magento 2, the "Install sample data" checkbox will be enabled.
But be patient. Installing the sample data will take a while.

3
  • Both links are broken. Any replacements? I ran into the same problem..
    – Timothy
    Commented Oct 11, 2016 at 9:35
  • links broken still? Commented Jan 12, 2017 at 18:13
  • yeah. apparently the links changed. I have no idea to which ones.
    – Marius
    Commented Jan 12, 2017 at 22:24
2

Update your memory_limit! If this setting is too low then you’ll get some unusual problems with your install like freezing at 2% or 96% with no error messages. You can change this globally in WHM or just add the following line to the very top of

public_html or htdocs/index.php:

ini_set(“memory_limit”,”2048M”);

Also set this same line at the top of dev/tools/Magento/Tools/SampleData/install.php

ini_set(“memory_limit”,”2048M”);

I actually set mine to 4096M to be safe.

0

Try to set inline memory limit in the command:

Infinite Memory Limit

php -d memory_limit=-1 bin/magento sampledata:deploy

Setting memory limit 4GB

php -d memory_limit=4G bin/magento sampledata:deploy
1
  • 1
    Thanks for the answer to this question created 6 and a half years ago ;-). Commented Jul 2, 2021 at 12:34

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.