studio-lab-examples icon indicating copy to clipboard operation
studio-lab-examples copied to clipboard

Allow to reset the entire environment of Studio Lab

Open icoxfog417 opened this issue 3 years ago • 6 comments

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.

  1. Reset the entire environment
  2. 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)

icoxfog417 avatar Feb 24 '22 05:02 icoxfog417

  1. 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:

  1. 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 avatar Feb 26 '22 05:02 choudhary-ai

@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?

icoxfog417 avatar Feb 27 '22 06:02 icoxfog417

As alternative way, we can reset the environment by the following proceduer (ref #42).

  1. Check initial version by conda list –revisions
  2. Restore environment by conda install –revision n
  3. Delete unnecessary packages by . conda clean –all

icoxfog417 avatar Apr 12 '22 22:04 icoxfog417

an easier way to reset is coming soon, in the meantime icoxfog417, thanks for those instructions.

MicheleMonclova avatar May 18 '22 04:05 MicheleMonclova

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

nollok-official avatar Nov 24 '22 16:11 nollok-official

Dear @yeasin-arafat-rafio, thank you for sharing your knowledge! We complement your instruction based on our implementation knowledge.

  • The #1 to #3 is enough to reset conda environments. These commands delete the preset environments such as default , studiolab , studiolab-safemode, but these are recovered after we restart the project runtime.
  • The #4 delete the all your files. For that reason, please do not execute this command except you want to delete all of the files you created.

icoxfog417 avatar Nov 29 '22 01:11 icoxfog417