{"id":399,"date":"2022-10-21T11:20:07","date_gmt":"2022-10-21T19:20:07","guid":{"rendered":"https:\/\/nramkumar.org\/tech\/?p=399"},"modified":"2022-10-21T11:20:08","modified_gmt":"2022-10-21T19:20:08","slug":"running-fastai-book-locally-on-linux-with-virtualenv","status":"publish","type":"post","link":"https:\/\/nramkumar.org\/tech\/blog\/2022\/10\/21\/running-fastai-book-locally-on-linux-with-virtualenv\/","title":{"rendered":"Running FastAI book locally on Linux with Virtualenv"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Finally got an NVidia 3060 and a new machine that I built now that prices for GPUs are more reasonable. I am running Manjaro on this new machine and one of the reasons for putting it together was to continue working on the FastAI book. Now the recommended approach by the authors is to use cloud GPU providers (Google Collab, Paperspace etc.) which is absolutely the right recommendation for most people. But I also think it is important to have working instructions for those who want a local setup. Here are the instructions that work circa October 2022 for Manjaro Linux + NVidia 3060 w\/ Proprietary NVidia drivers:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create the virtual environment, activate it and change to the fastai directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>virtualenv fastai\nsource fastai\/bin\/activate\ncd fastai<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Install pytorch &#8211; instead of relying on dependency based installation of pytorch, it is best to install pytorch from the pytorch website using the right incantation for your chosen environment. You should go to the <a href=\"https:\/\/pytorch.org\/get-started\/locally\/\">Pytorch install locally page<\/a>, choose your specific configuration and use the command provided in your fastai environment to install pytorch. Here&#8217;s the command for installing pytorch using pip with support for CUDA 11.6:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip3 install torch torchvision torchaudio --extra-index-url https:\/\/download.pytorch.org\/whl\/cu116<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Install fastbook and dependencies<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install fastbook<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Install Jupyter notebook and dependencies,  Jupyter notebook extensions, IPyWidgets<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install notebook\npip install jupyter_contrib_nbextensions\npip install ipywidgets<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Clone the Fastbook git repo<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/fastai\/fastbook<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Change to the Fastbook folder and start your local Jupyter notebook server<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd fastbook\njupyter notebook<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You should be all set and ready to learn how to use fastai + pytorch to build deep learning models in your local setup!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Finally got an NVidia 3060 and a new machine that I built now that prices for GPUs are more reasonable. I am running Manjaro on this new machine and one of the reasons for putting it together was to continue working on the FastAI book. Now the recommended approach by the authors is to use&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[92,93],"tags":[],"class_list":["post-399","post","type-post","status-publish","format-standard","hentry","category-deep-learning","category-fastai"],"_links":{"self":[{"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/posts\/399","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/comments?post=399"}],"version-history":[{"count":1,"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/posts\/399\/revisions"}],"predecessor-version":[{"id":400,"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/posts\/399\/revisions\/400"}],"wp:attachment":[{"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/media?parent=399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/categories?post=399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/tags?post=399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}