[Distutils] setup.py develop is not locating install_requires packages in custom site dir

ryles rylesny at gmail.com
Mon Aug 17 16:13:46 CEST 2009

I have a package, 'proj', which specifies a dependency on 'mypkg',
version 0.0.2

$ cat setup.py
from setuptools import find_packages, setup

setup(name = "proj",
      version = "0.0.1",
      platforms = ["linux2"],
      packages = find_packages(),
      zip_safe = False,
      entry_points = {"console_scripts": ["proj = proj.main:main"]},

I have been able to successfully easy_install an egg created with
setup.py bdist_egg, and the 'proj' entry point successfully `requires'
mypkg 0.0.2.

However, setup.py develop is not able to find mypkg. I am installing
it into the user site dir so that it's private during development,
rather than in my system wide /custom/site-packages directory:

$ python setup.py develop --install-dir ~/.local/lib/python2.6/site-
packages --script-dir ~/bin --allow-hosts localhost
running develop
Checking .pth file support in /home/user/.local/lib/python2.6/site-
/custom/bin/python -E -c pass
TEST PASSED: /home/user/.local/lib/python2.6/site-packages appears to
support .pth files
running egg_info
creating proj.egg-info
writing requirements to proj.egg-info/requires.txt
writing proj.egg-info/PKG-INFO
writing top-level names to proj.egg-info/top_level.txt
writing dependency_links to proj.egg-info/dependency_links.txt
writing entry points to proj.egg-info/entry_points.txt
writing manifest file 'proj.egg-info/SOURCES.txt'
reading manifest file 'proj.egg-info/SOURCES.txt'
writing manifest file 'proj.egg-info/SOURCES.txt'
running build_ext
Creating /home/user/.local/lib/python2.6/site-packages/proj.egg-link
(link to .)
Adding proj 0.0.1 to easy-install.pth file
Installing proj script to /home/user/bin

Installed /path/to/proj
Processing dependencies for proj==0.0.1
Searching for mypkg==0.0.2

Link to http://pypi.python.org/simple/mypkg/ ***BLOCKED*** by --allow-

Couldn't find index page for 'myproj' (maybe misspelled?)
Scanning index of all packages (this may take a while)

Link to http://pypi.python.org/simple/ ***BLOCKED*** by --allow-hosts

No local packages or download links found for mypkg==0.0.2
error: Could not find suitable distribution for Requirement.parse

pkg_resources.require() has no trouble finding it, however.

$ python
Python 2.6.2 (r262:71600, Jul 16 2009, 14:04:28)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pkg_resources import require
>>> require("mypkg==0.0.2")
[mypkg 0.0.2 (/custom/site-packages/mypkg-0.0.2-py2.6.egg)]
>>> import mypkg

The problem is fixed if I explicitly tell setuptools that /custom/site-
packages is
a site directory with --site-dirs, but it's unclear why this should be
necessary since that directory is already in sys.path. Note that /
custom/site-packages was created by following the instructions here:

More information about the Distutils-SIG mailing list