2

I downloaded a Python .tar.gz package and extracted it. I'm working in a closed LAN so obviously the usual global PyPI index isn't available. We have our own PyPI index in the network.

I know how I can link to it when using pip or easy_install. However I couldn't find out how to do this when running setup.py install directly.

How can this be done?

Anthony Kong
  • 37,791
  • 46
  • 172
  • 304
Aviv Cohn
  • 15,543
  • 25
  • 68
  • 131
  • Have you tried doing the same thing? I think `setup.py` passes all arguments on to `pip`. – jonrsharpe Jan 03 '16 at 10:41
  • @jonrsharpe Actually, it's the other way around: `pip` is a user-friendly tool based on setuptools/distutils. See [this question](http://stackoverflow.com/questions/6344076/differences-between-distribute-distutils-setuptools-and-distutils2). – alexanderlukanin13 Jan 04 '16 at 08:08

1 Answers1

0

You can build a package and install it from archive file using pip.

  1. Configure pip to use another index according to this article. Open ~/.pip/pip.conf and add:

    [global]
    index-url = http://your-private-index
    
  2. Build a package:

    python setup.py build sdist
    
  3. And finally, install package using pip

    pip install dist/mypackage-1.0.0.tar.gz
    
alexanderlukanin13
  • 4,577
  • 26
  • 29
  • Can I use `pip install --index http://my-pypi/simple` instead of configuring `pip` globally? – Aviv Cohn Jan 03 '16 at 11:00
  • It does the same thing. – alexanderlukanin13 Jan 03 '16 at 11:00
  • If you're going to use `pip`, why not skip 1 and 2 and use `pip install --i`? – juanchopanza Jan 03 '16 at 14:25
  • @juanchopanza I assumed (probably incorrectly) that the package is under active development and Aviv wanted to install a debug version he is working on. If it's just some package from PyPI, then of course the best way is to upload it to local package index and install with `pip install` as usual. – alexanderlukanin13 Jan 04 '16 at 08:37
  • "I know how I can link to it when using pip or easy_install. However I couldn't find out how to do this when running setup.py install directly." – juanchopanza Jan 04 '16 at 08:48