Just installed python-tensorflow from AUR
So I've always been interested in machine learning and I came across this youtube video on Tensorflow and wanted to try it myself.
Tensorflow is not in the official repos but fear not, there is a python-tensorflow package in AUR which I simply
pacaur -S python-tensorflow
...
Or not, because I ran out of memory. I have only 4GB of RAM which is plenty for my day to day use but tensorflow wanted more. I closed all the memory hungry processes on my laptop and try again, still no luck.
Then I remembered that swap is sort of ram and on SSD it's even reasonably fast. So I make a 16GB swapfile and swapon it, run pacaur -S python-tensorflow and off it goes, happily compiling, occasionally freezing my laptop but churning on. At maximum it was taking all of my 4GB of RAM and 8GB of swap.
But I was successful! Why waste money on more expensive laptop with more memory when I need that much RAM only occasionally.
tl;dr: Some men just want to watch the world burn.
About this post
- Posted
- Archived
- Score
- 8 · 100% up
- Kind
- Text
- ID
- 6922xc
16 comments
I recently set up OpenCV (a computer vision framework) on my RasPi and that instead took a lot of storage space while compiling it. This kind of frameworks are quite heavy to compile... Nice idea using a swapfile!
Yeah, but swapfile trick only works with modern SSDs.
... albeit slow, swap works on HDD. How do you think swap was working before SSDs became mainstream?
...and not on
btrfssadfacewhy didn't you install it this way?
You think that would avoid the compiling? If yes, how?
Also I hate installing system wide packages that my package manager doesn't know about. I could always use --user which I do occasionally, but there's still that compilation issue.
edit. Apparently precompiled binaries. Maybe I'll use virtualenv and install tensorflow there next time I want to experiment.
Yes, I just installed it now
There is
virtualenvfor this exact problempython-pip(for python3) orpython2-pipvirtualenvwithpip:pip install virtualenv(for python2 it'spip2 install virtualenv)mkdir test && cd test && virtualenv env. This will installpythonandpipin that workspace. You can read more heresource env/bin/activatepip install tensorflow, this is the pip from the virtualenv. check the output ofwhich pythonandwhich pipI've had some issues because of the python packages installed with pacman, so I use virtualenv now, also as far as I know this is the recomended way to work with python.
Edit: also notice that some editors support
virtualenv, just google how to setup your editor with it. If you use VSCode, just add:"python.pythonPath": "${workspaceRoot}/env/bin/python"to your workspace settingsEdit2: tested this and it works!
When I come across this (usually the intel compiler suite package does it), I just wget the PKGBUILD and do it outside of pacaur. I might have to try this next time.
I don't think running outside pacaur would have saved me 8GB of ram
So it wasnt compiling with a scratch directory in /tmp ? The actual compilation requires 8GB?
Well, it's now in the official repos, which is nice
Uploaded one day after my post, that was fast!
Well, the package has existed in the AUR for more, before the 1.0 release. I have been building it on 2 machines (including one similar to yours with 4 GB RAM: a 4 GB swap partition was enough for me though). It looks like it was very popular so it was mainlined shortly after the 1.1 release