Installing Python Packages in an Offline Environment
In some cases, you may need to install Python packages in an offline environment without an internet connection. This is especially common in high-security settings such as financial institutions, government agencies, or military organizations. Even under such restrictions, CukeTest still allows you to install and manage third-party Python packages.
This section provides step-by-step instructions for installing two common formats of packages in an offline setup: .whl (wheel files) and .tar.gz (source archives).
If you want to install CukeTest’s Python libraries into your own Python environment, please refer to the document: Manually Install the Python Automation Library.
1. Preparation
In an environment with internet access, first download the required Python package and all its dependencies.
You can do this using pip’s download function. For example, to download the Appium-Python-Client package:
- Launch a command-line tool window.
Run the following command to download the package:
pip download Appium-Python-Client
With this command, the Appium-Python-Client package and all of its dependencies will be downloaded into the current directory. The files downloaded may be in either .whl or .tar.gz format.
2. Transferring Files
Transfer the downloaded files (.whl or .tar.gz) to the offline computer with a USB drive, CD-ROM, or other storage media.
3. Installing Packages
On the offline environment, follow the installation steps based on the file type.
a. Installing .whl Files
- Open the command-line tool window in CukeTest.
- Navigate to the directory where the
.whlfiles are stored. Install the package with the following command:
pip install some_package.whl
Replace some_package.whl with the actual filename.
If you have multiple wheel files, you can install all of them at once:
pip install *.whl
b. Installing .tar.gz Files
Extract the
.tar.gzfile:tar -xzf appium-python-client-4.0.0.tar.gzNavigate into the extracted directory:
cd appium-python-client-4.0.0Inside this directory, install the package with the following command:
pip install .
The dot
.here refers to the current directory.
4. Verifying Installation
Use the following command to list installed packages and confirm successful installation:
pip list
Summary
By following these steps, you can successfully install and manage Python packages even in an offline environment, ensuring your automated testing workflows remain efficient and complete, even under network restrictions.