jupyterhub / jupyterhub-deploy-teaching

Reference deployment of JupyterHub and nbgrader on a single server
http://jupyterhub-deploy-teaching.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
247 stars 85 forks source link

Error with conda.py #77

Closed zodiacfireworks closed 5 years ago

zodiacfireworks commented 7 years ago

Hi! First of all, thanks for this great job.

I'm getting a lot of errors of this kind

failed: [sapho - longwing](item = ipywidgets) => {
    "failed": true,
    "item": "ipywidgets",
    "module_stderr": "\
        OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g  1 Mar 2016    \
        debug1: Reading configuration data /etc/ssh/ssh_config    \
        debug1: /etc/ssh/ssh_config line 19: Applying options for *    \
        debug1: auto-mux: Trying existing master    \
        debug2: fd 3 setting O_NONBLOCK    \
        debug2: mux_client_hello_exchange: master version 4    \
        debug3: mux_client_forwards: request forwardings: 0 local, 0 remote    \
        debug3: mux_client_request_session: entering    \
        debug3: mux_client_request_alive: entering    \
        debug3: mux_client_request_alive: done pid = 897    \
        debug3: mux_client_request_session: session request sent    \
        debug1: mux_client_request_session: master session id: 2    \
        debug3: mux_client_read_packet: read header failed: Broken pipe    \
        debug2: Received exit status from master 0    \
        Shared connection to sapho-longwing closed.    \
    ",
    "module_stdout": "\
        Traceback (most recent call last):    \
          File \"/tmp/ansible_dRn5ki/ansible_module_conda.py\", line 296, in <module>    \
            main()    \
          File \"/tmp/ansible_dRn5ki/ansible_module_conda.py\", line 281, in main    \
            installed, installed_version = _check_installed(module, conda, name)    \
          File \"/tmp/ansible_dRn5ki/ansible_module_conda.py\", line 141, in _check_installed    \
            pname, pversion, pdist = other.rsplit('-', 2)    \
        AttributeError: 'dict' object has no attribute 'rsplit'    \
    ",
    "msg": "MODULE FAILURE",
    "rc": 0
}

With many packages. The problem is that sometimes object becomes a dict object. In thos case I solved the problem with this

if isinstance(other, dict):
    pname = other.get('name', '') 
    pversion = other.get('version', '') 
else:
    pname, pversion, pdist = other.rsplit('-', 2)
danielballan commented 7 years ago

I have seen this error but found it to be transient (??!) and not often repeatable.

zodiacfireworks commented 7 years ago

Hi @danielballan, this error was no transient to me, It have been appearing many times while I was testing this package.

anaderi commented 7 years ago

the error repeats here as well. NB: when I was installing deploy.xml on Ubuntu 14 all passed smoothly, but for Ubuntu 16.04.2 the error showed up (default python 3.5.2)

The fix by @zodiacfireworks has sovled the issue, thanks!