Rabbitmq hello world connection doesn't work on localhost
Question: I take hello world example from tutorial:

    
    
    import pika
    
    connection = pika.BlockingConnection(pika.ConnectionParameters(
            host='localhost'))
    channel = connection.channel()
    
    channel.queue_declare(queue='hello')
    
    channel.basic_publish(exchange='',
                          routing_key='hello',
                          body='Hello World!')
    print(" [x] Sent 'Hello World!'")
    connection.close()
    

got error: it shouldn't be a grant user problem cause guest/guest should be
able to connect for localhost

    
    
    Traceback (most recent call last):
      File "send.py", line 4, in <module>
        host='localhost'))
      File "/Library/Python/2.7/site-packages/pika/adapters/blocking_connection.py", line 339, in __init__
        self._process_io_for_connection_setup()
      File "/Library/Python/2.7/site-packages/pika/adapters/blocking_connection.py", line 374, in _process_io_for_connection_setup
        self._open_error_result.is_ready)
      File "/Library/Python/2.7/site-packages/pika/adapters/blocking_connection.py", line 410, in _flush_output
        self._impl.ioloop.poll()
      File "/Library/Python/2.7/site-packages/pika/adapters/select_connection.py", line 528, in poll
        self._process_fd_events(fd_event_map, write_only)
      File "/Library/Python/2.7/site-packages/pika/adapters/select_connection.py", line 443, in _process_fd_events
        handler(fileno, events, write_only=write_only)
      File "/Library/Python/2.7/site-packages/pika/adapters/base_connection.py", line 364, in _handle_events
        self._handle_read()
      File "/Library/Python/2.7/site-packages/pika/adapters/base_connection.py", line 412, in _handle_read
        return self._handle_disconnect()
      File "/Library/Python/2.7/site-packages/pika/adapters/base_connection.py", line 288, in _handle_disconnect
        self._adapter_disconnect()
      File "/Library/Python/2.7/site-packages/pika/adapters/select_connection.py", line 95, in _adapter_disconnect
        super(SelectConnection, self)._adapter_disconnect()
      File "/Library/Python/2.7/site-packages/pika/adapters/base_connection.py", line 154, in _adapter_disconnect
        self._check_state_on_disconnect()
      File "/Library/Python/2.7/site-packages/pika/adapters/base_connection.py", line 173, in _check_state_on_disconnect
        raise exceptions.ProbableAuthenticationError
    pika.exceptions.ProbableAuthenticationError
    

here is the rabbitmq environment:

    
    
    Application environment of node 'rabbit@xuches-Air' ...
    [{kernel,[{error_logger,tty},
              {inet_default_connect_options,[{nodelay,true}]},
              {inet_dist_listen_max,25672},
              {inet_dist_listen_min,25672}]},
     {mnesia,[{dir,"/usr/local/bin/rabbitmq_server-3.6.2/var/lib/rabbitmq/mnesia/rabbit@xuches-Air"}]},
     {os_mon,[{start_cpu_sup,false},
              {start_disksup,false},
              {start_memsup,false},
              {start_os_sup,false}]},
     {rabbit,[{auth_backends,[rabbit_auth_backend_internal]},
              {auth_mechanisms,['PLAIN','AMQPLAIN']},
              {backing_queue_module,rabbit_priority_queue},
              {channel_max,0},
              {channel_operation_timeout,15000},
              {cluster_keepalive_interval,10000},
              {cluster_nodes,{[],disc}},
              {cluster_partition_handling,ignore},
              {collect_statistics,none},
              {collect_statistics_interval,5000},
              {credit_flow_default_credit,{200,50}},
              {default_permissions,[<<".*">>,<<".*">>,<<".*">>]},
              {default_user,<<"guest">>},
              {default_user_tags,[administrator]},
              {default_vhost,<<"/">>},
              {delegate_count,16},
              {disk_free_limit,50000000},
              {enabled_plugins_file,"/usr/local/bin/rabbitmq_server-3.6.2/etc/rabbitmq/enabled_plugins"},
              {error_logger,{file,"/usr/local/bin/rabbitmq_server-3.6.2/var/log/rabbitmq/rabbit@xuches-Air.log"}},
              {fhc_read_buffering,false},
              {fhc_write_buffering,true},
              {frame_max,131072},
              {halt_on_upgrade_failure,true},
              {handshake_timeout,10000},
              {heartbeat,60},
              {hipe_compile,false},
              {hipe_modules,[rabbit_reader,rabbit_channel,gen_server2,
                             rabbit_exchange,rabbit_command_assembler,
                             rabbit_framing_amqp_0_9_1,rabbit_basic,rabbit_event,
                             lists,queue,priority_queue,rabbit_router,
                             rabbit_trace,rabbit_misc,rabbit_binary_parser,
                             rabbit_exchange_type_direct,rabbit_guid,rabbit_net,
                             rabbit_amqqueue_process,rabbit_variable_queue,
                             rabbit_binary_generator,rabbit_writer,delegate,
                             gb_sets,lqueue,sets,orddict,rabbit_amqqueue,
                             rabbit_limiter,gb_trees,rabbit_queue_index,
                             rabbit_exchange_decorator,gen,dict,ordsets,
                             file_handle_cache,rabbit_msg_store,array,
                             rabbit_msg_store_ets_index,rabbit_msg_file,
                             rabbit_exchange_type_fanout,
                             rabbit_exchange_type_topic,mnesia,mnesia_lib,rpc,
                             mnesia_tm,qlc,sofs,proplists,credit_flow,pmon,
                             ssl_connection,tls_connection,ssl_record,tls_record,
                             gen_fsm,ssl]},
              {log_levels,[{connection,info}]},
              {loopback_users,[<<"guest">>]},
              {memory_monitor_interval,2500},
              {mirroring_flow_control,true},
              {mirroring_sync_batch_size,4096},
              {mnesia_table_loading_timeout,30000},
              {msg_store_credit_disc_bound,{2000,500}},
              {msg_store_file_size_limit,16777216},
              {msg_store_index_module,rabbit_msg_store_ets_index},
              {msg_store_io_batch_size,2048},
              {num_ssl_acceptors,1},
              {num_tcp_acceptors,10},
              {password_hashing_module,rabbit_password_hashing_sha256},
              {plugins_dir,"/usr/local/bin/rabbitmq_server-3.6.2/plugins"},
              {plugins_expand_dir,"/usr/local/bin/rabbitmq_server-3.6.2/var/lib/rabbitmq/mnesia/rabbit@xuches-Air-plugins-expand"},
              {queue_index_embed_msgs_below,4096},
              {queue_index_max_journal_entries,32768},
              {reverse_dns_lookups,false},
              {sasl_error_logger,{file,"/usr/local/bin/rabbitmq_server-3.6.2/var/log/rabbitmq/rabbit@xuches-Air-sasl.log"}},
              {server_properties,[]},
              {ssl_allow_poodle_attack,false},
              {ssl_apps,[asn1,crypto,public_key,ssl]},
              {ssl_cert_login_from,distinguished_name},
              {ssl_handshake_timeout,5000},
              {ssl_listeners,[]},
              {ssl_options,[]},
              {tcp_listen_options,[{backlog,128},
                                   {nodelay,true},
                                   {linger,{true,0}},
                                   {exit_on_close,false}]},
              {tcp_listeners,[5672]},
              {trace_vhosts,[]},
              {vm_memory_high_watermark,0.4},
              {vm_memory_high_watermark_paging_ratio,0.5}]},
     {rabbit_common,[]},
     {ranch,[]},
     {sasl,[{errlog_type,error},{sasl_error_logger,false}]},
     {stdlib,[]},
     {xmerl,[]}]
    

Anyone has an idea what is problem?


Answer: This is an authentication problem, please read:

[Can't access RabbitMQ web management interface after fresh
install](http://stackoverflow.com/questions/22850546/cant-access-rabbitmq-web-
management-interface-after-fresh-install/22854222#22854222)

and this:

[RabbitMQ 3.3.1 can not login with
guest/guest](http://stackoverflow.com/questions/23669780/rabbitmq-3-3-1-can-
not-login-with-guest-guest)

If you have enabled the management UI try to access on the management UI
using:

<http://your_machine_ip:15672/>

using `guest` `guest`

btw I suggest to create an user to access externally. as described he:
[RabbitMQ 3.3.1 can not login with
guest/guest](http://stackoverflow.com/questions/23669780/rabbitmq-3-3-1-can-
not-login-with-guest-guest)

