[Distutils] Unable to import python script after installing using easy_install
Phillip J. Eby
pje at telecommunity.com
Sat Jan 10 18:06:36 CET 2009
At 03:03 PM 1/9/2009 -0600, ray terrill wrote:
>I'm using python2.4 to try to package and deliver a custom python
>script. I'm unable to import the package.
>
>My setup.py looks like the following:
>from setuptools import setup, find_packages
>setup(
> name = "randomscript",
> version = "1.0",
> packages = find_packages(),
>)
>
>I'm building the package using the following:
>python setup.py bdist_egg
>running bdist_egg
>running egg_info
>writing randomscript.egg-info/PKG-INFO
>writing top-level names to randomscript.egg-info/top_level.txt
>writing dependency_links to randomscript.egg-info/dependency_links.txt
>reading manifest file 'randomscript.egg-info/SOURCES.txt'
>writing manifest file 'randomscript.egg-info/SOURCES.txt'
>installing library code to build/bdist.linux-i686/egg
>running install_lib
>warning: install_lib: 'build/lib' does not exist -- no Python
>modules to install
The above is an indication that your source code isn't being
found. My guess is that since you're saying you want to install a
"script" but can't import it, what you actually have is a standalone
*module*, not a script or a package. find_packages() cannot find
such modules, you must list them individually, e.g.:
py_modules = ['randomscript'],
rather than listing them in the 'packages' parameter.
By the way, if you plan to distribute your module via PyPI, it is
recommended that you use 'sdist' to build a source distribution in
addition to (or instead of) an .egg file. .egg files are a very
specialized distribution format intended for things like application
plugins and site-local distribution (e.g., administrators making
binary packages available across a campus or company network,
etc.) That is, they're more aimed at end-user distribution use
cases, than at programmer or "open source" distribution use
cases. Or as I sometimes say, they're more of a "deployment" format
than a "distribution" format.
More information about the Distutils-SIG
mailing list