Creating new environments (Nvironments) in Anaconda 3

Asked

Viewed 1,248 times

0

First I apologize if my question is too basic or if it doesn’t make sense to you, I’m still starting my walk in the Python language. To the point, my question is: Why should we create new environments to use Anaconda and only install the packages we will use (pandas, tensorflow, etc.)? Why can’t we do everything in the base (root)? Wouldn’t it be simpler?

inserir a descrição da imagem aqui

I have done online courses that use python, the first thing that instructors do is create a new environment to work. I searched here on the site and on google and did not find anything specifically addressing this issue, the closest was this article: https://medium.freecodecamp.org/why-you-need-python-environments-and-how-to-manage-them-with-conda-85f155f4353c. It says that we do this when we need to use different versions of python. Is this just the explanation or is there another reason? I may have misunderstood, but for me this didn’t make much sense, in the online courses I only use a version of python

  • 1

    I have no idea where all this is coming from. Here I just downloaded Py 3, unpacked it into a little tablet (plus Pyqt) and it works fine. I could do something more complex, but before I have a reason, it’s bullshit. I’ll compare it to linux: I keep more than one server, some are for use on intranet some exposed on the internet, with services running. If I were to follow tutorials I would fill the machine with unnecessary things like Docker etc (which has its use in very specific cases, but is totally superfluous in my scenarios and would only serve to consume resources for no reason) just because of "fashion".

  • 1

    I am not saying that in certain more advanced scenarios it is not interesting to do what you said, but if to start with Py is to complicate so much, I think the philosophy of the thing has died in the nest.

  • 1

    In udemy courses instructors always create a new environment to work with but I never understood why. In my opinion, you can do everything on the basis (root) even, I just wanted to understand if there was some reason behind this that I was not understand. Thank you so much for your help!

  • This last comment at least already explains where the concept comes from :D - I increasingly think that certain courses are classes of "good practices" (if you really understand what are the "good practices" in our business, you will know that it was not a compliment kkk)

1 answer

2


If your question is related to why you have to create virtual environments for python projects (virtualenvs, venv, workon) I think I can summarize it as follows:

  • In the case of Ubuntu, which uses python to render some components of S.O, it is not legal to install packages until you end up deleting packages that are essential to the operation of it (I’ve already done it rs).
  • When creating a virtualenv you encapsulate everything within that environment (python version, Libraries)
  • It turns out to be good practice, even the pycharm IDE encourages you to set up a project to create your virtual Nvironment

In another case, imagine that you have a fully developed application and do not want to make any changes to the libraries you are using, but at the same time start developing another application that requires updated versions of these libraries. What will you do ? That’s where virtualenv comes into play. It creates isolated environments for your python application and allows you to install python libraries in this isolated environment instead of installing them globally.

  • That was my question. It took a while to adapt to virtual environments but now I did. Thank you very much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.