Mordecai:无法连接到本地运行的Elasticsearch容器

2024-06-26 14:13:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在从事一个NLP项目,并想尝试莫尔德凯作为一名地质勘探员。然而,在一个EC2实例上设置该模块花费了相当多的精力之后,我遇到了一些网络问题,使我无法使用它

具体来说,当我启动Elasticsearch容器,然后尝试初始化geoparser时,会出现以下错误:

2021-03-19 20:37:58.635480: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-03-19 20:37:58.661873: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2021-03-19 20:37:58.663206: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
2021-03-19 20:37:58.664572: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (ip-172-31-79-96): /proc/driver/nvidia/version does not exist
2021-03-19 20:37:58.668768: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-03-19 20:37:58.668930: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
GET http://localhost:9200/geonames/_count [status:N/A request:0.002s]
Traceback (most recent call last):
  File "/home/ec2-user/.local/lib/python3.6/site-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/home/ec2-user/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

我怀疑这个错误与我的网络设置有关,但我真的不知道如何解决它或从哪里开始

作为参考,使我达到这一点的一组命令是:

sudo zypper --non-interactive install python3-pip # install pip3 

pip3 install mordecai # install mordecai 

python3 -m spacy download en_core_web_lg # install the missing spacy model 

pip3 install -I h5py==2.10.0 # install the keras-compatible h5py version

sudo systemctl start docker # start docker  

sudo docker pull elasticsearch:5.5.2 # pull the elasticsearch image 

wget https://andrewhalterman.com/files/geonames_index.tar.gz --output-file=wget_log.txt # Get the geoparser files 

tar -xzf geonames_index.tar.gz # Extract the tarball 

docker run -d -p 127.0.0.1:9200:9200 -v $(pwd)/geonames_index/:/usr/share/elasticsearch/data elasticsearch:5.5.2 # Run the docker container 

python3
Python 3.6.12 (default, Nov 25 2020, 20:33:10) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mordecai import Geoparser
2021-03-19 20:42:19.507212: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2021-03-19 20:42:19.507253: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
>>> geo = Geoparser()

这是在SUSE Linux EC2实例上运行的

在尝试使用geo=geoparser()初始化geoparser之后,我得到了上面发布的错误。我不太确定如何解决这个问题,如果您有任何见解,我将不胜感激。我是Docker的新手,我知道这可能与我如何在主机上设置容器或网络有关

提前谢谢你


Tags: installthedockerinstreamtensorflownotconnection