How to clean the mess of a beginners virtual envirmonet?

For a long time, I have been trying to code. I am following the course and doing it every day.

There is one thing that I am stuck and I don’t see any answers anywhere.
Every time there is a project to do outside codeacadmy I get lost. I have tried coding before so my computer is full of python downloads, old versions of programs, and a confusing virtual enviorment. Then I watch tutorials online and I have sublime and Vscode each one showing different problems when executing.

How can I clean my Mac and set a clean virtual space that I can work with?

I would really appreciate any help.

1 Like

Unfortunately not everything you install comes with a perfect uninstall option so unless you’re paying a lot of attention it’s very easy to wind up in this situation.

There’s two xkcd comics that sum it up, how nice it is to work with Python compared to some languages-

… and then the darker side of working with Python; the Python environment-

Personally I think there are two reasonable options here; one is to install even more tools to supersede the previous mess and look after the whole thing for you (or at least try to). If you’re working with data science (or you just want a slightly simpler tool to manage everything), you could use something like conda. If you follow the instructions when installing then conda should bump itself to the front of your path and you’re safe so long as you don’t look behind the curtain. A second alternative (or perhaps an additional tool) would be pyenv. It is designed specifically to manage multiple installs of Python and it will fiddle with your path itself in order to correctly set a specific version of Python on your path. See the following for a little more info-

Your second major option would be to try and understand just what is going on with your shell environment. A good place to start if you haven’t done it before is the bash introductory course on CC or otherwise. If you can learn the basics of how your shell works you can specify what program you want to run and when; it’s no longer a black box.

What you want to focus on learning in particular would be “environment variables” and the PATH environment variable.

I’d advocate for the second option as I think it’s a worthy time investment. You no longer have to rely on hope that things just work; if it breaks, you can fix it. Plus, you can learn about it and then decide if you’d rather just let something like pyenv manage the whole thing for you. But it’s up to you; if you’re focused on learning the language without interruption then perhaps you’d prefer the quicker options.

2 Likes

Thanks a lot for the answer. I am going to follow with the first option for now.

This really helps a lot!

That’s an excellent resource @tgrtim!

If you’re interested in managing environments for specific coding projects and easily finding out or specifying which version of each package you’re using, I’d recommend using PyCharm. You can create virtual environments that allow you to manage settings and dependencies.