How to setup a conda/jupyter lab environment for data analysis

The jupyter lab environment is a powerful and popular system to do data analysis. There is a bit of learning curve, but it is a good investment of your time into more advanced subjects later on such as peak fitting and machine learning. By writing the code ourselves, we will get a clear sense how the data is treated in order to derive the interpretations. There are many variants of the python platform, most of which originate from the Anaconda project. Here is the best steps to set it up that I’ve found through the many years using it.

Installation

If you have a Windows machine, install miniforge3 from this website. On a Mac computer, it is easier to use homebrew.

Every time before we start the python environment, we do two things: (1) open a terminal and run a command “conda activate”, and (2) go to the folder where all notebooks are stored, then run “jupyter lab”, which will start a new browser tab.

Supporting Libraries

There are the supporting libraries that we still need to Install within the conda environment (do this after running the “conda activate” command). If the environment is missing libraries, it will throw an error message telling us what is missing: just get those using the command “conda install”. Feel free to explore new libraries because python is an extremely dynamic ecosystem. If there is a question, chances are somebody had already asked about it on internet forums. You will find a solution through Google 90% of the case. This is the best way to learn coding:

  • conda install jupyterlab numpy pandas scipy matplotlib lmfit ipympl nbresuse

Highly recommended additional libraries:

  • conda install nodejs plotly cufflinks-py scikit-learn palettable

Additional libraries for spectral analysis:

pip3 install peakutils

Maintenance

Regularly keep the entire python ecosystem updated using these commands:

conda update —all

conda clean —all

Leave a Reply

Your email address will not be published.