Support Questions
Find answers, ask questions, and share your expertise

HST Agent Stop throws 'ImportError: No module named shell'

Solved Go to solution

HST Agent Stop throws 'ImportError: No module named shell'

Contributor

Hello,

I'm having some issues installing HDP 3.0. My first install was incomplete and rather than try to fix all the individual errors I decided to wipe and re-install. I may have not done that correctly as I had many other issues. I was able to go through and solve many of them by creating symlinks or reinstalling services using yum install but there is one issue that is persisting. I'm not able to stop HST agent. I've been stuck on this for a while now and reaching out for help. The error is:

Failed to execute command:  /usr/sbin/hst unregister-agent; Exit code: 1; stdout: User root failed to execute command : /usr/sbin/hst unregister-agent 
; stderr: Traceback (most recent call last): File "/usr/sbin/hst-agent.py", line 22, in <module> import shell ImportError: No module named shell Failed to execute command: /usr/sbin/hst agent-status; Exit code: 1; stdout: User root failed to execute command : /usr/sbin/hst agent-status ; stderr: Traceback (most recent call last): File "/usr/sbin/hst-agent.py", line 22, in <module> import shell ImportError: No module named shell

It sounds like the needed python module is not being referenced for some reason. Note this is happenning on all nodes that DO NOT have ambari-server installed. Specifically there are 4 nodes, one has ambari-server and the other three have this issue.

Thanks in advance!!

Dan

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: HST Agent Stop throws 'ImportError: No module named shell'

Super Mentor

@Daniel Zafar

Can you please try to perform a "yum reinstall" on the mentioned package?

# yum reinstall smartsense-hst -y

.

The above mentioned error can occur if the HST installation is corrupted or if it has missing files like:

/usr/hdp/share/hst/hst-agent/lib/hst_agent/shell.py
/usr/hdp/share/hst/hst-agent/lib/hst_agent/shell.pyc

.

Also please share the output of the following command to verify if you see the correct "sys.path" when you run the below command [python -m site] like:

Example:

# python -m site 
sys.path = [
    '/root',
    '/usr/lib64/python27.zip',
    '/usr/lib64/python2.7',
    '/usr/lib64/python2.7/plat-linux2',
    '/usr/lib64/python2.7/lib-tk',
    '/usr/lib64/python2.7/lib-old',
    '/usr/lib64/python2.7/lib-dynload',
    '/usr/lib64/python2.7/site-packages',
    '/usr/lib/python2.7/site-packages',
]
USER_BASE: '/root/.local' (doesn't exist)
USER_SITE: '/root/.local/lib/python2.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True

.

View solution in original post

3 REPLIES 3
Highlighted

Re: HST Agent Stop throws 'ImportError: No module named shell'

Contributor

I've solved this. I mistakenly thought HST was related to ambari-agent, but it is a compnent of SmartSense. So I ran this on all affected nodes and my issue was resolved:

yum remove smartsense-hst
yum install smartsense-hst
Highlighted

Re: HST Agent Stop throws 'ImportError: No module named shell'

Super Mentor

@Daniel Zafar

Can you please try to perform a "yum reinstall" on the mentioned package?

# yum reinstall smartsense-hst -y

.

The above mentioned error can occur if the HST installation is corrupted or if it has missing files like:

/usr/hdp/share/hst/hst-agent/lib/hst_agent/shell.py
/usr/hdp/share/hst/hst-agent/lib/hst_agent/shell.pyc

.

Also please share the output of the following command to verify if you see the correct "sys.path" when you run the below command [python -m site] like:

Example:

# python -m site 
sys.path = [
    '/root',
    '/usr/lib64/python27.zip',
    '/usr/lib64/python2.7',
    '/usr/lib64/python2.7/plat-linux2',
    '/usr/lib64/python2.7/lib-tk',
    '/usr/lib64/python2.7/lib-old',
    '/usr/lib64/python2.7/lib-dynload',
    '/usr/lib64/python2.7/site-packages',
    '/usr/lib/python2.7/site-packages',
]
USER_BASE: '/root/.local' (doesn't exist)
USER_SITE: '/root/.local/lib/python2.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True

.

View solution in original post

Highlighted

Re: HST Agent Stop throws 'ImportError: No module named shell'

Contributor

@Jay Kumar SenSharma

Check out my comment above. I did exactly this yesterday and it solved my problem.