-1

I have two linux servers, one can be connected to the Internet, and the other can't. I downloaded some libraries using pip install library on a server that can be connected to the Internet, and I want to transfer it to another server. But how to set install paths? And how do I know which files are installed by pip? Or is there a better way to achieve this?

Thanks

Gerrie
  • 736
  • 3
  • 18

2 Answers2

1

I would utilize wheel in this case, which can make packages that you can bring to your offline machine. For example with numpy

pip wheel numpy
Collecting numpy
  Downloading numpy-1.20.2-cp37-cp37m-win_amd64.whl (13.6 MB)
Saved c:\numpy-1.20.2-cp37-cp37m-win_amd64.whl

Then on your other machine copy these wheels and use pip

pip install numpy-1.20.2-cp37-cp37m-win_amd64.whl

You can do a similar thing with requirements.txt to gather a number of wheels at once.

Cory Kramer
  • 114,268
  • 16
  • 167
  • 218
1

I think the easiest thing to do would be to install the modules in a virtual environment, e.g. python3 -m venv .venv followed by your pip install <module> and then copy the entire .venv directory to the remote machine.

Cory Kramer suggests using wheels which a good alternative option too. Either method should work.

dephekt
  • 446
  • 2
  • 9