1

I'm writing python scripts in vscode and recently I've been having a problem related to imports. Lines of code above imports work and their output is displayed in the terminal:

print("hellow")
import matplotlib.pyplot as plt
import numpy as np
#from scipy.special import erfc
from scipy.linalg import solve

> hellow

Lines of code below the imports are not executed, but no errors are displayed in the terminal!

import matplotlib.pyplot as plt
import numpy as np
#from scipy.special import erfc
from scipy.linalg import solve
print("hellow")

>

I'm guessing there is something wrong with my vscode settings, but why are no errors showing up in the terminal?

Thanks for your help.

Crawdad_Buckwheat
  • 313
  • 1
  • 4
  • 16
  • 4
    I don't think this is related to your vscode settings. Can you identify a specific import that blocks your program (try to put the hello just after the plt import, then np, then solve)? – Th0rgal Nov 17 '20 at 17:37
  • you're right there is something wrong with matplotlib. I can import maplotlib, but when I try to import matplotlib.pyplot then python crashes. This doesn't just happen in vscode. – Crawdad_Buckwheat Nov 17 '20 at 17:58
  • 1
    Could you try that: https://stackoverflow.com/a/53088313/10144963 – Th0rgal Nov 17 '20 at 18:05
  • 1
    @Crawdad_Buckwheat, you can try to uninstall `matplotlib` and reinstall it to see if the problem goes away. – Molly Wang-MSFT Nov 18 '20 at 09:03
  • 1
    Ok, I was able to get around the problem. First I tried uninstalling and reinstalling matplotlib with pip (didn't work). Then I tried installing matplotlib with conda (didn't work). It seems there may be a conflict between my windows 10 and the latest version of numpy or matplotlib. I downgraded to numpy version 1.19.3 and matplotlib 3.1.2 and now things are working again. – Crawdad_Buckwheat Nov 27 '20 at 04:32

0 Answers0