Issues in Jupyter Notebook

Options
Swapnali
Swapnali Registered Posts: 38 ✭✭✭✭
edited July 16 in Setup & Configuration

I am developing a python code for the use cases. I have changed the Jupyter notebook environment from python 2 to python 3. However, I am getting errors for any python code even for simple commands like "python3 --version" and "%pylab inline".

I am getting errors like

NameError: name 'python3' is not defined

and for "%pylab inline"

ModuleNotFoundError: No module named 'matplotlib'

Kindly help us to solve this

Best Answer

  • Clément_Stenac
    Clément_Stenac Dataiker, Dataiku DSS Core Designer, Registered Posts: 753 Dataiker
    Answer ✓
    Options

    Hi,

    If you write in a notebook cell python3 --version, it tries to execute that as Python code, but that's not valid Python code, hence the python3 is not defined

    If you want to get the output of a shell command, you need to use !python3 --version (note the additional ! which means shell command in Jupyter).

    For your pylab inline issue, it is because you have not installed the matplotlib package in your code env. %pylab inline is a shortcut for loading a lot of common packages, matplotlib being one of them. Simply go to the settings of your code env, add matplotlib and Save & Update

Setup Info
    Tags
      Help me…