Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


python_virtual_environments

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
python_virtual_environments [2023/05/01 13:53] juckinspython_virtual_environments [2023/08/10 11:35] (current) juckins
Line 16: Line 16:
  
   * (Accept license agreement and all the suggested default choices)   * (Accept license agreement and all the suggested default choices)
 +  * Note that if you do not want conda's base environment to be activated upon startup, run the following:
  
-  ~/miniconda3/bin/conda create -n testenv -c conda-forge time numpy requests pygrib netCDF4 scipy+  conda config --set auto_activate_base false 
 + 
 +Now try creating a test conda environment: 
 + 
 +  cd ~/miniconda3/envs 
 +  ~/miniconda3/bin/conda create -n testenv2_3.11.4 -c conda-forge time numpy requests pygrib netCDF4 scipy python=3.11.4
   ~/miniconda3/bin/conda init bash   ~/miniconda3/bin/conda init bash
  
Line 29: Line 35:
   conda deactivate   conda deactivate
      
-Other useful commmands: +Other useful commmands (see https://www.python.org/downloads/ for specific python versions) 
-  conda create -n testenv2 python=3.11.3 (with specific version of python)+  conda create -n testenv2 python=3.11.3
   conda activate testenv2   conda activate testenv2
      
Line 44: Line 50:
   conda remove --name myenv --all (remove a conda environment)   conda remove --name myenv --all (remove a conda environment)
  
-__Running a cron under conda (is this correct)__+__Running a cron under conda (is this correct?)__
   21 15 * * * conda activate testenv2; /path/to/script.py > /tmp/output.txt (just call the correct version of python in first line of the script)   21 15 * * * conda activate testenv2; /path/to/script.py > /tmp/output.txt (just call the correct version of python in first line of the script)
  
python_virtual_environments.1682963612.txt.gz · Last modified: 2023/05/01 13:53 by juckins