Python IDE Setup
Summary Almost all professionals use some sort of IDE to write, debug and test their code on. Data Scientists and Machine Learning experts are no different. While there are a whole host of choices, we will focus on just a couple. Feel free to pick any IDE you feel comfortable with.
Visual Studio Code
Developed by Microsoft and available for free in both Windows and Mac environment, Visual studio code is a good editor for Python. Go to Visual Studio Code and click on the download link. Your download should start automatically. Double click the executable and you should be able to install Visual Studio code with the Wizard pretty easily.
Select a folder where you want all your files to be, say create a demo folder in your Documents folder. In Visual studio code, open that folder and you can now start creating python files.
Give it a name hello_world.py
As you can see already, this is much better than IDLE.
It has line numbers, a neatly organized file structure ( on the left ), syntax highlighting and of course much more. To execute the file, right click and select Run Python File in Terminal in the context menu.
You can see the file getting executed and see the results in the in-built terminal.
Visual Studio Code is a generic IDE built for a variety of programming languages. To enable it specifically to the needs of python ( like python syntax highlighting etc ), you have to install the python extension. Click on the Settings wheel on the left bottom corner and select Extensions.
type in Python and select the Python package.
Click on install to install the Python extension.
You can either restart Visual Studio Code or click on Reload to Activate button and you should be all set for basic python programming in visual studio code.
And by the way, we like the dark theme. You can very well have any theme you like. Go to File -> Preferences -> Color Theme
and select any theme you like.
Sublime text is another popular text editor. It is free for evaluation but you would have to buy it. The one key advantage of sublime text is that it is blazing fast. Download Sublime Text editor here. Installing it is just as easy as visual studio code. Enabling the packages ( like extensions in Visual studio code ) is just as easy. We will not go into the details here.
Jupyter notebook is a very interesting IDE. In fact it is not an IDE – but more of a teaching/learning/sharing tool. Jupyter is used extensively in the data science world to illustrate research results – and as a learner you should know how to install and run Jupyter files. We will be using Jupyter extensively throughout this course. Once you have python installed, installing Jupyter is very easy.
Go to the command prompt and type in
pip install jupyter
once installed, type in
This should start a jupyter notebook on your default browser in the directory where you started the command. Just make sure you don’t close the command window.
jupyter is best installed with Anaconda installation ( That is the recommended approach ), but you can do it this way as well.
This also shows the power of pip , the default python package manager. More on this later.
Jupyter lab is the next version of Jupyter notebook. It has a better UI than the regular Jupyter notebook. Installing it is just as easy.
pip install jupyterlab
To run jupyter lab, go to the directory where you want to write your code, just type in
And this is the interface that you see.
Click on File -> New -> notebook or click on the Python 3 notebook icon. A new .ipynb file will be created and ready to go.
You can start your “Hello World” program here as well.
And you see the program output right there.
Let’s write our first real program on Visual Studio code in the next section.
Google’s colab is another popular option to run your programs on the cloud. Click here to go to Google’s colab URL. Click on File-New Python 3 Notebook.
Make sure you are connected to a run-time.
And that’s it, you can start working on your Python code.