Setting up Conda in a Windows Environment

With the excitement around ChatGPT and similar LLM's recently (along with the privacy concerns about sending your prompts to an independent, private org), I've been tinkering with local versions of LLM's. Those that use python programs often require Conda, especially if you're running them on a GPU. Getting this set up is a bit harder than I expected, so here's a quick guide to setting up a Conda environment on Windows.

  1. First, download the installer for Miniconda. (The full Anaconda installer is very big, and you don't need all that.) The link can be found here.

  2. After that's downloaded, go ahead and install. I'd recommend installing for all user accounts if you can.

  3. Once that is installed, you'll need to add it to your system's path variable. Go to System Properties (you may have to look this up through the Windows Search Bar) –> Environment Variables –> System Variables. Select “Path”, then click the “Edit” button. On the next screen, click “New”, select the new entry, then “Browse”. Assuming you installed at the default location, you want to choose “C:\ProgramData\miniconda3\Scripts”. Once that is selected, click “OK” to all of the open menus.

  4. Open a command window as an administrator (one option is Windows Search Bar, type “cmd”, then select “Run as Administrator” in the option that pops up). At the command line, use the command “conda init”. This is a one-time command to set up conda commands on your command window. Once that runs, close the command window, then open another one (you don't need to be administrator this time). Now it's time to create your conda environment!

  5. Use the command “conda create —prefix <location>”, where <location> is the place on your hard drive where you'd like the conda environment to be created (like “C:\Users\MyName\conda”). You will be referencing this location in the future when using this environment.

  6. Once this environment is created, activate it with the command “conda activate <location>”, where <location> is the hard drive location used on the previous step.

  7. Now, you can install all of the cool stuff you need in your environment. See this page for a starting reference. To force the conda environment to use all the cool stuff you just installed, you may need to use the command SET PYTHONPATH="F:\...path...\...to...\...your...\...conda-install...".

  8. If you need to get out of the environment, you can either close your command window or use the command “conda deactivate”. When you want to use it again in the future, just use the command “conda activate <location>”.

Good luck!

Written by Dulany Weaver. Copyright 2022-2024. All rights reserved.