Setup a virtual environment for pip work and conda work











up vote
0
down vote

favorite












OS - Ubuntu 16.04 LTS



I want to setup my machine so I have two virtual environments




  1. For pip

  2. For conda


I want to do this so in one virtual environment I can have all libraries that are installed using pip and in the other I can have all my anaconda work/libraries



For pip and conda both I want to a have Python3.6 as default



How can I do this ?










share|improve this question




























    up vote
    0
    down vote

    favorite












    OS - Ubuntu 16.04 LTS



    I want to setup my machine so I have two virtual environments




    1. For pip

    2. For conda


    I want to do this so in one virtual environment I can have all libraries that are installed using pip and in the other I can have all my anaconda work/libraries



    For pip and conda both I want to a have Python3.6 as default



    How can I do this ?










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      OS - Ubuntu 16.04 LTS



      I want to setup my machine so I have two virtual environments




      1. For pip

      2. For conda


      I want to do this so in one virtual environment I can have all libraries that are installed using pip and in the other I can have all my anaconda work/libraries



      For pip and conda both I want to a have Python3.6 as default



      How can I do this ?










      share|improve this question















      OS - Ubuntu 16.04 LTS



      I want to setup my machine so I have two virtual environments




      1. For pip

      2. For conda


      I want to do this so in one virtual environment I can have all libraries that are installed using pip and in the other I can have all my anaconda work/libraries



      For pip and conda both I want to a have Python3.6 as default



      How can I do this ?







      python python-3.x pip conda virtual-environment






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 9 at 18:45

























      asked Nov 9 at 18:07









      Tanmay Bhatnagar

      4491518




      4491518
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          First, install Miniconda. You can then create an environment where you (try to) only use conda



          > conda create -n conda_only python=3.6
          > conda install -n conda_only numpy ...


          And you can also make your 'pip' environment as a conda env, but then only use pip to install packages. For example,



          > conda create -n pip_only python=3.6 pip
          > source activate pip_only
          > pip install numpy ...


          I don't know your motivation (benchmarking installation times perhaps?), but it should be noted that in practice it's common to mix conda and pip simply because some packages are only on PyPI. Plus, conda recognizes packages installed by pip.






          share|improve this answer





















          • Hey, sorry for the late reply. If I use both pip and conda in the same environment then conda wouldn't pickup libraries installed via pip and vice versa right ?
            – Tanmay Bhatnagar
            Nov 15 at 10:31










          • @TanmayBhatnagar, no that is not correct. Conda will recognize pip-installed packages, and pip will recognize conda-installed python packages (those that install to .../site-packages). They work well together. My typical workflow is to use conda for everything, and I resort to pip only when a package isn't available through conda. Also, conda envs are cheap, so just make some and play around.
            – merv
            Nov 15 at 18:06










          • so do u use the preinstalled pip or did you install pip using conda as well
            – Tanmay Bhatnagar
            Nov 15 at 18:12










          • @TanmayBhatnagar You need a pip installation for each virtual environment, so you install pip via conda for each environment. pip is only a package manager, but conda is both a virtual environment manager and a package manager.
            – merv
            Nov 15 at 18:15












          • the problem i encountered was after activating the conda env i did not install pip using conda and just installed libraries using pip so conda did not pickup the libraries
            – Tanmay Bhatnagar
            Nov 15 at 18:17











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53231169%2fsetup-a-virtual-environment-for-pip-work-and-conda-work%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          First, install Miniconda. You can then create an environment where you (try to) only use conda



          > conda create -n conda_only python=3.6
          > conda install -n conda_only numpy ...


          And you can also make your 'pip' environment as a conda env, but then only use pip to install packages. For example,



          > conda create -n pip_only python=3.6 pip
          > source activate pip_only
          > pip install numpy ...


          I don't know your motivation (benchmarking installation times perhaps?), but it should be noted that in practice it's common to mix conda and pip simply because some packages are only on PyPI. Plus, conda recognizes packages installed by pip.






          share|improve this answer





















          • Hey, sorry for the late reply. If I use both pip and conda in the same environment then conda wouldn't pickup libraries installed via pip and vice versa right ?
            – Tanmay Bhatnagar
            Nov 15 at 10:31










          • @TanmayBhatnagar, no that is not correct. Conda will recognize pip-installed packages, and pip will recognize conda-installed python packages (those that install to .../site-packages). They work well together. My typical workflow is to use conda for everything, and I resort to pip only when a package isn't available through conda. Also, conda envs are cheap, so just make some and play around.
            – merv
            Nov 15 at 18:06










          • so do u use the preinstalled pip or did you install pip using conda as well
            – Tanmay Bhatnagar
            Nov 15 at 18:12










          • @TanmayBhatnagar You need a pip installation for each virtual environment, so you install pip via conda for each environment. pip is only a package manager, but conda is both a virtual environment manager and a package manager.
            – merv
            Nov 15 at 18:15












          • the problem i encountered was after activating the conda env i did not install pip using conda and just installed libraries using pip so conda did not pickup the libraries
            – Tanmay Bhatnagar
            Nov 15 at 18:17















          up vote
          0
          down vote













          First, install Miniconda. You can then create an environment where you (try to) only use conda



          > conda create -n conda_only python=3.6
          > conda install -n conda_only numpy ...


          And you can also make your 'pip' environment as a conda env, but then only use pip to install packages. For example,



          > conda create -n pip_only python=3.6 pip
          > source activate pip_only
          > pip install numpy ...


          I don't know your motivation (benchmarking installation times perhaps?), but it should be noted that in practice it's common to mix conda and pip simply because some packages are only on PyPI. Plus, conda recognizes packages installed by pip.






          share|improve this answer





















          • Hey, sorry for the late reply. If I use both pip and conda in the same environment then conda wouldn't pickup libraries installed via pip and vice versa right ?
            – Tanmay Bhatnagar
            Nov 15 at 10:31










          • @TanmayBhatnagar, no that is not correct. Conda will recognize pip-installed packages, and pip will recognize conda-installed python packages (those that install to .../site-packages). They work well together. My typical workflow is to use conda for everything, and I resort to pip only when a package isn't available through conda. Also, conda envs are cheap, so just make some and play around.
            – merv
            Nov 15 at 18:06










          • so do u use the preinstalled pip or did you install pip using conda as well
            – Tanmay Bhatnagar
            Nov 15 at 18:12










          • @TanmayBhatnagar You need a pip installation for each virtual environment, so you install pip via conda for each environment. pip is only a package manager, but conda is both a virtual environment manager and a package manager.
            – merv
            Nov 15 at 18:15












          • the problem i encountered was after activating the conda env i did not install pip using conda and just installed libraries using pip so conda did not pickup the libraries
            – Tanmay Bhatnagar
            Nov 15 at 18:17













          up vote
          0
          down vote










          up vote
          0
          down vote









          First, install Miniconda. You can then create an environment where you (try to) only use conda



          > conda create -n conda_only python=3.6
          > conda install -n conda_only numpy ...


          And you can also make your 'pip' environment as a conda env, but then only use pip to install packages. For example,



          > conda create -n pip_only python=3.6 pip
          > source activate pip_only
          > pip install numpy ...


          I don't know your motivation (benchmarking installation times perhaps?), but it should be noted that in practice it's common to mix conda and pip simply because some packages are only on PyPI. Plus, conda recognizes packages installed by pip.






          share|improve this answer












          First, install Miniconda. You can then create an environment where you (try to) only use conda



          > conda create -n conda_only python=3.6
          > conda install -n conda_only numpy ...


          And you can also make your 'pip' environment as a conda env, but then only use pip to install packages. For example,



          > conda create -n pip_only python=3.6 pip
          > source activate pip_only
          > pip install numpy ...


          I don't know your motivation (benchmarking installation times perhaps?), but it should be noted that in practice it's common to mix conda and pip simply because some packages are only on PyPI. Plus, conda recognizes packages installed by pip.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 11 at 2:36









          merv

          24.5k671108




          24.5k671108












          • Hey, sorry for the late reply. If I use both pip and conda in the same environment then conda wouldn't pickup libraries installed via pip and vice versa right ?
            – Tanmay Bhatnagar
            Nov 15 at 10:31










          • @TanmayBhatnagar, no that is not correct. Conda will recognize pip-installed packages, and pip will recognize conda-installed python packages (those that install to .../site-packages). They work well together. My typical workflow is to use conda for everything, and I resort to pip only when a package isn't available through conda. Also, conda envs are cheap, so just make some and play around.
            – merv
            Nov 15 at 18:06










          • so do u use the preinstalled pip or did you install pip using conda as well
            – Tanmay Bhatnagar
            Nov 15 at 18:12










          • @TanmayBhatnagar You need a pip installation for each virtual environment, so you install pip via conda for each environment. pip is only a package manager, but conda is both a virtual environment manager and a package manager.
            – merv
            Nov 15 at 18:15












          • the problem i encountered was after activating the conda env i did not install pip using conda and just installed libraries using pip so conda did not pickup the libraries
            – Tanmay Bhatnagar
            Nov 15 at 18:17


















          • Hey, sorry for the late reply. If I use both pip and conda in the same environment then conda wouldn't pickup libraries installed via pip and vice versa right ?
            – Tanmay Bhatnagar
            Nov 15 at 10:31










          • @TanmayBhatnagar, no that is not correct. Conda will recognize pip-installed packages, and pip will recognize conda-installed python packages (those that install to .../site-packages). They work well together. My typical workflow is to use conda for everything, and I resort to pip only when a package isn't available through conda. Also, conda envs are cheap, so just make some and play around.
            – merv
            Nov 15 at 18:06










          • so do u use the preinstalled pip or did you install pip using conda as well
            – Tanmay Bhatnagar
            Nov 15 at 18:12










          • @TanmayBhatnagar You need a pip installation for each virtual environment, so you install pip via conda for each environment. pip is only a package manager, but conda is both a virtual environment manager and a package manager.
            – merv
            Nov 15 at 18:15












          • the problem i encountered was after activating the conda env i did not install pip using conda and just installed libraries using pip so conda did not pickup the libraries
            – Tanmay Bhatnagar
            Nov 15 at 18:17
















          Hey, sorry for the late reply. If I use both pip and conda in the same environment then conda wouldn't pickup libraries installed via pip and vice versa right ?
          – Tanmay Bhatnagar
          Nov 15 at 10:31




          Hey, sorry for the late reply. If I use both pip and conda in the same environment then conda wouldn't pickup libraries installed via pip and vice versa right ?
          – Tanmay Bhatnagar
          Nov 15 at 10:31












          @TanmayBhatnagar, no that is not correct. Conda will recognize pip-installed packages, and pip will recognize conda-installed python packages (those that install to .../site-packages). They work well together. My typical workflow is to use conda for everything, and I resort to pip only when a package isn't available through conda. Also, conda envs are cheap, so just make some and play around.
          – merv
          Nov 15 at 18:06




          @TanmayBhatnagar, no that is not correct. Conda will recognize pip-installed packages, and pip will recognize conda-installed python packages (those that install to .../site-packages). They work well together. My typical workflow is to use conda for everything, and I resort to pip only when a package isn't available through conda. Also, conda envs are cheap, so just make some and play around.
          – merv
          Nov 15 at 18:06












          so do u use the preinstalled pip or did you install pip using conda as well
          – Tanmay Bhatnagar
          Nov 15 at 18:12




          so do u use the preinstalled pip or did you install pip using conda as well
          – Tanmay Bhatnagar
          Nov 15 at 18:12












          @TanmayBhatnagar You need a pip installation for each virtual environment, so you install pip via conda for each environment. pip is only a package manager, but conda is both a virtual environment manager and a package manager.
          – merv
          Nov 15 at 18:15






          @TanmayBhatnagar You need a pip installation for each virtual environment, so you install pip via conda for each environment. pip is only a package manager, but conda is both a virtual environment manager and a package manager.
          – merv
          Nov 15 at 18:15














          the problem i encountered was after activating the conda env i did not install pip using conda and just installed libraries using pip so conda did not pickup the libraries
          – Tanmay Bhatnagar
          Nov 15 at 18:17




          the problem i encountered was after activating the conda env i did not install pip using conda and just installed libraries using pip so conda did not pickup the libraries
          – Tanmay Bhatnagar
          Nov 15 at 18:17


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53231169%2fsetup-a-virtual-environment-for-pip-work-and-conda-work%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine