I have a very simple project example that I can't get to work.
I have a setup.py that looks like this:
from setuptools import setup
install_requires=['numpy','matplotlib','pyusb']
setup(
name='TestInstall',
version='1.0',
description='a test',
author='Pete',
author_email='pete@hotmail.com',
url='https://github.com',
packages=['App'],
install_requires=install_requires,
entry_points={
'console_scripts': [
'TestInstall = App.Test:main']}
)
I have a directory call 'App' and within this directory, I have two files:
__init__.py:
import Test
and Test.py:
def main():
print 'Hi There'
if __name__ == '__main__':
main()
I run 'python setup.py install', which seems to run just fine:
sudo -H python setup.py install
[sudo] password for pete:
running install
running bdist_egg
running egg_info
creating TestInstall.egg-info
writing requirements to TestInstall.egg-info/requires.txt
writing TestInstall.egg-info/PKG-INFO
writing top-level names to TestInstall.egg-info/top_level.txt
writing dependency_links to TestInstall.egg-info/dependency_links.txt
writing entry points to TestInstall.egg-info/entry_points.txt
writing manifest file 'TestInstall.egg-info/SOURCES.txt'
reading manifest file 'TestInstall.egg-info/SOURCES.txt'
writing manifest file 'TestInstall.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-i686/egg
running install_lib
running build_py
creating build
creating build/lib.linux-i686-2.7
creating build/lib.linux-i686-2.7/App
copying App/Test.py -> build/lib.linux-i686-2.7/App
copying App/__init__.py -> build/lib.linux-i686-2.7/App
creating build/bdist.linux-i686
creating build/bdist.linux-i686/egg
creating build/bdist.linux-i686/egg/App
copying build/lib.linux-i686-2.7/App/Test.py -> build/bdist.linux-i686/egg/App
copying build/lib.linux-i686-2.7/App/__init__.py -> build/bdist.linux-i686/egg/App
byte-compiling build/bdist.linux-i686/egg/App/Test.py to Test.pyc
byte-compiling build/bdist.linux-i686/egg/App/__init__.py to __init__.pyc
creating build/bdist.linux-i686/egg/EGG-INFO
copying TestInstall.egg-info/PKG-INFO -> build/bdist.linux-i686/egg/EGG-INFO
copying TestInstall.egg-info/SOURCES.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying TestInstall.egg-info/dependency_links.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying TestInstall.egg-info/entry_points.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying TestInstall.egg-info/requires.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying TestInstall.egg-info/top_level.txt -> build/bdist.linux-i686/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/TestInstall-1.0-py2.7.egg' and adding 'build/bdist.linux-i686/egg' to it
removing 'build/bdist.linux-i686/egg' (and everything under it)
Processing TestInstall-1.0-py2.7.egg
Copying TestInstall-1.0-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding TestInstall 1.0 to easy-install.pth file
Installing TestInstall script to /usr/local/bin
Installed /usr/local/lib/python2.7/dist-packages/TestInstall-1.0-py2.7.egg
Processing dependencies for TestInstall==1.0
Searching for pyusb==1.0.0
Best match: pyusb 1.0.0
Adding pyusb 1.0.0 to easy-install.pth file
Using /usr/local/lib/python2.7/dist-packages
Searching for matplotlib==1.5.1
Best match: matplotlib 1.5.1
matplotlib 1.5.1 is already the active version in easy-install.pth
Using /usr/lib/python2.7/dist-packages
Searching for numpy==1.11.0
Best match: numpy 1.11.0
numpy 1.11.0 is already the active version in easy-install.pth
Using /usr/lib/python2.7/dist-packages
Finished processing dependencies for TestInstall==1.0
pete@pete-ThinkPad-T60p:~/Work/TestInstall$
But when I try to run the program:
TestInstall
I get:
pete@pete-ThinkPad-T60p:~/Work/TestInstall$ TestInstall
Traceback (most recent call last):
File "/usr/local/bin/TestInstall", line 9, in <module>
load_entry_point('TestInstall==1.0', 'console_scripts', 'TestInstall')()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2229, in load
return self.resolve()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named Test
pete@pete-ThinkPad-T60p:~/Work/TestInstall$
This must be a simple error, but I've looked everywhere and am pulling my hair out.
Thanks in advance for any answers. Pete
BTW, I see the .egg file in /usr/local/lib/python2.7/dist-packages and within it, I see the EGG-INFO listing the sources, entry point, etc. listed, along with App directory, and under it, my __init__.py and .pyc file and my Test.py and .pyc file.