Closed lantongxue closed 3 years ago
if i set /etc/hosts
localhost to 10.0.0.16 it's normal, no any errors.
hello,I just installed redis in python, but when I use the redis to fetch my data in localhost as 127.0.0.1,show connection refused error as you,can you help me?Thanks!
Traceback (most recent call last):
File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 559, in connect
sock = self._connect()
File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 615, in _connect
raise err
File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 603, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/gz/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module>
cli.main()
File "/home/gz/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 444, in main
run()
File "/home/gz/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/pcdseg.py", line 242, in <module>
evaluate(args)
File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/pcdseg.py", line 229, in evaluate
acc, miou = test_kitti_semseg(model.eval(), testdataloader,args.model_name,num_classes,class_names)
File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/pcdseg.py", line 64, in test_kitti_semseg
for points, target in tqdm(loader, total=len(loader), smoothing=0.9, dynamic_ncols=True):
File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/tqdm/std.py", line 1166, in __iter__
for obj in iterable:
File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 435, in __next__
data = self._next_data()
File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 475, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/data_utils/SemKITTI_Loader.py", line 92, in __getitem__
point_cloud, label = self.get_data(self.keys[index])
File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/data_utils/SemKITTI_Loader.py", line 77, in get_data
if not self.np_redis.exists(key):
File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/data_utils/redis_utils.py", line 49, in exists
return bool(self.handle.execute_command('EXISTS ' + key))
File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/client.py", line 898, in execute_command
conn = self.connection or pool.get_connection(command_name, **options)
File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 1192, in get_connection
connection.connect()
File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 563, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.
hello,I just installed redis in python, but when I use the redis to fetch my data in localhost as 127.0.0.1,show connection refused error as you,can you help me?Thanks!
Traceback (most recent call last): File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 559, in connect sock = self._connect() File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 615, in _connect raise err File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 603, in _connect sock.connect(socket_address) ConnectionRefusedError: [Errno 111] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/gz/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module> cli.main() File "/home/gz/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 444, in main run() File "/home/gz/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 285, in run_file runpy.run_path(target_as_str, run_name=compat.force_str("__main__")) File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 265, in run_path return _run_module_code(code, init_globals, run_name, File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 97, in _run_module_code _run_code(code, mod_globals, init_globals, File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/pcdseg.py", line 242, in <module> evaluate(args) File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/pcdseg.py", line 229, in evaluate acc, miou = test_kitti_semseg(model.eval(), testdataloader,args.model_name,num_classes,class_names) File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/pcdseg.py", line 64, in test_kitti_semseg for points, target in tqdm(loader, total=len(loader), smoothing=0.9, dynamic_ncols=True): File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/tqdm/std.py", line 1166, in __iter__ for obj in iterable: File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 435, in __next__ data = self._next_data() File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 475, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/data_utils/SemKITTI_Loader.py", line 92, in __getitem__ point_cloud, label = self.get_data(self.keys[index]) File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/data_utils/SemKITTI_Loader.py", line 77, in get_data if not self.np_redis.exists(key): File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/data_utils/redis_utils.py", line 49, in exists return bool(self.handle.execute_command('EXISTS ' + key)) File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/client.py", line 898, in execute_command conn = self.connection or pool.get_connection(command_name, **options) File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 1192, in get_connection connection.connect() File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 563, in connect raise ConnectionError(self._error_message(e)) redis.exceptions.ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.
Are you also running a redis-server on your machine? Checkout: https://redis.io/topics/quickstart
hello,I just installed redis in python, but when I use the redis to fetch my data in localhost as 127.0.0.1,show connection refused error as you,can you help me?Thanks!
Traceback (most recent call last): File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 559, in connect sock = self._connect() File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 615, in _connect raise err File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 603, in _connect sock.connect(socket_address) ConnectionRefusedError: [Errno 111] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/gz/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module> cli.main() File "/home/gz/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 444, in main run() File "/home/gz/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 285, in run_file runpy.run_path(target_as_str, run_name=compat.force_str("__main__")) File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 265, in run_path return _run_module_code(code, init_globals, run_name, File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 97, in _run_module_code _run_code(code, mod_globals, init_globals, File "/home/gz/anaconda3/envs/pc/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/pcdseg.py", line 242, in <module> evaluate(args) File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/pcdseg.py", line 229, in evaluate acc, miou = test_kitti_semseg(model.eval(), testdataloader,args.model_name,num_classes,class_names) File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/pcdseg.py", line 64, in test_kitti_semseg for points, target in tqdm(loader, total=len(loader), smoothing=0.9, dynamic_ncols=True): File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/tqdm/std.py", line 1166, in __iter__ for obj in iterable: File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 435, in __next__ data = self._next_data() File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 475, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/data_utils/SemKITTI_Loader.py", line 92, in __getitem__ point_cloud, label = self.get_data(self.keys[index]) File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/data_utils/SemKITTI_Loader.py", line 77, in get_data if not self.np_redis.exists(key): File "/home/gz/桌面/3DCVcode/segmentation/PointNet12KiTTI/data_utils/redis_utils.py", line 49, in exists return bool(self.handle.execute_command('EXISTS ' + key)) File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/client.py", line 898, in execute_command conn = self.connection or pool.get_connection(command_name, **options) File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 1192, in get_connection connection.connect() File "/home/gz/anaconda3/envs/pc/lib/python3.8/site-packages/redis/connection.py", line 563, in connect raise ConnectionError(self._error_message(e)) redis.exceptions.ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.
sorry i cant help you .
@lantongxue What version of python were you using? Using your example, I would expect to receive a syntax error as you're passing in a positional keyword second.
>>> redis.Redis(host='10.0.0.1', 6379)
File "<stdin>", line 1
redis.Redis(host='10.0.0.1', 6379)
^
SyntaxError: positional argument follows keyword argument
With python 3.6, 3.7, 3.8, and 3.9 using the code above, (and disabling my redis-server) I properly receive:
redis.exceptions.ConnectionError: Error 111 connecting to 10.0.0.1:6379. Connection refused.
This sounds environmental.
initiate the redis server by redis-server
Version: redis-py: 3.5.3. redis: 5.0.7 Platform: Ubuntu 20.04 Description: I set the redis server is 10.0.0.16
but it's connect error, the error message
I dont know why it's
localhost:6379
??