This guide helps you to create a one click solution to activate your conda environment and open Jupyter lab. Windows only tho.
In my previous post long time ago, I explained the same but in this post, I have improved and reduced steps to do the exact same thing.
I just found the even more easier way to activate your conda environment and open Jupyter lab.
Step 1. Go to `C:\Users\your_user_name\Anaconda3\Scripts`
Step 2. Create a duplicate of `activate.bat` and rename it, lets say, `activate_julab.bat`
Step 3. Open `activate_julab.bat` and append following line at end:
@CALL jupyter lab
a command to run jupyter lab….
Step 4. Now lets call this activate_julab.bat using another bat/batch file from wherever you want. For example,
I have in my C:\ drive, a new bat file (named Run_My_Env.bat) and the contents of that bat file are two lines as following:
CD “path_to_your_project_where_you_want_to_open_your_jupyter_lab”
%windir%\System32\cmd.exe “/K” C:\Users\your_user_name\Anaconda3\Scripts\activate_julab.bat My_Env
Explanation
First line changes directory to a new path. It could be the path where you working project resides. Second line run activate_julab.bat in cmd with argument My_Env passed. (My_Env: name of your conda environment)
Step 5. (Optional) Make shortcut of your new bat file Run_My_Env.bat, maybe send it to your desktop so that every day you turn up to work and open your computer, there is a shortcut icon waiting for you to be clicked and voila You are running Jupyter Lab in your desired conda environment in just one click. :)
Feel free to change icons of shortcut to make it easily differentiable from other environment activators… if you have like million of them on your desktop like me.
Happy Engineering!