{"id":559,"date":"2025-04-24T15:39:06","date_gmt":"2025-04-24T07:39:06","guid":{"rendered":"https:\/\/home.miawy.com\/?p=559"},"modified":"2025-04-29T16:37:46","modified_gmt":"2025-04-29T08:37:46","slug":"how-to-export-conda-full-environment-from-source-server-and-restore-to-target-server-if-target-server-unable-to-access-the-internet","status":"publish","type":"post","link":"https:\/\/home.miawy.com\/?p=559","title":{"rendered":"How to Export Conda Full or Delta Environment From Source Server and Restore To Target Server If Target Server Unable To Access the Internet"},"content":{"rendered":"\n<div class=\"wp-block-aioseo-table-of-contents\"><ul><li><a href=\"#aioseo-pack-your-whole-environment-from-source-server\">Pack your whole environment from source server<\/a><ul><li><a href=\"#aioseo-install-conda-pack\">Install conda-pack<\/a><\/li><li><a href=\"#aioseo-pack-and-export-the-whole-environment\">Pack and export the whole environment<\/a><\/li><\/ul><\/li><li><a href=\"#aioseo-upload-your_env-tar-gz-to-target-server\">Upload &#x27;your_env.tar.gz&#x27; to target server<\/a><\/li><li><a href=\"#aioseo-unpack-the-file-and-restore-the-environment\">Unpack the file and restore the environment<\/a><ul><li><a href=\"#aioseo-create-the-directory-of-the-target-environment\">Create the directory of the target environment<\/a><\/li><\/ul><\/li><li><a href=\"#aioseo-activate-and-verify-the-environment\">Activate and verify the environment<\/a><\/li><li><a href=\"#aioseo-update-export\">[Update] Export specified packages along with their dependencies<\/a><ul><li><a href=\"#aioseo-install-pipdeptree\">Install pipdeptree<\/a><\/li><li><a href=\"#aioseo-generate-requirements-txt\">Generate requirements.txt<\/a><\/li><li><a href=\"#aioseo-download-all-packages\">Download all packages<\/a><\/li><\/ul><\/li><\/ul><\/div>\n\n\n\n<p>Usually, we can export Conda environment simply use <strong><em>requirements.txt<\/em><\/strong> or <strong><em>environment.yml<\/em><\/strong>. But if the target server could not access to the Internet, it will be unable to restore the environment completely.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-pack-your-whole-environment-from-source-server\">Pack your whole environment from source server<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-install-conda-pack\">Install conda-pack<\/h3>\n\n\n\n<p>Make sure there is <strong>conda-pack<\/strong>, if not, install one:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"# conda install\nconda install -c conda-forge conda-pack\n\n# or pip install\npip install conda-pack\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\"># conda install<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">conda<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-c<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">conda-forge<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">conda-pack<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># or pip install<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">pip<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">conda-pack<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative\">Bash<\/span><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-pack-and-export-the-whole-environment\">Pack and export the whole environment<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"# E.g., environment name is 'your_env', output environment file name is 'your_env.tar.gz'\nconda pack -n your_env --output your_env.tar.gz\n\n# What if some packages are installed via 'pip install -e', you might need to add '--ignore-editable-packages' as conda-pack might be unable to handle these packages correctly\nconda pack -n your_env --ignore-editable-packages --output your_env.tar.gz\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\"># E.g., environment name is &#39;your_env&#39;, output environment file name is &#39;your_env.tar.gz&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">conda<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">pack<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-n<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">your_env<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">--output<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">your_env.tar.gz<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># What if some packages are installed via &#39;pip install -e&#39;, you might need to add &#39;--ignore-editable-packages&#39; as conda-pack might be unable to handle these packages correctly<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">conda<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">pack<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-n<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">your_env<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">--ignore-editable-packages<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">--output<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">your_env.tar.gz<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative\">Bash<\/span><\/div>\n\n\n\n<p>It takes some time to export the environment file and the size is a bit large.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-upload-your_env-tar-gz-to-target-server\">Upload &#8216;your_env.tar.gz&#8217; to target server<\/h2>\n\n\n\n<p>Use FileZilla or other tools to upload the file to target server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-unpack-the-file-and-restore-the-environment\">Unpack the file and restore the environment<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-create-the-directory-of-the-target-environment\">Create the directory of the target environment<\/h3>\n\n\n\n<p>Usually path of conda environment is like: \/home\/ubuntu\/conda\/envs.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"tar -xzf \/path\/to\/your_env.tar.gz -C \/path\/to\/your\/conda\/envs\n\n# You can use below command to check your conda env path:\nconda env list\n\n# Create the target env directory\n\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCDCAA\">tar<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-xzf<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\/path\/to\/your_env.tar.gz<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-C<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\/path\/to\/your\/conda\/envs<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># You can use below command to check your conda env path:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">conda<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">env<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">list<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># Create the target env directory<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative\">Bash<\/span><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-activate-and-verify-the-environment\">Activate and verify the environment<\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"# Activate environment\nconda activate your_env\n\n# Shoule be able to find all packages from source server\nconda list\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\"># Activate environment<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">conda<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">activate<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">your_env<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># Shoule be able to find all packages from source server<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">conda<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">list<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative\">Bash<\/span><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-update-export\">[Update] Export specified packages along with their dependencies<\/h2>\n\n\n\n<p>From the above method, we can export the complete environment. It is useful when we initiate the environment for the first time. However, after the initial setup, we typically only need to update the newly added packages, rather than reinstalling all of them. <\/p>\n\n\n\n<p>This selective update approach can save time and resources, especially when dealing with large environments with numerous packages.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-install-pipdeptree\">Install pipdeptree<\/h3>\n\n\n\n<p>We use pipdeptree to extract packages and their dependencies:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"pip install pipdeptree\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCDCAA\">pip<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">pipdeptree<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative\">Bash<\/span><\/div>\n\n\n\n<p>Export dependency tree:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"pipdeptree &gt; dependency_tree.txt\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCDCAA\">pipdeptree<\/span><span style=\"color: #D4D4D4\"> &gt; <\/span><span style=\"color: #CE9178\">dependency_tree.txt<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative\">Bash<\/span><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-generate-requirements-txt\">Generate requirements.txt<\/h3>\n\n\n\n<p>Extract all packages and their dependencies, and save them to requirements.txt:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"def parse_dependency_tree(file_path):\n    &quot;&quot;&quot;\n    Extract packages from dependency_tree.txt, and generate requirements.txt\n    &quot;&quot;&quot;\n    with open(file_path, 'r', encoding='utf-8') as file:\n        lines = file.readlines()\n\n    # will not store duplicated packages\n    dependencies = set()\n    for line in lines:\n        # remove head and tail spaces\n        line = line.strip()\n        # Extract packages and version numbers\n        # e.g. tensorboard==2.19.0\n        if '==' in line and 'installed' not in line:\n            package, version = line.split('==')\n            dependencies.add(f&quot;{package.strip()}=={version.strip()}&quot;)\n        # e.g. numpy [required: &gt;=1.12.0, installed: 1.23.5]\n        elif 'installed:' in line:\n            package_info = line.split('[')[0].strip().split(' ')[-1]\n            version = line.split('installed: ')[1].strip(']')\n            dependencies.add(f&quot;{package_info}=={version}&quot;)\n\n    # save to requirements.txt \n    with open('requirements.txt', 'w', encoding='utf-8') as req_file:\n        for dep in dependencies:\n            req_file.write(f&quot;{dep}\\n&quot;)\n\n    print(&quot;requirements.txt done.&quot;)\n\nparse_dependency_tree('dependency_tree.txt')\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">def<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">parse_dependency_tree<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">file_path<\/span><span style=\"color: #D4D4D4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #CE9178\">&quot;&quot;&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #CE9178\">    Extract packages from dependency_tree.txt, and generate requirements.txt<\/span><\/span>\n<span class=\"line\"><span style=\"color: #CE9178\">    &quot;&quot;&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">with<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">open<\/span><span style=\"color: #D4D4D4\">(file_path, <\/span><span style=\"color: #CE9178\">&#39;r&#39;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">encoding<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #CE9178\">&#39;utf-8&#39;<\/span><span style=\"color: #D4D4D4\">) <\/span><span style=\"color: #C586C0\">as<\/span><span style=\"color: #D4D4D4\"> file:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        lines = file.readlines()<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #6A9955\"># will not store duplicated packages<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    dependencies = <\/span><span style=\"color: #4EC9B0\">set<\/span><span style=\"color: #D4D4D4\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> line <\/span><span style=\"color: #C586C0\">in<\/span><span style=\"color: #D4D4D4\"> lines:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #6A9955\"># remove head and tail spaces<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        line = line.strip()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #6A9955\"># Extract packages and version numbers<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #6A9955\"># e.g. tensorboard==2.19.0<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;==&#39;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">in<\/span><span style=\"color: #D4D4D4\"> line <\/span><span style=\"color: #569CD6\">and<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;installed&#39;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">not<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">in<\/span><span style=\"color: #D4D4D4\"> line:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            package, version = line.split(<\/span><span style=\"color: #CE9178\">&#39;==&#39;<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            dependencies.add(<\/span><span style=\"color: #569CD6\">f<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #569CD6\">{<\/span><span style=\"color: #D4D4D4\">package.strip()<\/span><span style=\"color: #569CD6\">}<\/span><span style=\"color: #CE9178\">==<\/span><span style=\"color: #569CD6\">{<\/span><span style=\"color: #D4D4D4\">version.strip()<\/span><span style=\"color: #569CD6\">}<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #6A9955\"># e.g. numpy [required: &gt;=1.12.0, installed: 1.23.5]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">elif<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;installed:&#39;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">in<\/span><span style=\"color: #D4D4D4\"> line:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            package_info = line.split(<\/span><span style=\"color: #CE9178\">&#39;[&#39;<\/span><span style=\"color: #D4D4D4\">)[<\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\">].strip().split(<\/span><span style=\"color: #CE9178\">&#39; &#39;<\/span><span style=\"color: #D4D4D4\">)[-<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            version = line.split(<\/span><span style=\"color: #CE9178\">&#39;installed: &#39;<\/span><span style=\"color: #D4D4D4\">)[<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">].strip(<\/span><span style=\"color: #CE9178\">&#39;]&#39;<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            dependencies.add(<\/span><span style=\"color: #569CD6\">f<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #569CD6\">{<\/span><span style=\"color: #D4D4D4\">package_info<\/span><span style=\"color: #569CD6\">}<\/span><span style=\"color: #CE9178\">==<\/span><span style=\"color: #569CD6\">{<\/span><span style=\"color: #D4D4D4\">version<\/span><span style=\"color: #569CD6\">}<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #6A9955\"># save to requirements.txt <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">with<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">open<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&#39;requirements.txt&#39;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&#39;w&#39;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">encoding<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #CE9178\">&#39;utf-8&#39;<\/span><span style=\"color: #D4D4D4\">) <\/span><span style=\"color: #C586C0\">as<\/span><span style=\"color: #D4D4D4\"> req_file:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> dep <\/span><span style=\"color: #C586C0\">in<\/span><span style=\"color: #D4D4D4\"> dependencies:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            req_file.write(<\/span><span style=\"color: #569CD6\">f<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #569CD6\">{<\/span><span style=\"color: #D4D4D4\">dep<\/span><span style=\"color: #569CD6\">}<\/span><span style=\"color: #D7BA7D\">\\n<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #DCDCAA\">print<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;requirements.txt done.&quot;<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">parse_dependency_tree(<\/span><span style=\"color: #CE9178\">&#39;dependency_tree.txt&#39;<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative\">Python<\/span><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-download-all-packages\">Download all packages<\/h3>\n\n\n\n<p>Download all packages in a specified folder:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"pip download -r requirements.txt -d \/path\/to\/your\/packages\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCDCAA\">pip<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">download<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-r<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">requirements.txt<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-d<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\/path\/to\/your\/packages<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative\">Bash<\/span><\/div>\n\n\n\n<p>Restore them in the target server<\/p>\n\n\n\n<p>Put the folder to the target server, and install them from requirements.txt:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"# --no-index --find-links: Ignore package index (only looking at --find-links URLs instead).\n\npip install --no-index --find-links \/path\/to\/your\/packages -r requirements.txt\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\"># --no-index --find-links: Ignore package index (only looking at --find-links URLs instead).<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">pip<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">--no-index<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">--find-links<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\/path\/to\/your\/packages<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-r<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">requirements.txt<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative\">Bash<\/span><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Usually, we can export Conda environment simply use requirements.txt or environment.yml. But if the target server could not access to the Internet, it will be unable&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":608,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-559","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/home.miawy.com\/index.php?rest_route=\/wp\/v2\/posts\/559","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/home.miawy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/home.miawy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/home.miawy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/home.miawy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=559"}],"version-history":[{"count":69,"href":"https:\/\/home.miawy.com\/index.php?rest_route=\/wp\/v2\/posts\/559\/revisions"}],"predecessor-version":[{"id":720,"href":"https:\/\/home.miawy.com\/index.php?rest_route=\/wp\/v2\/posts\/559\/revisions\/720"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/home.miawy.com\/index.php?rest_route=\/wp\/v2\/media\/608"}],"wp:attachment":[{"href":"https:\/\/home.miawy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/home.miawy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/home.miawy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}