Skip to content

When modules are moved, .pyc files can persist in the tree and cause havoc #482

Closed

Description

@pde

Running the client ("python ./setup.py install") from git gives:

letsencrypt
Traceback (most recent call last):
  File "/usr/local/bin/letsencrypt", line 9, in <module>
    load_entry_point('letsencrypt==0.1', 'console_scripts', 'letsencrypt')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])
  File "/usr/local/lib/python2.7/dist-packages/letsencrypt-0.1-py2.7.egg/letsencrypt/cli.py", line 17, in <module>
    from letsencrypt import configuration
  File "/usr/local/lib/python2.7/dist-packages/letsencrypt-0.1-py2.7.egg/letsencrypt/configuration.py", line 7, in <module>
    from letsencrypt import constants
  File "/usr/local/lib/python2.7/dist-packages/letsencrypt-0.1-py2.7.egg/letsencrypt/constants.py", line 26, in <module>
    dvsni_port=challenges.DVSNI.PORT,
AttributeError: type object 'DVSNI' has no attribute 'PORT'

Activity

  1. pde commented on Jun 6, 2015

    @pde
    MemberAuthor

    @kuba want to take this?

  2. pde commented on Jun 6, 2015

    @pde
    MemberAuthor

    Weird that it got past testing, though....

  3. kuba commented on Jun 7, 2015

    @kuba
    Contributor
  4. pde commented on Jun 16, 2015

    @pde
    MemberAuthor

    Running commands through venv does not fix the problem:

    pde@hostname:~/letsencrypt/lets-encrypt-preview$ virtualenv --no-site-packages -p python2 venv
    Running virtualenv with interpreter /usr/bin/python2
    New python executable in venv/bin/python2
    Not overwriting existing python script venv/bin/python (you must use venv/bin/python2)
    Installing setuptools, pip...done.
    
    pde@hostname:~/letsencrypt/lets-encrypt-preview$ ./venv/bin/pip install -r requirements.txt
    Obtaining file:///home/pde/eff/chocolate/chocolate/lets-encrypt-preview (from -r requirements.txt (line 3))
      Running setup.py (path:/home/pde/eff/chocolate/chocolate/lets-encrypt-preview/setup.py) egg_info for package from file:///home/pde/eff/chocolate/chocolate/lets-encrypt-preview
    
    Obtaining ConfigArgParse from git+https://github.com/kuba/[email protected]#egg=ConfigArgParse (from -r requirements.txt (line 2))
      Updating ./venv/src/configargparse clone (to python2.6)
      Running setup.py (path:/home/pde/eff/chocolate/chocolate/lets-encrypt-preview/venv/src/configargparse/setup.py) egg_info for package ConfigArgParse
    
      Installing extra requirements: 'egg'
    Requirement already satisfied (use --upgrade to upgrade): argparse in /usr/lib/python2.7 (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): configobj in ./venv/lib/python2.7/site-packages (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): jsonschema in ./venv/lib/python2.7/site-packages/jsonschema-2.4.0-py2.7.egg (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): mock in ./venv/lib/python2.7/site-packages/mock-1.0.1-py2.7.egg (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): ndg-httpsclient in ./venv/lib/python2.7/site-packages (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): parsedatetime in ./venv/lib/python2.7/site-packages (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): psutil>=2.1.0 in ./venv/lib/python2.7/site-packages/psutil-2.2.1-py2.7-linux-x86_64.egg (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): pyasn1 in ./venv/lib/python2.7/site-packages/pyasn1-0.1.7-py2.7.egg (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): pycrypto in ./venv/lib/python2.7/site-packages/pycrypto-2.6.1-py2.7-linux-x86_64.egg (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): PyOpenSSL>=0.15 in ./venv/lib/python2.7/site-packages (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): pyparsing>=1.5.5 in ./venv/lib/python2.7/site-packages (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): pyrfc3339 in ./venv/lib/python2.7/site-packages (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): python-augeas in ./venv/lib/python2.7/site-packages/python_augeas-0.5.0-py2.7.egg (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): python2-pythondialog>=3.2.2rc1 in ./venv/lib/python2.7/site-packages (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): pytz in ./venv/lib/python2.7/site-packages/pytz-2014.10-py2.7.egg (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): requests in ./venv/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): werkzeug in ./venv/lib/python2.7/site-packages (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): zope.component in ./venv/lib/python2.7/site-packages/zope.component-4.2.1-py2.7.egg (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): zope.interface in ./venv/lib/python2.7/site-packages/zope.interface-4.1.2-py2.7-linux-x86_64.egg (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): M2Crypto in ./venv/lib/python2.7/site-packages/M2Crypto-0.22.3-py2.7-linux-x86_64.egg (from letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): six in ./venv/lib/python2.7/site-packages/six-1.9.0-py2.7.egg (from configobj->letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): setuptools in ./venv/lib/python2.7/site-packages (from zope.component->letsencrypt==0.1->-r requirements.txt (line 3))
    Requirement already satisfied (use --upgrade to upgrade): zope.event in ./venv/lib/python2.7/site-packages/zope.event-4.0.3-py2.7.egg (from zope.component->letsencrypt==0.1->-r requirements.txt (line 3))
    Installing collected packages: ConfigArgParse, letsencrypt
      Running setup.py develop for ConfigArgParse
    
        Creating /home/pde/eff/chocolate/chocolate/lets-encrypt-preview/venv/lib/python2.7/site-packages/ConfigArgParse.egg-link (link to .)
        ConfigArgParse 0.9.4 is already the active version in easy-install.pth
    
        Installed /home/pde/eff/chocolate/chocolate/lets-encrypt-preview/venv/src/configargparse
      Running setup.py develop for letsencrypt
    
        Creating /home/pde/eff/chocolate/chocolate/lets-encrypt-preview/venv/lib/python2.7/site-packages/letsencrypt.egg-link (link to .)
        letsencrypt 0.1 is already the active version in easy-install.pth
        Installing letsencrypt script to /home/pde/eff/chocolate/chocolate/lets-encrypt-preview/venv/bin
        Installing jws script to /home/pde/eff/chocolate/chocolate/lets-encrypt-preview/venv/bin
        Installing letsencrypt-renewer script to /home/pde/eff/chocolate/chocolate/lets-encrypt-preview/venv/bin
    
        Installed /home/pde/eff/chocolate/chocolate/lets-encrypt-preview
    Successfully installed ConfigArgParse letsencrypt
    Cleaning up...
    
    pde@hostname:~/letsencrypt/lets-encrypt-preview$ ./venv/bin/letsencrypt -h
    Traceback (most recent call last):
      File "./venv/bin/letsencrypt", line 9, in <module>
        load_entry_point('letsencrypt==0.1', 'console_scripts', 'letsencrypt')()
      File "/home/pde/eff/chocolate/chocolate/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/pkg_resources.py", line 356, in load_entry_point
        return get_distribution(dist).load_entry_point(group, name)
      File "/home/pde/eff/chocolate/chocolate/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/pkg_resources.py", line 2476, in load_entry_point
        return ep.load()
      File "/home/pde/eff/chocolate/chocolate/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/pkg_resources.py", line 2190, in load
        ['__name__'])
      File "/home/pde/eff/chocolate/chocolate/lets-encrypt-preview/letsencrypt/cli.py", line 17, in <module>
        from letsencrypt import configuration
      File "/home/pde/eff/chocolate/chocolate/lets-encrypt-preview/letsencrypt/configuration.py", line 7, in <module>
        from letsencrypt import constants
      File "/home/pde/eff/chocolate/chocolate/lets-encrypt-preview/letsencrypt/constants.py", line 26, in <module>
        dvsni_port=challenges.DVSNI.PORT,
    AttributeError: type object 'DVSNI' has no attribute 'PORT'
    
  5. pde commented on Jun 16, 2015

    @pde
    MemberAuthor

    In this latter case it looks as though venv might preserved state from an older checkout of the repo? That's extremely weird behaviour.

    (Sorry I had a symlink over to that directory, there are no references to anything other than current git master code in that traceback)

  6. pde commented on Jun 16, 2015

    @pde
    MemberAuthor

    rm -rfing my venv/ directory and recreating it does not help.

  7. pde commented on Jun 16, 2015

    @pde
    MemberAuthor

    There were no fewer than 8 copies of challenges.py sitting in my tree. Only the ones in marked with a * were up to date:

    /home/pde/letsencrypt/lets-encrypt-preview/.tox/py26/lib/python2.6/site-packages/letsencrypt/acme/challenges.py
    /home/pde/letsencrypt/lets-encrypt-preview/.tox/lint/lib/python2.7/site-packages/letsencrypt/acme/challenges.py
    /home/pde/letsencrypt/lets-encrypt-preview/.tox/lint/lib/python2.7/site-packages/acme/challenges.py
    /home/pde/letsencrypt/lets-encrypt-preview/.tox/py27/lib/python2.7/site-packages/letsencrypt/acme/challenges.py
    /home/pde/letsencrypt/lets-encrypt-preview/.tox/cover/lib/python2.7/site-packages/letsencrypt/acme/challenges.py
    * /home/pde/letsencrypt/lets-encrypt-preview/acme/challenges.py
    /home/pde/letsencrypt/lets-encrypt-preview/build/lib.linux-x86_64-2.7/letsencrypt/acme/challenges.py
    */home/pde/letsencrypt/lets-encrypt-preview/build/lib.linux-x86_64-2.7/acme/challenges.py
    
  8. pde commented on Jun 16, 2015

    @pde
    MemberAuthor

    However I can delete all of them except the one in the main tree and still have the problem occur...

  9. pde commented on Jun 16, 2015

    @pde
    MemberAuthor

    Turns out the problem was the continued presence of a .pyc file from an old copy of challenges.py:
    find . -iname challenges*
    /home/pde/letsencrypt/lets-encrypt-preview/letsencrypt/acme/challenges.pyc
    /home/pde/letsencrypt/lets-encrypt-preview/letsencrypt/acme/challenges_test.pyc
    /home/pde/letsencrypt/lets-encrypt-preview/acme/challenges.py
    /home/pde/letsencrypt/lets-encrypt-preview/acme/challenges_test.py

  10. changed the title [-]DVSNI port implementation is broken[/-] [+]When modules are moved, .pyc files can persist in the tree and cause havoc[/+] on Jun 16, 2015
  11. added a commit that references this issue on Jun 16, 2015
  12. pde commented on Oct 20, 2015

    @pde
    MemberAuthor

    Closing this for now, will see if it anything like it pops up in deployment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions