Skip to content

Unable to install pack -- PySwitchLib module has a bug #22

Description

@ScottJWalter

While attempting to install this pack on st2. I'm hitting the following:

$ st2 pack install network_essentials

For the "network_essentials" pack, the following content will be registered:

actions   |  69
rules     |  0
sensors   |  0
aliases   |  1
triggers  |  0

Installation may take a while for packs with many items.

        [ succeeded ] init_task
        [ succeeded ] download_pack
        [ succeeded ] make_a_prerun
        [ succeeded ] get_pack_dependencies
        [ succeeded ] check_dependency_and_conflict_list
        [  failed   ] install_pack_requirements

id: 5ee9252318b906142e4422b9
action.ref: packs.install
parameters:
  packs:
  - network_essentials
  python3: false
status: failed
start_timestamp: Tue, 16 Jun 2020 20:01:39 UTC
end_timestamp: Tue, 16 Jun 2020 20:02:28 UTC
result:
  errors:
  - message: Execution failed. See result for details.
    result:
      exit_code: 1
      result: None
      stderr: "st2.actions.python.SetupVirtualEnvironmentAction: DEBUG    Setting up virtualenv for pack "network_essentials" (/opt/stackstorm/packs/network_essentials)
st2.actions.python.SetupVirtualEnvironmentAction: DEBUG    Removing virtualenv in "/opt/stackstorm/virtualenvs/network_essentials"
st2.actions.python.SetupVirtualEnvironmentAction: DEBUG    Creating virtualenv for pack "network_essentials" in "/opt/stackstorm/virtualenvs/network_essentials"
st2.actions.python.SetupVirtualEnvironmentAction: DEBUG    Creating virtualenv in "/opt/stackstorm/virtualenvs/network_essentials" using Python binary "/opt/stackstorm/st2/bin/python"
st2.actions.python.SetupVirtualEnvironmentAction: DEBUG    Running command "/opt/stackstorm/st2/bin/virtualenv -p /opt/stackstorm/st2/bin/python --always-copy --no-download /opt/stackstorm/virtualenvs/network_essentials" to create virtualenv.
st2.actions.python.SetupVirtualEnvironmentAction: DEBUG    Installing base requirements
st2.actions.python.SetupVirtualEnvironmentAction: DEBUG    Installing requirement six>=1.9.0,<2.0 with command /opt/stackstorm/virtualenvs/network_essentials/bin/pip install six>=1.9.0,<2.0.
st2.actions.python.SetupVirtualEnvironmentAction: DEBUG    Installing pack specific requirements from "/opt/stackstorm/packs/network_essentials/requirements.txt"
st2.actions.python.SetupVirtualEnvironmentAction: DEBUG    Installing requirements from file /opt/stackstorm/packs/network_essentials/requirements.txt with command /opt/stackstorm/virtualenvs/network_essentials/bin/pip install -U -r /opt/stackstorm/packs/network_essentials/requirements.txt.
Traceback (most recent call last):
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/python_runner/python_action_wrapper.py", line 333, in <module>
    obj.run()
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/python_runner/python_action_wrapper.py", line 192, in run
    output = action.run(**self._parameters)
  File "/opt/stackstorm/packs/packs/actions/pack_mgmt/setup_virtualenv.py", line 88, in run
    no_download=no_download)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/st2common/util/virtualenvs.py", line 122, in setup_pack_virtualenv
    logger=logger)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/st2common/util/virtualenvs.py", line 272, in install_requirements
    (requirements_file_path, stdout, stderr))
Exception: Failed to install requirements from "/opt/stackstorm/packs/network_essentials/requirements.txt": Collecting netmiko==1.4.3 (from -r /opt/stackstorm/packs/network_essentials/requirements.txt (line 1))
  Using cached https://files.pythonhosted.org/packages/e7/55/504af141cee04f2bfb791021a4220f16abdcb230dd576376b2d70d8ee252/netmiko-1.4.3.tar.gz
Collecting pyswitchlib from git+https://github.com/extremenetworks/PySwitchLib.git@v1.2.2#egg=pyswitchlib (from -r /opt/stackstorm/packs/network_essentials/requirements.txt (line 2))
  Cloning https://github.com/extremenetworks/PySwitchLib.git (to revision v1.2.2) to /tmp/pip-install-zm6pzhst/pyswitchlib
 (stderr:   Running command git clone -q https://github.com/extremenetworks/PySwitchLib.git /tmp/pip-install-zm6pzhst/pyswitchlib
  Running command git checkout -b v1.2.2 --track origin/v1.2.2
  Switched to a new branch 'v1.2.2'
  Branch 'v1.2.2' set up to track remote branch 'v1.2.2' from 'origin'.
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-zm6pzhst/pyswitchlib/setup.py", line 44
        os.makedirs(pyswitchlib_etc_path)
                                        ^
    TabError: inconsistent use of tabs and spaces in indentation
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-zm6pzhst/pyswitchlib/
WARNING: You are using pip version 19.1.1, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
)
"
      stdout: ''
    task_id: install_pack_requirements
    type: error
  output:
    conflict_list: []
    message: ''
    packs_list:
    - network_essentials
+--------------------------+------------------------+-------------------------+-------------------------+------------------------+
| id                       | status                 | task                    | action                  | start_timestamp        |
+--------------------------+------------------------+-------------------------+-------------------------+------------------------+
| 5ee92524de38fa387d0c8540 | succeeded (0s elapsed) | init_task               | core.noop               | Tue, 16 Jun 2020       |
|                          |                        |                         |                         | 20:01:40 UTC           |
| 5ee92525de38fa387d0c8543 | succeeded (2s elapsed) | download_pack           | packs.download          | Tue, 16 Jun 2020       |
|                          |                        |                         |                         | 20:01:41 UTC           |
| 5ee92528de38fa387d0c8546 | succeeded (1s elapsed) | make_a_prerun           | packs.virtualenv_prerun | Tue, 16 Jun 2020       |
|                          |                        |                         |                         | 20:01:44 UTC           |
| 5ee9252ade38fa387d0c8549 | succeeded (1s elapsed) | get_pack_dependencies   | packs.get_pack_dependen | Tue, 16 Jun 2020       |
|                          |                        |                         | cies                    | 20:01:46 UTC           |
| 5ee9252cde38fa387d0c854c | succeeded (0s elapsed) | check_dependency_and_co | core.noop               | Tue, 16 Jun 2020       |
|                          |                        | nflict_list             |                         | 20:01:48 UTC           |
| 5ee9252dde38fa387d0c854f | failed (38s elapsed)   | install_pack_requiremen | packs.setup_virtualenv  | Tue, 16 Jun 2020       |
|                          |                        | ts                      |                         | 20:01:49 UTC           |
+--------------------------+------------------------+-------------------------+-------------------------+------------------------+
$ 

Looks like the pyswitchlib module had a tab-indented line in it's setup.py file.

I've already submitted a PR to the pyswitchlib project to fix the problem on their end, but even once they merge it, it'll probably change the version number so a future PR here is likely.

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