Tensorflow compiling from source failed on Amazon Ubuntu

RoboForex – Professional services on Forex market

Reference Links:



To compile tensorflow on my Amazon AWS server, I always get some strange error. No answer got upon enormous googling.

I installed swig which is needed. However, I don’t know if this matters.

sudo apt install swig

Otherwise, maybe it just a simple running out of memory problem.

Try reducing number of parallel builds by passing ‘–local_resources 2048,.5,1.0’, which would instruct bazel to spawn no more than one compiler process at the time.

bazel build -c opt --jobs 1 --local_resources 2048,0.5,1.0 --verbose_failures --config=cuda //tensorflow/tools/pip_package:build_pip_package

And I added a swap file:


  • Create a swap file, this method is relatively slow.
sudo dd if=/dev/zero of=/swapfile bs=1G count=4


sudo fallocate -l 4G /swapfile
  • Change the mode of the swap file.
  • Activate the swap file.
  • Mount the swap file.
sudo chmod 600 /swapfile

sudo mkswap /swapfile

sudo swapon /swapfile

If you want to use this swap file on boot, append this on /etc/fstab file:

/swapfile none swap sw 0 0


Posted in Uncategorized | Leave a comment

Google Adsense

Posted in Uncategorized | Leave a comment

Hello world!

Welcome to WordPress.com. After you read this, you should delete and write your own post, with a new title above. Or hit Add New on the left (of the admin dashboard) to start a fresh post.

Here are some suggestions for your first post.

  1. You can find new ideas for what to blog about by reading the Daily Post.
  2. Add PressThis to your browser. It creates a new blog post for you about any interesting  page you read on the web.
  3. Make some changes to this page, and then hit preview on the right. You can always preview any post or edit it before you share it to the world.
Posted in Uncategorized | 1 Comment