Unable to run asadm in an Anaconda3 environment


#1

Hi,

I am trying to run command asadm in an Anaconda3 environment, but there is an error. When I remove the anaconda directory and delete the export command, it works ok.

How do I configure Aerospike to run asadm without error in the Anaconda3 environment?

Error information:

Traceback (most recent call last):
  File "/root/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/root/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/bin/asadm/__main_.py", line 15, in <module>
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 946, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 885, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1157, in find_and_spec
  File "<frozen importlib._bootstrap_external>", line 1131, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1112, in _legacy_get_spec
  File "<frozen importlib._bootstrap>", line 427, in spec_from_loader
  File "<frozen importlib._bootstrap_external>", line 544, in spec_from_file_location
  File "/usr/bin/asadm/asadm.py", line 46
    print "DEBUG: " + str(msg)
                  ^
                 
SyntaxError: invalid syntax

~/.bashrc:

export PATH="/root/anaconda3/bin:$PATH"

Thanks,

Lucy


#2

Looks to be a python 2 vs python 3 issue.

Try setting your anaconda environment to use Python 2 for asadm.


#3

The dependency on Python 2 is in the aerospike/aerospike-admin repo, though this isn’t clear when you install from the tools package.

Richard’s suggestion is probably better, but I personally use pyenv extensively, so I have both Python 2 and Python 3 installed, and switch to Python 2 when I use the various Aerospike command-line tools.