Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline installation without active internet connection crashes on windows #835

Open
testtomat opened this issue Dec 15, 2023 · 3 comments

Comments

@testtomat
Copy link

Affected tool:
pip install oletool

Describe the bug
Can not install oletool offline, because installation process tries to load dependent files from internet

File/Malware sample to reproduce the bug

How To Reproduce the bug
1.) Download https://github.com/decalage2/oletools/releases/download/v0.60.1/oletools-0.60.1.zip
2.) run pip3.xx.exe install -U "<path_to_oletools>\oletools-0.60.1.zip" WITHOUT active internet connection

Expected behavior
under offline installation I don't expect to have an active internet connection

Console output / Screenshots

pip3.10.exe install -U "<path_to_oletools>\oletools-0.60.1.zip"
Processing <path_to_oletools>\oletools-0.60.1.zip
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [7 lines of output]
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000018F29FC78E0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000018F29FC7BE0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000018F29FC7F40>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000018F2A008280>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000018F2A0082B0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/
ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
ERROR: No matching distribution found for setuptools>=40.8.0
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.

Version information:

  • OS: Windows
  • OS version: 10 22H2 - 64 bit
  • Python version: 3.10.11 | 3.11.7 | 3.12.1 64bit
  • oletools version: 0.60.1

Additional context
Add any other context about the problem here.

@decalage2
Copy link
Owner

Indeed a normal pip installation will not work offline, because it needs to download a number of dependencies (listed in requirements.txt and setup.py).
To install offline, you need to get every dependency first, and then install them one by one in the correct order, with oletools at the end. This would need to be added to the documentation.

@testtomat
Copy link
Author

Okay, thanks.

Is this the only way or is it possible to make a Copy 'n Paste deployment of all installed packages from a development machine to a production machine?
Sorry, I'm a C#-developer and not familar with Python environment.

@decalage2
Copy link
Owner

decalage2 commented Dec 18, 2023

In theory yes, you could copy the site-packages directory where Python stores all external packages, assuming you have the same python version on both machines.
But you need to pay attention how external packages have been installed in the first place:

  • if packages were installed as root/administrator, they should be in the global site-packages directory of the python interpreter. (this is the easiest solution but not recommended on modern Linux distributions)
  • if they were installed as a non-admin user, they may be in a site-packages directory in the user's profile.
  • and they can also be installed in a virtual environment, which is located in a dedicated directory to avoid dependency conflicts with the system.

More info: https://www.quora.com/How-can-I-copy-the-Python-folder-with-all-its-libraries-and-modules-from-one-computer-to-another

But all in all, I would recommend to download all dependencies locally and install them with pip (with a script, to automate things). It's probably a bit more work, but it would avoid any install glitches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants