-2

In the huggingface github it is written:

You should install Transformers in a virtual environment. If you're unfamiliar with Python virtual environments, check out the user guide.

Create a virtual environment with the version of Python you're going to use and activate it.

Now, if you want to use Transformers, you can install it with pip. If you'd like to play with the examples, you must install it from source.

Why should it be installed in a virtual python environment? What are the advantages of doing that rather than installing it on python as is?

Community
  • 1
  • 1
user2182857
  • 718
  • 8
  • 20
  • 7
    Using virtual environments per project is generally a good practice in Python, nothing special about that library. – Klaus D. Jan 04 '20 at 09:44
  • 5
    This is true of basically *all* libraries. You want to work in virtual envs for all Python work you do, so that you don't screw with the system install of Python, and so that you don't have a big global list of hundreds of packages that have nothing to do with each other and that may have conflicting requirements. – alkasm Jan 04 '20 at 09:48
  • 2
    Apart from that, using a virtual environment for your project also means that it is easily deployable to a different machine, because all the dependencies are self-contained and can be packaged up in one go. – Tomalak Jan 04 '20 at 10:21

1 Answers1

4

Summing up the comments in a community answer:

It's not needed to install huggingface Transformers in a virtual environment, it can be installed just like any other package though there are advantages of using a virtual environment, and is considered a good practice.

  • You want to work in virtual envs for all Python work you do, so that you don't interfere the system install of Python, and so that you don't have a big global list of hundreds of packages that have nothing to do with each other and that may have conflicting requirements.

  • Apart from that, using a virtual environment for your project also means that it is easily deployable to a different machine, because all the dependencies are self-contained and can be packaged up in one go.

More in this answer

kHarshit
  • 11,362
  • 10
  • 52
  • 71
  • I would add that you will often have multiple different projects with different package version requirements. Isolating your environments for each project becomes almost essential in this case. – Jack Vial Mar 21 '21 at 16:39