Python Multiprocessing error: AttributeError: module ‘__main__’ has no attribute ‘__spec__’

The problem is not with the code / Python 3.6, it is with Spyder. After some investigation I found that the code runs fine when executed in an external system terminal but not when run in Spyder’s IPython console. I was able to dump the contents of spec and assign them to a variable that … Read more

Interactive Python: cannot get `%lprun` to work, although line_profiler is imported properly

To make %lprun work, you need to load the extension into your session, using this command: In [1]: %load_ext line_profiler Check out this notebook to see some examples that use the magic. Besides, if you are working with Spyder, there is also a third-party line_profiler plugin, which you can find here.

ValueError: Unknown projection ‘3d’ (once again)

You will have to import Axes3D to enable the 3d plotting in matplotlib. The official tutorials on 3d plotting can be found here. So the correct imports and code would look like import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # <— This is important for 3d plotting #your code fig = plt.figure() ax = … Read more

Is there any way(by setting or extension) to view and use variables in VSCODE other than setting breakpoints. likes Spyder?

In VSCode, there are two ways to view script variables besides setting breakpoints: Open the “OUTLINE” column in the lower left corner of VSCode: Right-click “Run Current File in Python Interactive Window” in the script, and select “Show variables active in jupyter kernel“: