screen inside the conda environment doesnt work












10














If I am inside a conda environment which has lets say tensorflow installed and if I go to screen and then python -c "import tensorflow";, it says module not found. However it works well without screen.










share|improve this question
























  • What is the output of which python in both cases? How are you ensuring that conda can be used? Editing .bash_profile?
    – darthbith
    May 29 at 23:28
















10














If I am inside a conda environment which has lets say tensorflow installed and if I go to screen and then python -c "import tensorflow";, it says module not found. However it works well without screen.










share|improve this question
























  • What is the output of which python in both cases? How are you ensuring that conda can be used? Editing .bash_profile?
    – darthbith
    May 29 at 23:28














10












10








10


3





If I am inside a conda environment which has lets say tensorflow installed and if I go to screen and then python -c "import tensorflow";, it says module not found. However it works well without screen.










share|improve this question















If I am inside a conda environment which has lets say tensorflow installed and if I go to screen and then python -c "import tensorflow";, it says module not found. However it works well without screen.







anaconda conda gnu-screen






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 10:00









Vadim Kotov

4,31153247




4,31153247










asked May 29 at 19:49









rgaut

8011018




8011018












  • What is the output of which python in both cases? How are you ensuring that conda can be used? Editing .bash_profile?
    – darthbith
    May 29 at 23:28


















  • What is the output of which python in both cases? How are you ensuring that conda can be used? Editing .bash_profile?
    – darthbith
    May 29 at 23:28
















What is the output of which python in both cases? How are you ensuring that conda can be used? Editing .bash_profile?
– darthbith
May 29 at 23:28




What is the output of which python in both cases? How are you ensuring that conda can be used? Editing .bash_profile?
– darthbith
May 29 at 23:28












3 Answers
3






active

oldest

votes


















19














I have the same problem: I activated one of my conda environments, let's say my_env, and I can use tensorflow in my_env. Then, I go to screen. Here, I can no longer import tensorflow. This is weird because within the screen, I still see my_env activated in "conda env list" or tensorflow listed in "conda list".



One workaround for me was to deactivate that environment before going into screen. After going into screen I activate my_env. Then, I was able to use tensorflow included in that my_env.






share|improve this answer

















  • 6




    Thanks! Turning off env before entering screen worked!
    – MAGx2
    Jul 5 at 16:08










  • Your workaround worked for me as well. It is weird though and this bug should definitely be reported and fixed.
    – BiBi
    Jul 12 at 13:35












  • Excellent! That works the best
    – Dheeraj M Pai
    Nov 29 at 9:28










  • In my case I also needed to create a new screen after deactivating. Detaching, deactivating env and re-attaching didn't work.
    – Mikolaj
    Dec 20 at 11:21



















1














All you need to do is to deactivate the environment before entering screen



source deactivate


Then enter the screen



screen -R my_screen 


Then activate the environment



source activate myenv





share|improve this answer





























    0














    This issues is created by having a line like to following in your $HOME/.bashrc file:



    export PATH=$HOME/anaconda3/bin:$PATH


    When screen starts it will run your .bashrc script again and cause the path to be prepended with another version of $HOME/anaconda3/bin. Even if you activate your virtual environment again in the screen session the shell will end up using the wrong copy of python.



    The recommended way to fix this with Anaconda > 4.4 is to remove the line that sets the path and add the following to your .bashrc file



    . $HOME/anaconda3/etc/profile.d/conda.sh


    This has the additional advantage that you can now activate and deactivate anaconda environments using the conda command. e.g.



    conda activate myenv


    For further information check out https://github.com/conda/conda/blob/master/CHANGELOG.md#440-2017-12-20






    share|improve this answer





















      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',
      autoActivateHeartbeat: false,
      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%2f50591901%2fscreen-inside-the-conda-environment-doesnt-work%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      19














      I have the same problem: I activated one of my conda environments, let's say my_env, and I can use tensorflow in my_env. Then, I go to screen. Here, I can no longer import tensorflow. This is weird because within the screen, I still see my_env activated in "conda env list" or tensorflow listed in "conda list".



      One workaround for me was to deactivate that environment before going into screen. After going into screen I activate my_env. Then, I was able to use tensorflow included in that my_env.






      share|improve this answer

















      • 6




        Thanks! Turning off env before entering screen worked!
        – MAGx2
        Jul 5 at 16:08










      • Your workaround worked for me as well. It is weird though and this bug should definitely be reported and fixed.
        – BiBi
        Jul 12 at 13:35












      • Excellent! That works the best
        – Dheeraj M Pai
        Nov 29 at 9:28










      • In my case I also needed to create a new screen after deactivating. Detaching, deactivating env and re-attaching didn't work.
        – Mikolaj
        Dec 20 at 11:21
















      19














      I have the same problem: I activated one of my conda environments, let's say my_env, and I can use tensorflow in my_env. Then, I go to screen. Here, I can no longer import tensorflow. This is weird because within the screen, I still see my_env activated in "conda env list" or tensorflow listed in "conda list".



      One workaround for me was to deactivate that environment before going into screen. After going into screen I activate my_env. Then, I was able to use tensorflow included in that my_env.






      share|improve this answer

















      • 6




        Thanks! Turning off env before entering screen worked!
        – MAGx2
        Jul 5 at 16:08










      • Your workaround worked for me as well. It is weird though and this bug should definitely be reported and fixed.
        – BiBi
        Jul 12 at 13:35












      • Excellent! That works the best
        – Dheeraj M Pai
        Nov 29 at 9:28










      • In my case I also needed to create a new screen after deactivating. Detaching, deactivating env and re-attaching didn't work.
        – Mikolaj
        Dec 20 at 11:21














      19












      19








      19






      I have the same problem: I activated one of my conda environments, let's say my_env, and I can use tensorflow in my_env. Then, I go to screen. Here, I can no longer import tensorflow. This is weird because within the screen, I still see my_env activated in "conda env list" or tensorflow listed in "conda list".



      One workaround for me was to deactivate that environment before going into screen. After going into screen I activate my_env. Then, I was able to use tensorflow included in that my_env.






      share|improve this answer












      I have the same problem: I activated one of my conda environments, let's say my_env, and I can use tensorflow in my_env. Then, I go to screen. Here, I can no longer import tensorflow. This is weird because within the screen, I still see my_env activated in "conda env list" or tensorflow listed in "conda list".



      One workaround for me was to deactivate that environment before going into screen. After going into screen I activate my_env. Then, I was able to use tensorflow included in that my_env.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered May 30 at 20:30









      jhch

      1993




      1993








      • 6




        Thanks! Turning off env before entering screen worked!
        – MAGx2
        Jul 5 at 16:08










      • Your workaround worked for me as well. It is weird though and this bug should definitely be reported and fixed.
        – BiBi
        Jul 12 at 13:35












      • Excellent! That works the best
        – Dheeraj M Pai
        Nov 29 at 9:28










      • In my case I also needed to create a new screen after deactivating. Detaching, deactivating env and re-attaching didn't work.
        – Mikolaj
        Dec 20 at 11:21














      • 6




        Thanks! Turning off env before entering screen worked!
        – MAGx2
        Jul 5 at 16:08










      • Your workaround worked for me as well. It is weird though and this bug should definitely be reported and fixed.
        – BiBi
        Jul 12 at 13:35












      • Excellent! That works the best
        – Dheeraj M Pai
        Nov 29 at 9:28










      • In my case I also needed to create a new screen after deactivating. Detaching, deactivating env and re-attaching didn't work.
        – Mikolaj
        Dec 20 at 11:21








      6




      6




      Thanks! Turning off env before entering screen worked!
      – MAGx2
      Jul 5 at 16:08




      Thanks! Turning off env before entering screen worked!
      – MAGx2
      Jul 5 at 16:08












      Your workaround worked for me as well. It is weird though and this bug should definitely be reported and fixed.
      – BiBi
      Jul 12 at 13:35






      Your workaround worked for me as well. It is weird though and this bug should definitely be reported and fixed.
      – BiBi
      Jul 12 at 13:35














      Excellent! That works the best
      – Dheeraj M Pai
      Nov 29 at 9:28




      Excellent! That works the best
      – Dheeraj M Pai
      Nov 29 at 9:28












      In my case I also needed to create a new screen after deactivating. Detaching, deactivating env and re-attaching didn't work.
      – Mikolaj
      Dec 20 at 11:21




      In my case I also needed to create a new screen after deactivating. Detaching, deactivating env and re-attaching didn't work.
      – Mikolaj
      Dec 20 at 11:21













      1














      All you need to do is to deactivate the environment before entering screen



      source deactivate


      Then enter the screen



      screen -R my_screen 


      Then activate the environment



      source activate myenv





      share|improve this answer


























        1














        All you need to do is to deactivate the environment before entering screen



        source deactivate


        Then enter the screen



        screen -R my_screen 


        Then activate the environment



        source activate myenv





        share|improve this answer
























          1












          1








          1






          All you need to do is to deactivate the environment before entering screen



          source deactivate


          Then enter the screen



          screen -R my_screen 


          Then activate the environment



          source activate myenv





          share|improve this answer












          All you need to do is to deactivate the environment before entering screen



          source deactivate


          Then enter the screen



          screen -R my_screen 


          Then activate the environment



          source activate myenv






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 29 at 9:30









          Dheeraj M Pai

          15911




          15911























              0














              This issues is created by having a line like to following in your $HOME/.bashrc file:



              export PATH=$HOME/anaconda3/bin:$PATH


              When screen starts it will run your .bashrc script again and cause the path to be prepended with another version of $HOME/anaconda3/bin. Even if you activate your virtual environment again in the screen session the shell will end up using the wrong copy of python.



              The recommended way to fix this with Anaconda > 4.4 is to remove the line that sets the path and add the following to your .bashrc file



              . $HOME/anaconda3/etc/profile.d/conda.sh


              This has the additional advantage that you can now activate and deactivate anaconda environments using the conda command. e.g.



              conda activate myenv


              For further information check out https://github.com/conda/conda/blob/master/CHANGELOG.md#440-2017-12-20






              share|improve this answer


























                0














                This issues is created by having a line like to following in your $HOME/.bashrc file:



                export PATH=$HOME/anaconda3/bin:$PATH


                When screen starts it will run your .bashrc script again and cause the path to be prepended with another version of $HOME/anaconda3/bin. Even if you activate your virtual environment again in the screen session the shell will end up using the wrong copy of python.



                The recommended way to fix this with Anaconda > 4.4 is to remove the line that sets the path and add the following to your .bashrc file



                . $HOME/anaconda3/etc/profile.d/conda.sh


                This has the additional advantage that you can now activate and deactivate anaconda environments using the conda command. e.g.



                conda activate myenv


                For further information check out https://github.com/conda/conda/blob/master/CHANGELOG.md#440-2017-12-20






                share|improve this answer
























                  0












                  0








                  0






                  This issues is created by having a line like to following in your $HOME/.bashrc file:



                  export PATH=$HOME/anaconda3/bin:$PATH


                  When screen starts it will run your .bashrc script again and cause the path to be prepended with another version of $HOME/anaconda3/bin. Even if you activate your virtual environment again in the screen session the shell will end up using the wrong copy of python.



                  The recommended way to fix this with Anaconda > 4.4 is to remove the line that sets the path and add the following to your .bashrc file



                  . $HOME/anaconda3/etc/profile.d/conda.sh


                  This has the additional advantage that you can now activate and deactivate anaconda environments using the conda command. e.g.



                  conda activate myenv


                  For further information check out https://github.com/conda/conda/blob/master/CHANGELOG.md#440-2017-12-20






                  share|improve this answer












                  This issues is created by having a line like to following in your $HOME/.bashrc file:



                  export PATH=$HOME/anaconda3/bin:$PATH


                  When screen starts it will run your .bashrc script again and cause the path to be prepended with another version of $HOME/anaconda3/bin. Even if you activate your virtual environment again in the screen session the shell will end up using the wrong copy of python.



                  The recommended way to fix this with Anaconda > 4.4 is to remove the line that sets the path and add the following to your .bashrc file



                  . $HOME/anaconda3/etc/profile.d/conda.sh


                  This has the additional advantage that you can now activate and deactivate anaconda environments using the conda command. e.g.



                  conda activate myenv


                  For further information check out https://github.com/conda/conda/blob/master/CHANGELOG.md#440-2017-12-20







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 28 at 22:57









                  D Dowling

                  944




                  944






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50591901%2fscreen-inside-the-conda-environment-doesnt-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

                      Florida Star v. B. J. F.

                      Danny Elfman

                      Lugert, Oklahoma