The easiest thing to do as you start to play with your new system is to muck up your Windows/Unix environment. You do this by installing and uninstalling packages that, over time, began to conflict with each other. This can take the form of wrong dependencies cropping up, to entire PATHs to necessary commands not working.
i.e:> The term '<whatever>' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
THIS LEADS TO YOUR PROGRAMS NOT WORKING – At this point, there’s really nothing left to do but reinstall.
Let’s avoid that:
This is where miniconda comes in. Miniconda creates “virtual environments” that allow for installations that don’t affect the rest of the system. For instance: perhaps your base environment is running Python 2 but you have an app that requires Python 3.10.6 ( a very common requirement). IF you install it on your base package then it will conflict with Python 2 and mess things up. So instead, you create a “conda” mini environment and install Python 3.10.6 into that.
IT’S IMPORTANT THAT YOU KEEP YOUR BASE ENVIRONMENT CLEAN
Okay, so here’s the down and dirty:
- Download the latest miniconda. You can also type: pip install miniconda however, I suggest you use the installer and place it in your C: folder –>
C:\miniconda
- During the installation, follow the suggested options
- Once it is installed, two things will happen:
a new command prompt will be created that uses the “conda” command. Pin it to your taskbar
your PATH environment will be modified so you can use the “conda” command from your new cmd prompt - open up the new command prompt and create a new environment
conda create --name newenv
This will create a new environment for you to install your app in (change “newenv” to whatever). Even packages that have been installed on the base environment will not be accessible. It’s like a sandbox.
Often you need to use a particular python version. Here’s how you can shortcut both a creation and python install.
conda create --name newenv python==3.10.6
Once the conda environment creation process completes, you have to ACTIVATE it
activate newenv
From here you can begin to install packages(you can use either conda or pip.. more on this later).
Notice that you can specify an exact version (otherwise it’s the latest in the repo).
pip install tensorflow / conda install tensorflow
pip install git / conda install git
pip install python==3.10.6
etc...
To uninstall packages
pip uninstall tensorflow / conda uninstall tensorflow
pip uninstall git / conda uninstall git
etc...
to remove an environment and/or start over
conda remove -n myenv --all
Leave a Reply