Unable to debug python code in vs code - code gives exception at the import library











up vote
0
down vote

favorite












I have the following python code:



import tensorflow as tf
import numpy as np
import math
import matplotlib.pyplot as plt
import matplotlib.animation as animation

num_house = 160
np.random.seed(42)
house_size = np.random.randint(low=1000, high=3500, size=num_house)


I am trying to debug this python code in visual studio code. I have selected the right configuration (Python: Current File (Integrated Terminal)). I have set my breakpoint on the last line. When i run from the debug console, my code fails giving me a ModuleNotFoundError. But I am able to execute this program in the terminal. How do I debug this code in vs code?










share|improve this question


















  • 1




    What version of Python are you using in the terminal, and what version does vs code use?
    – John Gordon
    Nov 10 at 20:53










  • python version 3.6.7
    – Mahadevan Swamy
    Nov 10 at 20:54












  • They are both that version? You're sure?
    – John Gordon
    Nov 10 at 23:33










  • I saw that there were 2 python versions installed on my machine. so I uninstalled v3.7 and now I am able to debug. Thanks for your help
    – Mahadevan Swamy
    Nov 11 at 15:13















up vote
0
down vote

favorite












I have the following python code:



import tensorflow as tf
import numpy as np
import math
import matplotlib.pyplot as plt
import matplotlib.animation as animation

num_house = 160
np.random.seed(42)
house_size = np.random.randint(low=1000, high=3500, size=num_house)


I am trying to debug this python code in visual studio code. I have selected the right configuration (Python: Current File (Integrated Terminal)). I have set my breakpoint on the last line. When i run from the debug console, my code fails giving me a ModuleNotFoundError. But I am able to execute this program in the terminal. How do I debug this code in vs code?










share|improve this question


















  • 1




    What version of Python are you using in the terminal, and what version does vs code use?
    – John Gordon
    Nov 10 at 20:53










  • python version 3.6.7
    – Mahadevan Swamy
    Nov 10 at 20:54












  • They are both that version? You're sure?
    – John Gordon
    Nov 10 at 23:33










  • I saw that there were 2 python versions installed on my machine. so I uninstalled v3.7 and now I am able to debug. Thanks for your help
    – Mahadevan Swamy
    Nov 11 at 15:13













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have the following python code:



import tensorflow as tf
import numpy as np
import math
import matplotlib.pyplot as plt
import matplotlib.animation as animation

num_house = 160
np.random.seed(42)
house_size = np.random.randint(low=1000, high=3500, size=num_house)


I am trying to debug this python code in visual studio code. I have selected the right configuration (Python: Current File (Integrated Terminal)). I have set my breakpoint on the last line. When i run from the debug console, my code fails giving me a ModuleNotFoundError. But I am able to execute this program in the terminal. How do I debug this code in vs code?










share|improve this question













I have the following python code:



import tensorflow as tf
import numpy as np
import math
import matplotlib.pyplot as plt
import matplotlib.animation as animation

num_house = 160
np.random.seed(42)
house_size = np.random.randint(low=1000, high=3500, size=num_house)


I am trying to debug this python code in visual studio code. I have selected the right configuration (Python: Current File (Integrated Terminal)). I have set my breakpoint on the last line. When i run from the debug console, my code fails giving me a ModuleNotFoundError. But I am able to execute this program in the terminal. How do I debug this code in vs code?







python






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 10 at 20:51









Mahadevan Swamy

727




727








  • 1




    What version of Python are you using in the terminal, and what version does vs code use?
    – John Gordon
    Nov 10 at 20:53










  • python version 3.6.7
    – Mahadevan Swamy
    Nov 10 at 20:54












  • They are both that version? You're sure?
    – John Gordon
    Nov 10 at 23:33










  • I saw that there were 2 python versions installed on my machine. so I uninstalled v3.7 and now I am able to debug. Thanks for your help
    – Mahadevan Swamy
    Nov 11 at 15:13














  • 1




    What version of Python are you using in the terminal, and what version does vs code use?
    – John Gordon
    Nov 10 at 20:53










  • python version 3.6.7
    – Mahadevan Swamy
    Nov 10 at 20:54












  • They are both that version? You're sure?
    – John Gordon
    Nov 10 at 23:33










  • I saw that there were 2 python versions installed on my machine. so I uninstalled v3.7 and now I am able to debug. Thanks for your help
    – Mahadevan Swamy
    Nov 11 at 15:13








1




1




What version of Python are you using in the terminal, and what version does vs code use?
– John Gordon
Nov 10 at 20:53




What version of Python are you using in the terminal, and what version does vs code use?
– John Gordon
Nov 10 at 20:53












python version 3.6.7
– Mahadevan Swamy
Nov 10 at 20:54






python version 3.6.7
– Mahadevan Swamy
Nov 10 at 20:54














They are both that version? You're sure?
– John Gordon
Nov 10 at 23:33




They are both that version? You're sure?
– John Gordon
Nov 10 at 23:33












I saw that there were 2 python versions installed on my machine. so I uninstalled v3.7 and now I am able to debug. Thanks for your help
– Mahadevan Swamy
Nov 11 at 15:13




I saw that there were 2 python versions installed on my machine. so I uninstalled v3.7 and now I am able to debug. Thanks for your help
– Mahadevan Swamy
Nov 11 at 15:13

















active

oldest

votes











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%2f53243290%2funable-to-debug-python-code-in-vs-code-code-gives-exception-at-the-import-libr%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243290%2funable-to-debug-python-code-in-vs-code-code-gives-exception-at-the-import-libr%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