studio-lab-examples
studio-lab-examples copied to clipboard
Allow to reset the entire environment of Studio Lab
Is your feature request related to a problem? Please describe. When the students use the Studio Lab in the lecture, they often forget to create an isolated environment for the lecture, install all the packages to default environment. We can’t delete the default environment, for that reason wasted default environment consume the storage.
Describe the solution you'd like Allow the teachers to guide the students as following.
- Reset the entire environment
- Execute the right procedure from the first.
Describe alternatives you've considered We can rollback the conda environment by #42 . But this procedure only rollback the conda packages, pip packages are not rollbacked.
Additional context (none)
- Please try to deactivate conda env you wish to remove and then remove completely. In below example I am removing env name "playground"
(playground) studio-lab-user@default:~$ conda deactivate (studiolab) studio-lab-user@default:~$ conda remove --name playground --all
This will remove all packages in environment /home/studio-lab-user/.conda/envs/playground:
- Restore/Reset env again with Studio default please use the Yaml file from /opt/amazon/sagemaker/environments/
conda env create -f studiolab.yaml or default.yaml
Hope this helps. A restoration script can be added when Studio env is provisioned to users.
Thanks!
@choudhary-ai Thank you for your comment! I think conda remove only works named environment but not default environement (studio-lab). This feature is for the students who forget to create named environment and already worked in default environment.
https://stackoverflow.com/questions/52830307/conda-remove-all-installed-packages-from-base-root-environment
Do you have the idea that can reset default environment by conda command?
As alternative way, we can reset the environment by the following proceduer (ref #42).
- Check initial version by
conda list –revisions - Restore environment by
conda install –revision n - Delete unnecessary packages by
. conda clean –all
an easier way to reset is coming soon, in the meantime icoxfog417, thanks for those instructions.
Hello you can follow the following steps and run the codes provided herewith in a terminal (you can open a terminal after ) :
After you have done all of this stop your project from sagemaker main dashboard. Open a new project. Now you will get a fresh new notebook with almost all the space available. (You can check available space by running "df -h", take a look at Avail row beside "/home/studio-lab-user").
Note that this process frees us 'almsot' all he space, you may still have 2-3 gb of occupies space. Still d'ont know how to fix it
#1. switch to base conda environment
conda activate base
#2. List all conda environments available in your account
conda list envs
#Take a look at all the conda environments available
#3. Delete all the conda environments except environment named 'base'
conda remove -n "env_name" --all
#4.Delete all subdirectories from user folder
rm -rf /home/studio-lab-user/*
#Restart project/runtime
Dear @yeasin-arafat-rafio, thank you for sharing your knowledge! We complement your instruction based on our implementation knowledge.
- The
#1to#3is enough to reset conda environments. These commands delete the preset environments such asdefault,studiolab,studiolab-safemode, but these are recovered after we restart the project runtime. - The
#4delete the all your files. For that reason, please do not execute this command except you want to delete all of the files you created.