{"id":379,"date":"2019-09-21T23:30:13","date_gmt":"2019-09-21T23:30:13","guid":{"rendered":"https:\/\/carson.fenimorefamily.com\/?p=379"},"modified":"2019-09-21T23:30:15","modified_gmt":"2019-09-21T23:30:15","slug":"installing-pytorch-torchvision-on-centos7","status":"publish","type":"post","link":"https:\/\/carson.fenimorefamily.com\/?p=379","title":{"rendered":"Installing pytorch\/torchvision on centos7"},"content":{"rendered":"\n<p>The installation command shown on  <a href=\"http:\/\/ https:\/\/pytorch.org\/get-started\/locally\/ \">pytorch.org<\/a>   didn&#8217;t quite work for me on centos7.  Instead of using the anaconda installer provided on pytorch, I just used the yum-provided conda:<\/p>\n\n\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nyum install conda\n<\/pre>\n\n\n<p>However when i went to run the command as specified I got the following error:<\/p>\n\n\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n~$ conda install pytorch torchvision cudatoolkit=10.0 -c pytorch\n\nNoBaseEnvironmentError: This conda installation has no default base environment. Use\n'conda create' to create new environments and 'conda activate' to\nactivate environments.\n\n<\/pre>\n\n\n<p>It seems the problem is that pytorch is assuming you&#8217;ve set up a working conda environment &#8211; which i had not.  You can work around this by simply naming the environment (I suppose you could also have made a base environemnt, but I decided to save that adventure for another day).  The following did work for me:<\/p>\n\n\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nconda create -n pytorch pytorch torchvision matplotlib cudatoolkit=10.0 -c pytorch\n<\/pre>\n\n\n<p>Note I also added matplotlib as I was following pytorch examples that requires it.  Also, I found I could run any pytorch example by directly referencing the conda environment, instead of activating it and then running the script, as follows:<\/p>\n\n\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n~\/.conda\/envs\/pytorch\/bin\/python3.7 train.py\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>The installation command shown on pytorch.org didn&#8217;t quite work for me on centos7. Instead of using the anaconda installer provided on pytorch, I just used the yum-provided conda: However when i went to run the command as specified I got the following error: It seems the problem is that pytorch is assuming you&#8217;ve set up &hellip; <a href=\"https:\/\/carson.fenimorefamily.com\/?p=379\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Installing pytorch\/torchvision on centos7<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-379","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/posts\/379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=379"}],"version-history":[{"count":1,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/posts\/379\/revisions"}],"predecessor-version":[{"id":380,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/posts\/379\/revisions\/380"}],"wp:attachment":[{"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}