Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Ambari-server setup v2.4.1.0 Error 'cannot import name parse_log4j_file'

avatar
Rising Star

I am facing issue while setting up Ambari server v2.4.1.0 and Python 2.6.6. I followed steps listed in below thread but that didn't helped. If install lower version of Ambari server v2.2.2 it is working fine, but any versiov 2.4.* failing with same error.

https://community.hortonworks.com/questions/67196/ambari-server-setup-error-cannot-import-name-parse...

1 ACCEPTED SOLUTION

avatar
Rising Star

Hi @Artem Ervits .. I have deployed Ambari server v2.4.2 on a brand new machine and it worked. Not sure what was the issue on the server where we already have ambari-agent v 2.2.2 is installed. Removing agents and also cleaning up directories didn't helped to completely resolve the issue. Thanks a lot for your help !!

View solution in original post

5 REPLIES 5

avatar

@Saikiran Parepally

Can you uninstall Ambari-server and clean up all the folders by searching with following commands?

find / -name "ambari-server"

avatar
Master Mentor

@Saikiran Parepally in your error

Traceback (most recent call last): File "/usr/sbin/ambari-server.py", line 33, in from ambari_server.dbConfiguration import DATABASE_NAMES, LINUX_DBMS_KEYS_LIST File "/usr/lib/python2.6/site-packages/ambari_server/dbConfiguration.py", line 28, in from ambari_server.serverConfiguration import decrypt_password_for_alias, get_ambari_properties, get_is_secure, \ File "/usr/lib/python2.6/site-packages/ambari_server/serverConfiguration.py", line 36, in from ambari_commons.os_utils import run_os_command, search_file, set_file_permissions, parse_log4j_file ImportError: cannot import name parse_log4j_file

can you check in /usr/lib/python2.6/site-packages/ambari_commons directory whether you have a file called os_utils.py

in that file you should have a function

def parse_log4j_file(filename):

if you don't, you should

yum remove ambari-server ambari-agent
rm -rf /usr/lib/python2.6/site-packages/ambari_commons
yum install ambari-server ambari-agent

then check in that directory again to see if that file (os_utils.py) exists.

I'm also urging you to install Ambari 2.4.2 instead of 2.4.1 as that was found to contain critical bugs. Also, can you tell us what OS you're running?

Depending on the OS, it matters what version of Python you're running. http://docs.hortonworks.com/HDPDocuments/Ambari-2.4.2.0/bk_ambari-installation/content/software_requ...

avatar
Rising Star

@Artem Ervits I have followed the above listed steps and initial error is resolved. But I see new error message. (We are using RedHat 6.6 version of OS and Python 2.6.6)

[root@pxnhd539 views]# ambari-server setup Using python /usr/bin/python Setup ambari-server Traceback (most recent call last): File "/usr/sbin/ambari-server.py", line 37, in <module> from ambari_server.serverUpgrade import upgrade, upgrade_stack, set_current File "/usr/lib/python2.6/site-packages/ambari_server/serverUpgrade.py", line 50, in <module> from ambari_server.setupMpacks import replay_mpack_logs File "/usr/lib/python2.6/site-packages/ambari_server/setupMpacks.py", line 41, in <module> from resource_management.libraries.functions.tar_archive import extract_archive, get_archive_root_dir ImportError: cannot import name extract_archive

avatar
Master Mentor

I would remove Ambari and agents, delete the whole directory /usr/lib/python2.6/site-packages/ambari* and try again

avatar
Rising Star

Hi @Artem Ervits .. I have deployed Ambari server v2.4.2 on a brand new machine and it worked. Not sure what was the issue on the server where we already have ambari-agent v 2.2.2 is installed. Removing agents and also cleaning up directories didn't helped to completely resolve the issue. Thanks a lot for your help !!