{"id":1133,"date":"2021-02-02T16:48:08","date_gmt":"2021-02-02T13:48:08","guid":{"rendered":"https:\/\/www.etemkeskin.com\/?p=1133"},"modified":"2021-02-04T11:11:05","modified_gmt":"2021-02-04T08:11:05","slug":"how-to-add-virtual-environment-to-jupyter-notebook-or-jupyter-lab","status":"publish","type":"post","link":"https:\/\/www.etemkeskin.com\/index.php\/2021\/02\/02\/how-to-add-virtual-environment-to-jupyter-notebook-or-jupyter-lab\/","title":{"rendered":"How to Add a Virtual Environment to Jupyter Notebook or Jupyter Lab?"},"content":{"rendered":"\n<p>Jupyter Notebook uses the <strong>IPython kernel<\/strong> developed for jupyter. If we want to add the virtual environment we created on our computer to the Jupyter notebook, we need to do extra operations for this.<\/p>\n\n\n\n<p>First we need to activate our virtual environment.<\/p>\n\n\n\n<p><code>conda activate &lt;my_env_name&gt;<\/code><\/p>\n\n\n\n<p>Then we need to install the <a href=\"https:\/\/github.com\/ipython\/ipykernel\">ipykernel<\/a> package in our virtual environment.<\/p>\n\n\n\n<p><code>pip install --user ipykernel<\/code> <\/p>\n\n\n\n<p>In the last step, we add the virtual environment by writing the following code on command terminal. <\/p>\n\n\n\n<p><code>python -m ipykernel install --user --name=&lt;my_env_name&gt;<\/code><\/p>\n\n\n\n<p><strong>Example: <\/strong> We add our virtual environment named <strong>aws<\/strong> to Jupyter .<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;showPanel&quot;:false,&quot;language&quot;:&quot;Shell&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">conda activate aws\npip install --user ipykernel\npython -m ipykernel install --user --name = aws<\/pre><\/div>\n\n\n\n<p>When we run the above codes, <strong>aws<\/strong> virtual environment is added to Jupyter. <\/p>\n\n\n\n<p>To activate env.  we open the Jupyter Lab. Then we click the <strong>Python 3<\/strong> button on the upper right corner. The screen where we can select the kernel will open.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"227\" height=\"112\" src=\"https:\/\/www.etemkeskin.com\/wp-content\/uploads\/2021\/02\/image-2.png\" alt=\"\" class=\"wp-image-1139\"\/><\/figure>\n\n\n\n<p>I selected the <strong>aws<\/strong> virtual environment from the drop down-box shown like in the picture below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"421\" height=\"221\" src=\"https:\/\/www.etemkeskin.com\/wp-content\/uploads\/2021\/02\/image.png\" alt=\"\" class=\"wp-image-1135\"\/><\/figure>\n\n\n\n<p>We see from the upper right corner that Jupyter&#8217;s kernel has changed after the selection is made.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"513\" height=\"155\" src=\"https:\/\/www.etemkeskin.com\/wp-content\/uploads\/2021\/02\/image-1.png\" alt=\"\" class=\"wp-image-1136\"\/><\/figure>\n\n\n\n<p>Good Luck.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Jupyter Notebook uses the IPython kernel developed for jupyter. If we want to add the virtual environment we created on our computer to the Jupyter notebook, we need to do extra operations for this. First we need to activate our virtual environment. conda activate &lt;my_env_name&gt; Then we need to install the ipykernel package in our [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,4],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Add a Virtual Environment to Jupyter Notebook or Jupyter Lab? - blog website<\/title>\n<meta name=\"description\" content=\"Jupyter Notebook uses the IPython kernel developed for jupyter. If we want to add the virtual environment we created on our computer to the Jupyter notebook, we need to do extra operations for this. First we need to activate our virtual environment.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.etemkeskin.com\/index.php\/2021\/02\/02\/how-to-add-virtual-environment-to-jupyter-notebook-or-jupyter-lab\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Add a Virtual Environment to Jupyter Notebook or Jupyter Lab? - blog website\" \/>\n<meta property=\"og:description\" content=\"Jupyter Notebook uses the IPython kernel developed for jupyter. If we want to add the virtual environment we created on our computer to the Jupyter notebook, we need to do extra operations for this. First we need to activate our virtual environment.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.etemkeskin.com\/index.php\/2021\/02\/02\/how-to-add-virtual-environment-to-jupyter-notebook-or-jupyter-lab\/\" \/>\n<meta property=\"og:site_name\" content=\"blog website\" \/>\n<meta property=\"article:published_time\" content=\"2021-02-02T13:48:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-04T08:11:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.etemkeskin.com\/wp-content\/uploads\/2021\/02\/image-2.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.etemkeskin.com\/#website\",\"url\":\"https:\/\/www.etemkeskin.com\/\",\"name\":\"blog website\",\"description\":\"Etem KESK\\u0130N\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.etemkeskin.com\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"tr\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.etemkeskin.com\/index.php\/2021\/02\/02\/how-to-add-virtual-environment-to-jupyter-notebook-or-jupyter-lab\/#primaryimage\",\"inLanguage\":\"tr\",\"url\":\"https:\/\/www.etemkeskin.com\/wp-content\/uploads\/2021\/02\/image-2.png\",\"contentUrl\":\"https:\/\/www.etemkeskin.com\/wp-content\/uploads\/2021\/02\/image-2.png\",\"width\":227,\"height\":112},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.etemkeskin.com\/index.php\/2021\/02\/02\/how-to-add-virtual-environment-to-jupyter-notebook-or-jupyter-lab\/#webpage\",\"url\":\"https:\/\/www.etemkeskin.com\/index.php\/2021\/02\/02\/how-to-add-virtual-environment-to-jupyter-notebook-or-jupyter-lab\/\",\"name\":\"How to Add a Virtual Environment to Jupyter Notebook or Jupyter Lab? - blog website\",\"isPartOf\":{\"@id\":\"https:\/\/www.etemkeskin.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.etemkeskin.com\/index.php\/2021\/02\/02\/how-to-add-virtual-environment-to-jupyter-notebook-or-jupyter-lab\/#primaryimage\"},\"datePublished\":\"2021-02-02T13:48:08+00:00\",\"dateModified\":\"2021-02-04T08:11:05+00:00\",\"author\":{\"@id\":\"https:\/\/www.etemkeskin.com\/#\/schema\/person\/dcbc30282861ce578b96a79ce8789629\"},\"description\":\"Jupyter Notebook uses the IPython kernel developed for jupyter. If we want to add the virtual environment we created on our computer to the Jupyter notebook, we need to do extra operations for this. First we need to activate our virtual environment.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.etemkeskin.com\/index.php\/2021\/02\/02\/how-to-add-virtual-environment-to-jupyter-notebook-or-jupyter-lab\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.etemkeskin.com\/index.php\/2021\/02\/02\/how-to-add-virtual-environment-to-jupyter-notebook-or-jupyter-lab\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.etemkeskin.com\/index.php\/2021\/02\/02\/how-to-add-virtual-environment-to-jupyter-notebook-or-jupyter-lab\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Ana sayfa\",\"item\":\"https:\/\/www.etemkeskin.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Add a Virtual Environment to Jupyter Notebook or Jupyter Lab?\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.etemkeskin.com\/#\/schema\/person\/dcbc30282861ce578b96a79ce8789629\",\"name\":\"etemkeskin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.etemkeskin.com\/#personlogo\",\"inLanguage\":\"tr\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6af0148b790691ed24ae245fb3dc773b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6af0148b790691ed24ae245fb3dc773b?s=96&d=mm&r=g\",\"caption\":\"etemkeskin\"},\"url\":\"https:\/\/www.etemkeskin.com\/index.php\/author\/etemkeskinyahoo-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/posts\/1133"}],"collection":[{"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/comments?post=1133"}],"version-history":[{"count":28,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/posts\/1133\/revisions"}],"predecessor-version":[{"id":1171,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/posts\/1133\/revisions\/1171"}],"wp:attachment":[{"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/media?parent=1133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/categories?post=1133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/tags?post=1133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}