["python","pip","freebsd","easy-install","python-requests"]
How can I install packages offline?

What's the best way to download a Python package and its dependencies from PyPI for offline installation on another machine? Is there an easy way to do this with pip or easy_install? I'm trying to install the Requests library on a FreeBSD box that is not connected to the Internet_.
If the package is on PyPI, download it and its dependencies to some local directory. E.g., mkdir /pypi && cd /pypi ls -la Output: -rw-r--r-- 1 pavel staff 237954 Apr 19 11:31 Flask-WTF-0.6.tar.gz -rw-r--r-- 1 pavel staff 389741 Feb 22 17:10 Jinja2-2.6.tar.gz -rw-r--r-- 1 pavel staff 70305 Apr 11 00:28 MySQL-python-1.2.3.tar.gz -rw-r--r-- 1 pavel staff 2597214 Apr 10 18:26 SQLAlchemy-0.7.6.tar.gz -rw-r--r-- 1 pavel staff 1108056 Feb 22 17:10 Werkzeug-0.8.2.tar.gz -rw-r--r-- 1 pavel staff 488207 Apr 10 18:26 boto-2.3.0.tar.gz -rw-r--r-- 1 pavel staff 490192 Apr 16 12:00 flask-0.9-dev-2a6c80a.tar.gz Some packages may have to be archived into similar looking tarballs by hand. I do it a lot when I want a more recent (less stable) version of something. Some packages aren't on PyPI, so same applies to them. Suppose you have a properly formed Python application in ~/src/myapp. ~/src/myapp/setup.py will have install_requires list that mentions one or more things that you have in your /pypi directory. Like so: install_requires = [ 'boto', 'Flask', 'Werkzeug', # And so on If you want to be able to run your application with all the necessary dependencies while still hacking on it, you'll do something like this: cd ~/src/myapp python setup.py develop --always-unzip --allow-hosts=None --find-links=/pypi This way, your application will be executed straight from your source directory. You can hack on things, and then rerun the application without rebuilding anything. If you want to install your application and its dependencies into the current python environment, you'll do something like this: cd ~/src/myapp easy_install --always-unzip --allow-hosts=None --find-links=/pypi . In both cases, the build will fail if one or more dependencies aren't present in the /pypi directory. It won't attempt to promiscuously install missing things from Internet. I highly recommend to invoke setup.py develop ... and easy_install ... within an active virtual environment to avoid contaminating your global Python environment. It is (virtualenv that is) pretty much the way to go. Never install anything into global Python environment. If the machine that you've built your application has same architecture as the machine on which you want to deploy it, you can simply tarball the entire virtual environment directory into which you easy_install-ed everything. Just before tarballing though, you must make the virtual environment directory relocatable (see the --relocatable option). Note: the destination machine needs to have the same version of Python installed, and also any C-based dependencies your application may have must be preinstalled there too (e.g., say if you depend on PIL, then libpng, libjpeg, etc. must be preinstalled).