Chat on WhatsApp

Setting up Data Science Environment in Windows Under VSCode

To start with a data science project, systems needs to be set up with right environment. Data science environment is set up by configuring different applications

 · 3 min read




Are you tired of drowning in a sea of data, desperately seeking insights that will propel your business forward? Look no further! Welcome to our data science blog, where we unleash the power of cutting-edge data science technologies, algorithms and unleash the hidden potential of your data.


To  start data science project, your system to be set up with right environment. Data science environment is configured with number of applications, packages which might be complicated if you are beginner or unfamiliar with data science development.


But fortunately, the complications can be avoided with the use of VSCode and it is free to use.

VSCode is comes with tons of powerful features support application development and it is capable to integrate with various applications.

By following multiple setup steps, you are able to use the Anacoda platform using VSCode and from single window. Imagine how handy, to work from single window in an IDE like VSCode to edit files, connecting to servers(GPUs), manage version control, use Jupyter Notebook.


First Step:

First step is to install Anaconda. You may download latest Anaconda version here


By installing Anaconda means that your system, have Jupyter Notebook and some python data science packages ready to use.


In Windows operating system, installation of Anaconda can be confirmed by checking icons of Anaconda Navigator, Anaconda Prompt, Jupyter Notebook from start menu.



Second Step:

If you concerned about conflicts among different data science projects, It is ideal to set up separate virtual environment. New virtual environment can be created from anaconda prompt or even from Anaconda navigator.

Search Anaconda prompt in start menu. This step is not mandatory, however separate virtual environment is always recommended as you might need to work on different projects with various libraries and different library versions.

if you prefer work on default base env, you can do so by skipping this stage.


You can check the default, virtual environment list by type command

conda env list


To create separate environment, 

conda create --name linear_regression project python=3.11.0


Above command will download necessary packages and createvirtual environment named 'linear_regression_project'. You may choose python version based on your preferences.



Activate the virtualenv:


conda activate linear_regression_project


List the available packages on this virtual environment can be listed by command


conda list


Step Three: VSCode

You may download VSCode and install or open VSCode shortcut from Anacoda Navigator Homepage

If you prefer to download VSCode, check their website here


Step Four: Create Your project folder and open in VSCode


You may create new project folder anywhere on the system or open existing project folder in VSCode.


Step Five: Install python extension in VSCode

VSCode support development in multiple languages and to support python development, install python extension.

To install python in VSCode, search 'python' by clicking extension icon on left bar in VSCode and install python extension



Step Six: select python virtual environment for your Project

In VSCode select shortcut SHIFT+CTRL+P to see pop up box, where type 'Python: Select Interpreter'



By that selection of environment, python interpreter with the env name will show in the bottom-left of the Status Bar:



Step Seven: Configure Python and Conda in VScode


Open new terminal by pressing terminal or press SHIFT+CTRL+ + command to open new terminal, to set the terminal.

Choose powershell in windows, if you would like to use linux commands or you may leave default setting.

Once you have chosen python interpreter, virtualenv automatically activated in new open terminal via conda activate



Terminal is used for running python scripts.

In case getting any error related to python or conda, check system path for python and conda and make sure right path is set in system environment variable.


Step Eight: Install Jupyter Package and and choose environment


Finally install the Jupyter package with following command


pip install jupyter

or

conda install -c conda-forge jupyter


Once installed, you are able to create blank Jupyter Notebook with ipynb extension

Click SHIFT+CTRL+P and type blank Jupyter Notebook to create new jupyter notebook file.


Jupyter server created in short time with its environment as the one you chosen already for the project.

If no environment is selected automatically, press CTRL+SHIFT+P and search for "Select Interpreter to start Jupyter server"

Then chose the environment.

Once all the steps done, now you are ready to code.


Overall, Anaconda simplifies the process of setting up, managing, and sharing data science environments, and provides a rich ecosystem of tools and libraries that are essential for data scientists. These features contribute to its popularity and make it a great choice for data scientists.

Happy coding.


No comments yet.

Add a comment
Ctrl+Enter to add comment