visdom Install and Run Error: raise Connectionerror [How to Solve]

 

Install visdom

Switch to the environment corresponding to CONDA and use CONDA install visdom. An error is reported and the installation cannot be performed. After query, it is found that the installation can be successful using pip. For some reason, the command is as follows:

pip install visdom

Run visdom

If you want to use visdom in Python code, you must first start the visdom service in the CONDA environment where visdom is installed:

python -m visdom.server

After the service is started, the following prompt will be given:

39: DeprecationWarning: zmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops.
  ioloop.install()  # Needs to happen before any tornado imports!
Checking for scripts.
Downloading scripts, this may take a little while
It's Alive!
INFO:root:Application Started
You can navigate to http://localhost:8097

Then you can open it in the browser http://localhost:8097 Address and access visual content

If you do not run the above command, the following error will be reported:

Traceback (most recent call last):
  File "D:\program\conda\envs\python36_gan\lib\site-packages\visdom\__init__.py", line 711, in _send
    data=json.dumps(msg),
  File "D:\program\conda\envs\python36_gan\lib\site-packages\visdom\__init__.py", line 677, in _handle_post
    r = self.session.post(url, data=data)
  File "D:\program\conda\envs\python36_gan\lib\site-packages\requests\sessions.py", line 581, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "D:\program\conda\envs\python36_gan\lib\site-packages\requests\sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\program\conda\envs\python36_gan\lib\site-packages\requests\sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "D:\program\conda\envs\python36_gan\lib\site-packages\requests\adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8097): Max retries exceeded with url: /env/test1 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025
321093898>: Failed to establish a new connection: [WinError 10061] Unable to connect because the target computer actively refused.',))
[WinError 10061] Unable to connect because the target computer actively refused.
Exception in user code:
------------------------------------------------------------
Traceback (most recent call last):
  File "D:\program\conda\envs\python36_gan\lib\site-packages\urllib3\connection.py", line 157, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "D:\program\conda\envs\python36_gan\lib\site-packages\urllib3\util\connection.py", line 84, in create_connection
    raise err
  File "D:\program\conda\envs\python36_gan\lib\site-packages\urllib3\util\connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] Unable to connect because the target computer actively refused.

During handling of the above exception, another exception occurred:

Read More: