Skip to content

Instantly share code, notes, and snippets.

@ibrezm1
Last active September 28, 2022 02:44
Show Gist options
  • Save ibrezm1/6ccfd1b6ff964e7ee4622ecec824bb04 to your computer and use it in GitHub Desktop.
Save ibrezm1/6ccfd1b6ff964e7ee4622ecec824bb04 to your computer and use it in GitHub Desktop.
Pip file movement to prod servers
# Reference
# https://stackoverflow.com/questions/7300321/how-to-use-pythons-pip-to-download-and-keep-the-zipped-files-for-a-package
mkdir /temp/pypack
pip freeze > requirements.txt
pip download -d /tmp -r requirements.txt
# zip and move te requirements file also so that it can e used on target
zip -r pypack.zip pypack/*
# https://www.linuxfoundation.org/blog/blog/classic-sysadmin-how-to-securely-transfer-files-between-servers-with-scp#:~:text=The%20scp%20tool%20relies%20on,between%20local%20and%20remote%20machines.
scp -r username@server_ip:/path_to_remote_directory local-machine/path
pip install --no-index --find-links="/path/to/downloaded/packages" -r requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment