Repository navigation
Closed
Labels
Description
While constructing a Docker file, I got into trouble while running ./venv/bin/python setup.py install, which fails when running the first time (but succeeds on the second run).
Stacktrace of the error:
Searching for M2Crypto
Reading https://pypi.python.org/simple/M2Crypto/
Best match: M2Crypto 0.22.3
Downloading https://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-0.22.3.tar.gz#md5=573f21aaac7d5c9549798e72ffcefedd
Processing M2Crypto-0.22.3.tar.gz
Writing /tmp/easy_install-KBq_4X/M2Crypto-0.22.3/setup.cfg
Running M2Crypto-0.22.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-KBq_4X/M2Crypto-0.22.3/egg-dist-tmp-iRNoDy
Traceback (most recent call last):
File "setup.py", line 57, in <module>
include_package_data=True,
File "/usr/lib/python2.7/distutils/core.py", line 151, 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 "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/install.py", line 74, in run
self.do_egg_install()
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/install.py", line 97, in do_egg_install
cmd.run()
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 358, in run
self.easy_install(spec, not self.no_deps)
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 574, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 625, in install_item
self.process_distribution(spec, dist, deps)
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 671, in process_distribution
[requirement], self.local_index, self.easy_install
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/pkg_resources.py", line 580, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/pkg_resources.py", line 818, in best_match
return self.obtain(req, installer) # try and download/install
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/pkg_resources.py", line 830, in obtain
return installer(requirement)
File "/opt/lets-encrypt-preview/venv/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 "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 623, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/opt/lets-encrypt-preview/venv/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 "/opt/lets-encrypt-preview/venv/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 "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1000, in run_setup
run_setup(setup_script, args)
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 50, in run_setup
lambda: execfile(
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 100, in run
return func()
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 52, in <lambda>
{'__file__':setup_script, '__name__':'__main__'}
File "setup.py", line 148, in <module>
File "/usr/lib/python2.7/distutils/core.py", line 151, 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 "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 177, in run
self.run_command("egg_info")
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 163, in run
self.find_sources()
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 186, in find_sources
mm.run()
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 246, in run
self.add_defaults()
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 282, in add_defaults
sdist.add_defaults(self)
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/sdist.py", line 179, in add_defaults
build_ext = self.get_finalized_command('build_ext')
File "/usr/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "setup.py", line 69, in finalize_options
File "/opt/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/setuptools/command/build_ext.py", line 108, in finalize_options
_build_ext.finalize_options(self)
File "/usr/lib/python2.7/distutils/command/build_ext.py", line 182, in finalize_options
if os.name == 'nt':
AttributeError: 'NoneType' object has no attribute 'name'
Dockerfile used so far (will put it on Github and post on mailing list when finished), as workaround I'm simply running the command twice (when it fails, which is currently always):
FROM ubuntu:trusty
MAINTAINER Jens Erat <[email protected]>
EXPOSE 80 443
ENV DEBIAN_FRONTEND noninteractive
RUN \
apt-get update && \
apt-get install --no-install-recommends -y apache2 && \
apt-get install --no-install-recommends -y openssl ca-certificates git && \
apt-get install --no-install-recommends -y python python-setuptools python-virtualenv python-dev gcc swig dialog libaugeas0 libssl-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Quick and dirty fix for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=696327
RUN ln -s /usr/include/x86_64-linux-gnu/openssl/opensslconf.h /usr/include/openssl/
RUN cd /opt && git clone https://github.com/letsencrypt/lets-encrypt-preview.git
WORKDIR /opt/lets-encrypt-preview
# For some reason, first installation attempt fails
RUN \
virtualenv --no-site-packages -p python2 venv && \
./venv/bin/python setup.py install || \
./venv/bin/python setup.py install
The link used is a workaround for a Debian/Ubuntu issue, I don't think letsencrypt is in charge here.
Activity
JensErat commentedon Jan 1, 2015
The full Dockerfile is also available on https://github.com/JensErat/docker-lets-encrypt-preview - might be pretty convenient for debugging the issue. I have no idea what's going wrong here.
ThomasWaldmann commentedon Jan 2, 2015
i just tried a normal installation following the readme (no docker involved) and can confirm that m2crypto fails with os == None on first try. Second try somehow works...
kuba commentedon Jan 22, 2015
Seems like we are not the only project experiencing the issue, c.f. https://gist.github.com/abemusic/8958392#file-using-salt-s-m2crypto-dependency and http://irclog.perlgeek.de/salt/2014-02-12#i_8273472 (grep
abe_music). They suggest to set environmental variableUSE_SETUPTOOLS=1(as per http://docs.saltstack.com/en/latest/topics/development/hacking.html#installing-salt-from-the-python-package-index), but it doesn't seem to work for letsencrypt case.JensErat commentedon Jan 22, 2015
I can confirm that
USE_SETUPTOOLS=1 ./venv/bin/python setup.py installdoes not resolve the issue.kuba commentedon Jan 24, 2015
I was trying to narrow the problem down and have arrived at the following:
rm -rf venv; virtualenv --no-site-packages venv; ./venv/bin/python setup.py developworks fineinstall_requirescontains at least['zope.interface', 'pycrypto', 'M2Crypto'](install proceeds by installing them in that order), i.e. removing eitherzope.interfaceorpycryptofrominstall_requires"solves" the problemThomasWaldmann commentedon Jan 24, 2015
just a vague idea: did you try reordering install_requires so M2Crypto comes first?
kuba commentedon Jan 24, 2015
I believe that the order of items in
install_requiresdoes not matter (it's abstractly representing a set of dependencies) and in fact I have tested with lexicographically ordered dependencies:install_requires=['M2Crypto', 'pycrypto', 'zope.interface']Magical fix for certbot#152 (M2Crypto install dependency order)
kuba commentedon Jan 24, 2015
Pure magic. It seems like the order does matter, but M2Crypto has to go last, to be installed first... Could anyone please test kuba@6a4164a?
kuba commentedon Jan 24, 2015
#188 ready to pull
Merge pull request #188 from kuba/bugs/152
jdkasten commentedon Jan 25, 2015
@kuba solved this with #188 and fixed the problem. Thanks!
JensErat commentedon Jan 25, 2015
Also works for me now, thanks.
Merge pull request certbot#152 from certbot/issue_151
fix transact function (certbot#152)
Use transact function return value unless it is undefined (certbot#152)