Edit: This is not a duplicate of Python offline package installation as the answer require 'pip' to be present. My premise is when 'pip' is not available.
My python script depends on this Github library. I need to create a self-sufficient tarball that includes this dependency and I can extract and run on my Production server, that does not have access to internet or pip. However I have Python 2.6.6/Python 2.7
I have created a virtualenv on my local machine (which has internet) and installed above dependency using pip. pip downloaded the dependent libraries. I obtained the requirements.txt with
pip freeze > requirements.txt
Now I downloaded these requirements using
pip download -r requirements.txt
Downloaded contents are
decorator-4.4.0-py2.py3-none-any.whl
jsonpath-rw-1.4.0.tar.gz
jsonpath_rw_ext-1.2.0-py2.py3-none-any.whl
pbr-5.2.0-py2.py3-none-any.whl
ply-3.11-py2.py3-none-any.whl
six-1.12.0-py2.py3-none-any.whl
I also created a setup.py with install_requires
having all the contents of the requirements.txt (followed from this Python offline package installation)
import setuptools
setuptools.setup(
name="Resizing Automation Validation Script",
packages=setuptools.find_packages(),
install_requires=['ply','pbr','six','decorator','jsonpath-rw','jsonpath-rw-ext'],
classifiers=[
"Programming Language :: Python :: 2.6.6",
"Operating System :: OS Independent",
],
)
I tried running following command to install these scripts (pip is not available)
python setup.py develop --always-unzip --allow-hosts=None --find-links=/path/to/download/dir
Note: The above command works on a freshly created virtualenv in local.
But it on server(without internet) it fails with error
running develop
running egg_info
creating Resizing_Automation_Validation_Script.egg-info
writing requirements to Resizing_Automation_Validation_Script.egg-info/requires.txt
writing Resizing_Automation_Validation_Script.egg-info/PKG-INFO
writing top-level names to Resizing_Automation_Validation_Script.egg-info/top_level.txt
writing dependency_links to Resizing_Automation_Validation_Script.egg-info/dependency_links.txt
writing manifest file 'Resizing_Automation_Validation_Script.egg-info/SOURCES.txt'
reading manifest file 'Resizing_Automation_Validation_Script.egg-info/SOURCES.txt'
writing manifest file 'Resizing_Automation_Validation_Script.egg-info/SOURCES.txt'
running build_ext
Creating /deployeruser/.local/lib/python2.7/site-packages/Resizing-Automation-Validation-Script.egg-link (link to .)
Adding Resizing-Automation-Validation-Script 1.0.0 to easy-install.pth file
Installed /deployeruser/tmp
Processing dependencies for Resizing-Automation-Validation-Script==1.0.0
Searching for jsonpath-rw-ext
Link to https://pypi.python.org/simple/jsonpath-rw-ext/ ***BLOCKED*** by --allow-hosts
Couldn't find index page for 'jsonpath-rw-ext' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Link to https://pypi.python.org/simple/ ***BLOCKED*** by --allow-hosts
No local packages or download links found for jsonpath-rw-ext
With pip it works fine
pip install --no-index --find-links /path/to/download/dir/ -r requirements.txt
However, how do I make it work without pip