mpenning / ciscoconfparse

Parse, Audit, Query, Build, and Modify Arista / Cisco / Juniper / Palo Alto / F5 configurations.
http://www.pennington.net/py/ciscoconfparse/
GNU General Public License v3.0
793 stars 220 forks source link

Recursive ipaddr dependencies in ciscoconfparse breaks pip (version 1.2.11) #24

Closed alexd-siaras closed 9 years ago

alexd-siaras commented 9 years ago

Installation fails due to a failure to find ipaddr:

vagrant@controller:~$ uname -a
Linux controller 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
vagrant@controller:~$ pip --version
pip 6.0.8 from /usr/local/lib/python2.7/dist-packages (python 2.7)
vagrant@controller:~$ python --version
Python 2.7.6
vagrant@controller:~$ sudo pip install ciscoconfparse
The directory '/home/vagrant/.cache/pip/log' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
The directory '/home/vagrant/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
The directory '/home/vagrant/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
Collecting ciscoconfparse
  Downloading ciscoconfparse-1.2.11.tar.gz (225kB)
    100% |################################| 225kB 457kB/s
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-QXc5qg/ciscoconfparse/setup.py", line 12, in <module>
        from ciscoconfparse.ciscoconfparse import __version__ as __ccpversion__
      File "ciscoconfparse/__init__.py", line 1, in <module>
        from ciscoconfparse import *
      File "ciscoconfparse/ciscoconfparse.py", line 8, in <module>
        from models_cisco import IOSHostnameLine, IOSRouteLine, IOSIntfLine
      File "ciscoconfparse/models_cisco.py", line 5, in <module>
        from ccp_abc import BaseCfgLine
      File "ciscoconfparse/ccp_abc.py", line 7, in <module>
        from ccp_util import IPv4Obj
      File "ciscoconfparse/ccp_util.py", line 14, in <module>
        from ipaddr import IPv4Network, IPv6Network, IPv4Address, IPv6Address
    ImportError: No module named ipaddr
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

      File "<string>", line 20, in <module>

      File "/tmp/pip-build-QXc5qg/ciscoconfparse/setup.py", line 12, in <module>

        from ciscoconfparse.ciscoconfparse import __version__ as __ccpversion__

      File "ciscoconfparse/__init__.py", line 1, in <module>

        from ciscoconfparse import *

      File "ciscoconfparse/ciscoconfparse.py", line 8, in <module>

        from models_cisco import IOSHostnameLine, IOSRouteLine, IOSIntfLine

      File "ciscoconfparse/models_cisco.py", line 5, in <module>

        from ccp_abc import BaseCfgLine

      File "ciscoconfparse/ccp_abc.py", line 7, in <module>

        from ccp_util import IPv4Obj

      File "ciscoconfparse/ccp_util.py", line 14, in <module>

        from ipaddr import IPv4Network, IPv6Network, IPv4Address, IPv6Address

    ImportError: No module named ipaddr

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-QXc5qg/ciscoconfparse

Looks to be associated with this commit:

https://github.com/mpenning/ciscoconfparse/commit/bd0a8b165b0740f9a050cc9f36042d42513f680a

mpenning commented 9 years ago

The problem is only loosely related to the commit you referenced; the referenced commit was part of my first attempt to undo the old local_py kludge fixes in the repo.

The root of the problem was a recursive dependency in setup.py and ciscoconfparse/__init__.py; I used local_py because I did not notice the recursive deps. Props to @CrackerJackMack, who hawkeye'd the issue in 30 seconds.

This is fixed in ciscoconfparse version 1.2.12.