How to setup Conda environment with Jupyter Notebook ?
Anaconda is open-source software that contains Jupyter, spyder, etc that are used for large data processing, data analytics, heavy scientific computing. Anaconda works for R and python programming language. Spyder(sub-application of Anaconda) is used for python. Opencv for python will work in spyder. Package versions are managed by the package management system called conda.
Before going to setup coding environment let us see how to install Anaconda
- Go to any browser and search for anaconda repo
- Find the anaconda repository website https://repo.anaconda.com/
- Then find the anaconda installers and click on view all installers.
- Find the latest installer and click on that installer.
- After clicking on the installer the browser automatically downloads the installer.
- Run the installer as administrator.
- Follow the installation steps to install anaconda.
Setup anaconda coding environment with jupyter notebook:
- After finishing installation go to start and find the anaconda prompt.
- Run anaconda prompt as administrator.
- After opening anaconda command prompt type conda create -n environment_name
- With this command, we can create a coding environment for us.
- To activate the environment execute conda activate environment_name
- To install jupyter notebook in the environment we need to execute the command conda install jupyter notebook
- After executing the above command we will be in the environment.
- Now we can install jupyter notebook in the environment using the command pip install jupyter
- Now we can install our required packages like pandas, numpy, matplotlib, sklearn, scikit-learn, seaborn, etc.
- To install the above-mentioned packages use the command pip install package_name .
- Some packages won’t install using the pip command. Then use conda instead of pip.
- After installing required libraries and packages type the command jupyter notebook.
- The above command will open the jupyter notebook.
- If jupyter notebook does not open automatically copies the link which is displaying on the screen. The link looks like localhost:8888/?token or 127.0.0.1:8888/?token and pastes on the search bar of any browser.
- Thus, you can redirect to jupyter notebook home page.
- There we can create a folder for us, and we can work on our project.
- To create a new python3 file go to the right side of navigation and find a new button and click on it.
- You can find few options. Select python3.
- Open the new python3 file to execute python programs.
- We can install new packages directly in the python3 file by using the pip command.