Re: [Distutils] Unable to import python script after installing using easy_install

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.

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.
I wasnt aware of this option. This looks a lot more like what I need.
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.
This is custom business-specific code, not intended for general use or being uploaded to PyPI. They're going to be distributed to over 800+ locations internally, so I was looking for a repeatable structured mechanism to deploy the code and verify that it was installed correctly, vs. just copying the files into the python sys.path and hoping they're there when they need to be run (how it currently is working).
-Ray

At 10:21 AM 1/10/2009 -0800, rayterrill wrote:
They're going to be distributed to over 800+ locations internally, so I was looking for a repeatable structured mechanism to deploy the code and verify that it was installed correctly, vs. just copying the files into the python sys.path and hoping they're there when they need to be run (how it currently is working).
In that case, an egg is a good choice.

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.
I changed the setup.py to use the py_modules parameter vs. the find_packages() parameter, and it does work correctly now. -Ray
participants (2)
-
Phillip J. Eby
-
rayterrill