top of page
justthetipwithdani

How to use Anaconda to Switch Between Python Versions using VENV's


Here is how to create virtual environments for different versions of python which is very much needed if you're going to play with a bunch of things in GitHub.



If you installed stable diffusion via automatic 1111 like most of the normal Ai Art world you might have noticed the newest version of python 3.11 doesn't work with Stable Diffusion. Yes, I'm telling your automatic 1111 currently doesn't work with version 3.11 which is ironic given the version names kind of rhyme. Any who! You must use version 3.10.6 as stated on the Automatic 1111 GitHub site.


If you use Anaconda, you might be happy to know that you can switch between python environments using virtual environments.

Below is a screen shot from the official python website on how to switch between python 2 and 3 environments. (Click on the pic to go to the website)


I did things a little differently. I named my VENV (virtual environment) to StableD and made python=3.10.6 which is the version Automatic 1111 likes.

Creating your Environment!


Press Y and Enter to say yes...

Done Installing!


Now all's you got to do is type Conda activate StableD and press enter, and it will activate that 3.10 environment. If you didn't notice the install of this environment actually told you how to do that. You may have noticed I left the word "conda" out, most of the time anaconda will fix that for you.


Activating


You have to pay close attention to the (StableD) in parenthesis. If you do not see this, you did not activate this virtual environment.



Deactivating

To deactivate just type conda deactivate and it will close any active VENV. You can also close the window and it will eventually deactivate itself.


So that's it. The only downside if you have another thing to open when you try and run stable diffusion so I wouldn't recommend jumping between environments unless you had a reason. In my case, I have multiple GitHub tools that all require diff versions of python so Anaconda makes sense to me because I can easily create an environment for that specific tool. For example, my Thin-Plate-Spline-Motion Modeling required version 3.9.0 so I have an environment for that, and I run it before I try and use that tool. If you start testing extensively in GitHub, you will need this or... you can just install a new version of python every time.



6 views0 comments

Comments


bottom of page