When I run the Python script below, I get this error message:
Traceback (most recent call last):
File "curator.py", line 2, in
import curator
File "/home/elasticsearch/curator.py", line 6, in
ilo = curator.IndexList(client)
AttributeError: 'module' object has no attribute 'IndexList'
This is the Python script:
import elasticsearch
import curator
client = elasticsearch.Elasticsearch()
ilo = curator.IndexList(client)
print(ilo.index_info)
I have Curator version 5.2.0 installed via YUM, Elasticsearch version 5.6.0, and Python 2.7.5.
I have Curator version 5.2.0 installed via YUM
This is the problem. The YUM package does not include the system python libraries/modules. It is a standalone version for running only.
You need to install via pip in order to have the libraries accessible for API use.
pip list | grep curator
You should see what version is installed that way.
You can upgrade via:
sudo pip install -U elasticsearch-curator
or
pip install -U --user elasticsearch-curator
to limit the installation to a local user (and not overwrite the system python libraries). Just remember that only the user that ran this will have that version of the Curator module installed.
PLEASE NOTE: You should not have both the pip version _and_ the YUM package simultaneously installed, so as to avoid confusion when calling curator at the command-line.
Thank you for your reply. I uninstalled the YUM package and installed Curator via pip. But I still have the same problem.
Which version of Curator is installed?
pip list | grep curator
5.2.0
And which version of Python?
2.7.5
Do me a favor, and run this:
$ python
Python 2.7.13 (default, Mar 19 2017, 12:50:26)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import curator
>>> curator._version.__version__
'5.2.0'
Do you see the same thing?
Ah! I figured it out! It wasn't letting me import curator because my Python script was named curator.py!
That would do it :)
Thanks for your help!
Thank you @jonathancoon I was doing the exact same thing.
Most helpful comment
Ah! I figured it out! It wasn't letting me import curator because my Python script was named curator.py!