[Distutils] Building and installing packages on a (unix) system lacking network accesss

Glyph Lefkowitz glyph at twistedmatrix.com
Wed Dec 23 23:23:42 EST 2015


> On Dec 22, 2015, at 5:51 AM, KM <nalani at fea.st> wrote:
> 
> Greetings distutils-sig,
> 
> I have a project with an autogenerated structure - that is, I ran a "helper" application which creates a directory structure and a setup.py for me. I am trying to build this package in a virtualenv on an isolated machine, necessiating the step of downloading all the prerequisite packages and making them available. I have done this and I can successfully install most of the prerequisites by passing "--no-index" and "-f <url>" to pip, making my full command-line:
> 
> pip install -e . --no-index -f <url>
> 
> This works up until a certain point, where pip (or something launched by pip) tries to download from the internet. 

[snip]

This is in fact the entire point of saying --no-index; "don't download stuff from the internet".  So it's working as designed.  You need to make sure all your dependencies are available before you run that `pip install´ command.  Have you?

> I am hoping for some feedback or information that will allow me to install my application with all of its dependencies downloaded from a locally-available url or directory. Does anyone have any suggestions for me?

You're doing this in vaguely the right way with `pip install -f --no-index´.  As Ben Finney already pointed out, these are not distutils options so the whole thing with --global-option is a complete red herring, give up on that :-).

In fact, as stated, your example works just fine:

$ mkdir offline_stuff
$ pip wheel --wheel-dir offline_stuff pytz
Collecting pytz
  Saved ./offline_stuff/pytz-2015.7-py2.py3-none-any.whl
Skipping pytz, due to already being wheel.
$ mktmpenv ; cd -
New python executable in tmp-a3e6ab08e84f351d/bin/python2.7
Also creating executable in tmp-a3e6ab08e84f351d/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /Users/glyph/.virtualenvs/tmp-a3e6ab08e84f351d/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/glyph/.virtualenvs/tmp-a3e6ab08e84f351d/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/glyph/.virtualenvs/tmp-a3e6ab08e84f351d/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/glyph/.virtualenvs/tmp-a3e6ab08e84f351d/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/glyph/.virtualenvs/tmp-a3e6ab08e84f351d/bin/get_env_details
This is a temporary environment. It will be deleted when you run 'deactivate'.
/Users/glyph
(tmp-a3e6ab08e84f351d)$ pip install -f offline_stuff --no-index pytz
Ignoring indexes: https://pypi.python.org/simple
Collecting pytz
Installing collected packages: pytz
Successfully installed pytz-2015.7
(tmp-a3e6ab08e84f351d)$ python -c 'import pytz; print(pytz)'
<module 'pytz' from '/Users/glyph/.virtualenvs/tmp-a3e6ab08e84f351d/lib/python2.7/site-packages/pytz/__init__.pyc'>
(tmp-a3e6ab08e84f351d)$ 

So if you could please provide a sample `setup.py´ or sample `requirements.txt´, along with exactly what unexpected output you got, it would be helpful in understanding what went wrong.  This should be a minimal example demonstrating just the problem you're seeing, not your whole project; see http://sscce.org for a longer explanation.

-glyph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20151223/868fcd4a/attachment.html>


More information about the Distutils-SIG mailing list