Building error with setuptools: RuntimeError - python

I've been using cxFreeze to build my Python code for some time and had no issue, until today. I'm not sure the problem comes from cxFreeze, though. Although there are some RuntimeError exceptions on the web, they don't exactly match what I obtain.
$ python2.7 setup.py build
running build
running build_exe
Traceback (most recent call last):
File "setup.py", line 79, in <module>
executables = [client, updater, dbg_updater]
File "C:\python27\lib\site-packages\cx_Freeze\dist.py", line 362, in setup
distutils.core.setup(**attrs)
File "C:\python27\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\python27\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\python27\lib\site-packages\cx_Freeze\dist.py", line 232, in run
freezer.Freeze()
File "C:\python27\lib\site-packages\cx_Freeze\freezer.py", line 619, in Freeze
self.finder = self._GetModuleFinder()
File "C:\python27\lib\site-packages\cx_Freeze\freezer.py", line 378, in _GetModuleFinder
finder.IncludePackage(name)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 686, in IncludePackage
module = self._ImportModule(name, deferredImports)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 346, in _ImportModule
deferredImports, namespace = namespace)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 419, in _InternalImportModule
namespace = namespace)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 436, in _InternalImportModule
parentModule, namespace)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 448, in _LoadModule
namespace)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 513, in _LoadPackage
self._LoadModule(name, fp, path, info, deferredImports, parent)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 502, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 601, in _ScanCode
module, relativeImportIndex)
......................................
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 356, in _ImportModule
deferredImports, namespace = namespace)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 436, in _InternalImportModule
parentModule, namespace)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 502, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 601, in _ScanCode
module, relativeImportIndex)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 356, in _ImportModule
deferredImports, namespace = namespace)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 436, in _InternalImportModule
parentModule, namespace)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 449, in _LoadModule
module = self._AddModule(name)
File "C:\python27\lib\site-packages\cx_Freeze\finder.py", line 213, in _AddModule
module = self._modules[name] = Module(name)
RuntimeError: maximum recursion depth exceeded while calling a Python object
No idea what is creating the bug. I didn't add in any new module and just fixed some errors in my program. I have the most recent version of pip and setuptools. Does anyone know what this error mean?
If you want to see the code, it's here: https://github.com/vlegoff/cocomud/blob/master/src/setup.py
Thanks in advance!
EDIT:
It turned out all the fuss was because of the parse module (pypi.python.org/pypi/parse), although it's not included in the project I was trying to freeze. I removed it with pip uninstall and it worked when I tried to freeze my project. No idea why, I did it because I remember having installed two new packages to try them out.

This looks strange. I believe it could be related to a bug in cx_freeze.
If you read the people referred by this link:
https://bitbucket.org/anthony_tuininga/cx_freeze/issues/184/importing-pyqtgraph-causes-recursion-limit
They seem to have a problem with pyqtgraph, but also with urllib, that you are using in your project (and the bug doesn't seems fixed yet). So I suggest to exclude this from your project and to check if this works better. Maybe, you could also try another version of cx_freeze, or specifying the imported libraries in another way, for instance, by linking modules manually using this syntax:
Buildoptions=dict(
compressed=True,
includes=["moduletoinclude"],
path=sys.path + ["Lib"]
)
Have a nice day

It turned out all the fuss was because of the parse module (pypi.python.org/pypi/parse), although it's not included in the project I was trying to freeze. I removed it with pip uninstall and it worked when I tried to freeze my project. No idea why, I did it because I remember having installed two new packages to try them out.

Related

NameError py2app in modulegraph

I'm trying to use py2app to create a standalone application of mac. When I`m using the alias mode everything work fine, but when I try to
python setup.py py2app
I receive this error:
Traceback (most recent call last):
File "setup.py", line 21, in <module>
setup_requires=['py2app'],
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/Users/robert/Envs/py36/lib/python3.6/site-packages/py2app/build_app.py", line 659, in run
self._run()
File "/Users/robert/Envs/py36/lib/python3.6/site-packages/py2app/build_app.py", line 865, in _run
self.run_normal()
File "/Users/robert/Envs/py36/lib/python3.6/site-packages/py2app/build_app.py", line 943, in run_normal
self.process_recipes(mf, filters, flatpackages, loader_files)
File "/Users/robert/Envs/py36/lib/python3.6/site-packages/py2app/build_app.py", line 824, in process_recipes
rval = check(self, mf)
File "/Users/robert/Envs/py36/lib/python3.6/site-packages/py2app/recipes/virtualenv.py", line 86, in check
mf._scan_code(co, m)
File "/Users/robert/Envs/py36/lib/python3.6/site-packages/modulegraph/modulegraph.py", line 1543, in _scan_code
self._scan_bytecode(co, m)
File "/Users/robert/Envs/py36/lib/python3.6/site-packages/modulegraph/modulegraph.py", line 1570, in _scan_bytecode
n = len(code)
NameError: name 'code' is not defined
My version of Python 3.5, py2app 0.10, module graph 0.13. Has anyone encountered a similar one, and how I can solve it?
P.S. Sorry for my bad English.
I had the same issue.
This issue will be fixed in moudulegraph 0.14
If you can't wait you can pull from the repo any point after this commit:
https://bitbucket.org/ronaldoussoren/modulegraph/commits/32c6c60f9dcdb106219a1476218e0d364cb11255

Error wihle installing pwd module on windows

I am trying to install "pwd" module using easy_install on windows and running into below error,can anyone help how to fix this error?
C:\Dropbox\scripts>easy_install pwd
Searching for pwd
Reading http://pypi.python.org/simple/pwd/
Couldn't find index page for 'pwd' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for pwd
Best match: None
Traceback (most recent call last):
File "C:\Python27\Scripts\easy_install-script.py", line 8, in <module>
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1712, in main
with_ei_usage(lambda:
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1700, in with_ei_usage
return f()
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1716, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "C:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 211, in run
self.easy_install(spec, not self.no_deps)
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 434, in easy_install
self.local_index
File "C:\Python27\lib\site-packages\setuptools\package_index.py", line 475, in fetch_distribution
return dist.clone(location=self.download(dist.location, tmpdir))
AttributeError: 'NoneType' object has no attribute 'clone'
pwd is a built-in module(come with python installation) for unix like only os - you can't use it on windows, try winpwd

how to force buildout to use already installed package

On a server, for disk optimization, we do not install a C compiler,
and here is the problem :
I want to install 'spur' python package with buildout 2.3.1,
spur is using pycrypto which requires a C compiler.
To avoid compilation, I installed on the server (Suse 11SP2) the rpm python-pycrypto (python-pycrypto-2.6-31.7.x86_64.rpm). I can check with 'pip freeze' that pycrypto is installed :
pip freeze
lxml==2.1.2
mod-python==3.3.1
Numeric==24.2
numpy==1.3.0
pycrypto==2.6
pywbem==0.7.0
PyXML==0.8.4
Nevertheless, when I start buildout, it still tries to build pycrypto with a C compiler that does not exist.
So I added include-site-packages = true and allowed-eggs-from-site-packages = pycrypto in buildout.cfg, but they are not taken in account.
I also tried to do a :
python bootstrap.py --allow-site-packages
bin/buildout
but that did not help too.
What can I do to avoid buildout compile a package that is already compiled and installed from rpm ?
Here is the buildout.cfg
[buildout]
newest = false
extensions = gp.vcsdevelop
develop-dir = src
parts = eggs tests wsgi
include-site-packages = true
allowed-eggs-from-site-packages = pycrypto
eggs =
Django==1.4.8
ordereddict
ipython==0.13.2
django-webtest
django-grappelli<2.5.0
django-bootstrap3-datetimepicker
z3c.recipe.usercrontab
rrdgraphs
south
achilterm
pynag
pyaml<14
DjangoDevKit==1.0.3
Sphinx
xlwt
xlrd
spur
...
and the logs :
# bin/buildout
Unused options for buildout: 'allowed-eggs-from-site-packages' 'include-site-packages'.
Installing eggs.
Getting distribution for 'pycrypto!=2.4,>=2.1'.
configure: error: in `/tmp/easy_install-QFXca_/pycrypto-2.6.1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 2254, in main
File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 380, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 610, in easy_install
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 659, in install_item
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 842, in install_eggs
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1070, in build_and_install
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1056, in run_setup
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 240, in run_setup
File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__
self.gen.throw(type, value, traceback)
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 193, in setup_context
File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__
self.gen.throw(type, value, traceback)
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 164, in save_modules
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 139, in resume
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 152, in save_modules
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 193, in setup_context
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 237, in run_setup
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 267, in run
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 236, in runner
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 46, in _execfile
File "/tmp/easy_install-QFXca_/pycrypto-2.6.1/setup.py", line 456, in <module>
File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py", line 160, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py", line 146, in call_command
File "/usr/lib64/python2.6/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "build/bdist.linux-x86_64/egg/setuptools/command/install_lib.py", line 10, in run
File "/usr/lib64/python2.6/distutils/command/install_lib.py", line 112, in build
self.run_command('build_ext')
File "/usr/lib64/python2.6/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/tmp/easy_install-QFXca_/pycrypto-2.6.1/setup.py", line 251, in run
File "/usr/lib64/python2.6/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/tmp/easy_install-QFXca_/pycrypto-2.6.1/setup.py", line 278, in run
RuntimeError: autoconf error
An error occurred when trying to install pycrypto 2.6.1. Look above this message for any errors that were output by easy_install.
While:
Installing eggs.
Getting distribution for 'pycrypto!=2.4,>=2.1'.
Error: Couldn't install: pycrypto 2.6.1
I found a workaround :
I just created a egg-link file into develop-eggs dir :
$ cat develop-eggs/pycrypto.egg-link
/usr/lib64/python2.6/site-packages
I got no evidence that zc.buildout > 1.7.1 supports include-site-packages, nor allowed-eggs-from-site-packages.
On my local machine I searched for the mentioned features in the following versions of zc.buildout:
zc.buildout-1.4.4-py2.7.egg
zc.buildout-1.6.3-py2.7.egg
zc.buildout-1.7.1-py2.7.egg
zc.buildout-2.0.0-py2.7.egg
zc.buildout-2.0.1-py2.7.egg
zc.buildout-2.1.0-py2.7.egg
zc.buildout-2.2.0-py2.7.egg
zc.buildout-2.2.1-py2.7.egg
zc.buildout-2.2.3-py2.7.egg
zc.buildout-2.2.4-py2.7.egg
zc.buildout-2.2.5-py2.7.egg
zc.buildout-2.3.0-py2.7.egg
zc.buildout-2.3.1-py2.7.egg
Check Readme on https://pypi.python.org/pypi/zc.buildout/1.7.1. The features were introduced somewhere around zc.buildout 1.5.0. The last release, which supports those features is 1.7.1.
They made some kind of relaunch with zc.buildout 2.0.0...
Quote from the changlog, version 2.0.0:
This is a backward incompatible release of buildout that attempts to correct mistakes made in buildout 1.
Buildout no-longer tries to provide full or partial isolation from system Python installations. If you want isolation, use buildout with virtualenv, or use a clean build of Python to begin with.
In your case this means, if you want to use those features you need to use zc.buildout 1.7.1.
It's also important, that it's not possible to use both options at the same time. Use allowed-eggs-from-site-packages (only specific packages), or include-site-packages.
I assume you're using the boostrap.py version 1: http://downloads.buildout.org/1/bootstrap.py
This version does not support the ´--allow-site-packages´ options, since it was intended to use with zc.buildout 1.x, which handles this case (or at least 1.5.x).
Well, after this short trip in buildout history, I guess the following two points will solve your problem:
Be sure you're using boostrap.py 2: https://bootstrap.pypa.io/bootstrap-buildout.py. Only this version supports the --allow-site-packages option.
Make sure you are using a suitable zc.buildout version for yout boostrap.py verson.
Then python bootstrap.py --allow-site-packages works as expected.

TypeError: dist must be a Distribution instance

My package depends on BeautifulSoup. If I install my package in a fresh virtualenv via python setup.py develop, I get the following error. If I execute python setup.py develop a second time, everything seems to work fine. I have no idea, what's happening. How to fix it to get a reproducable setup?
Best match: beautifulsoup4 4.3.2
Downloading https://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup4-4.3.2.tar.gz#md5=b8d157a204d56512a4cc196e53e7d8ee
Processing beautifulsoup4-4.3.2.tar.gz
Writing /tmp/easy_install-1eBfi3/beautifulsoup4-4.3.2/setup.cfg
Running beautifulsoup4-4.3.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-1eBfi3/beautifulsoup4-4.3.2/egg-dist-tmp-YmoFSq
Traceback (most recent call last):
File "setup.py", line 73, in <module>
""",
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 27, in run
self.install_for_development()
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 129, in install_for_development
self.process_distribution(None, self.dist, not self.no_deps)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 671, in process_distribution
[requirement], self.local_index, self.easy_install
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/pkg_resources.py", line 564, in resolve
dist = best[req.key] = env.best_match(req, self, installer)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/pkg_resources.py", line 802, in best_match
return self.obtain(req, installer) # try and download/install
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/pkg_resources.py", line 814, in obtain
return installer(requirement)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 593, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 623, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 809, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1015, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1000, in run_setup
run_setup(setup_script, args)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 50, in run_setup
lambda: execfile(
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 100, in run
return func()
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 52, in <lambda>
{'__file__':setup_script, '__name__':'__main__'}
File "setup.py", line 27, in <module>
'raven',
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 970, in run_command
cmd_obj = self.get_command_obj(command)
File "/usr/lib/python2.7/distutils/dist.py", line 846, in get_command_obj
cmd_obj = self.command_obj[command] = klass(self)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/__init__.py", line 69, in __init__
_Command.__init__(self,dist)
File "/usr/lib/python2.7/distutils/cmd.py", line 59, in __init__
raise TypeError, "dist must be a Distribution instance"
TypeError: dist must be a Distribution instance
This error has to do with a discrepancy between the versions of distutils and setuptools installed on your machine. Upgrading setuptools to the current version is likely to resolve the issue.
EDIT: This solution no longer works for me (and apparently never worked for Jens -- see comment below). What now works for me is to import setuptools before anything else in whatever script I'm calling that leads to this error.
This error is discussed in many issues on GitHub, in many packages, but I find this discussion to be the most informative.
The only way I was able to solve it was to follow the https://bugs.python.org/file37554/distutils_accomodate_distribution_ducktypes.patch
So - I removed /usr/lib/python2.7/distutils/cmd.py and /usr/lib/python2.7/distutils/cmd.pyc ( ran a python setup.py develop - just to make sure it fails and is not using the pyc from somewhere else ) and then recreated /usr/lib/python2.7/distutils/cmd.py - only this time with the changes as shown in the patch. Then when I used python setup.py again - it worked..
install dnspython. pip install dnspython. Or check if u have older version of dnspython and upgrade
Try using pip for installing your package
$ pip install -e path/to/your/Project
See http://pip.readthedocs.org/en/latest/reference/pip_install.html#editable-installs for more information.
When I encountered this, it appeared at first glance that it was complaining that Distribution() didn't produce a Distribution instance, but that was only partly true.
setuptools provides its own Distribution, and monkeypatches it into distutils. That works in most cases, but will fail if you get a reference to Distribution before setuptools has been imported and done its magic.
The top of the script read:
from distutils.dist import Distribution
and then later we were importing and using various parts of setuptools.
The solution in my case was to do a late import in the function that uses it so Distribution was obtained after setuptools was loaded.

Python setup.py install throwing zipimport.ZipImportError

I run the following command in terminal sudo python2.6 setup.py install and after some output I get the below error.
Traceback (most recent call last):
File "setup.py", line 16, in <module>
packages=find_packages()
File "/opt/python2.6/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/opt/python2.6/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/opt/python2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/install.py", line 76, in run
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/install.py", line 104, in do_egg_install
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py", line 211, in run
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py", line 427, in easy_install
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py", line 478, in install_item
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py", line 519, in process_distribution
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 570, in resolve
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 2149, in requires
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 2141, in _dep_map
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 2560, in split_sections
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 1854, in yield_lines
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 2163, in _get_metadata
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 1181, in get_metadata_lines
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 1178, in get_metadata
File "/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 1238, in _get
zipimport.ZipImportError: bad local file header in /opt/python2.6/lib/python2.6/site-packages/businesscommon-5.63-py2.6.egg
I ran the command unzip -t /opt/python2.6/lib/python2.6/site-packages/businesscommon-5.63-py2.6.egg to see if the EGG file is a valid ZIP file and it returned 'No errors detected'.
I've done some research on zipimport.ZipImportError but can't seem to figure how really to debug or fix it. I don't have much experience with Python so any help or advice would be appreciated.
Looks like all I needed to do was run sudo python2.5 setup.py install instead of sudo python2.6 setup.py install
Notice that I was oringally using python2.6 instead of python2.5.

Categories