-1

Let's say a person has some python code which uses a lot of packages like pytorch, lightning, CUDA etc and it compiles and runs on that person's machine.

If another person wants to join, what's the best way to give that person a list of which specific package versions to use so that it compiles on his machine too? Because of dependency hell, it might not work if that new person manually pip installs every package used in the code.

So I want the person whose code compiles to give the new person a file which the new person can execute in some way and install the right versions of each package etc. What's the way to achieve this?

math_guy
  • 111
  • 4
  • 5
    The most straightforward way is using a `requirements.txt` file to specify external libraries and their version https://learnpython.com/blog/python-requirements-file/ – alec_djinn Apr 20 '23 at 13:14

1 Answers1

1

The person whose code compiles actually can give a file of requirements. He can run the following command to get a 'requirement.txt' file that can be shared.

 pip list --format=freeze > requirements.txt

The person who wish to install the dependencies can then run the following command:

 pip install -r requirements.txt
G.Kaviraj
  • 66
  • 2