Skip to content
Advertisement

Cannot connect to localhost:63342 when using matplotlib in PyCharm’s Python scientific plotting

My PyCharm’s scientific plotting mode doesn’t work on localhost (not remote). It reports:

Error: failed to send plot to http://127.0.0.1:63342
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm_display/datalore/display/display_.py", line 60, in _send_display_message
    urlopen(url, buffer)
  File "/Users/endaytrer/.conda/envs/NewProject/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/Users/endaytrer/.conda/envs/NewProject/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/Users/endaytrer/.conda/envs/NewProject/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/Users/endaytrer/.conda/envs/NewProject/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/Users/endaytrer/.conda/envs/NewProject/lib/python3.8/urllib/request.py", line 1379, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/Users/endaytrer/.conda/envs/NewProject/lib/python3.8/urllib/request.py", line 1354, in do_open
    r = h.getresponse()
  File "/Users/endaytrer/.conda/envs/NewProject/lib/python3.8/http/client.py", line 1332, in getresponse
    response.begin()
  File "/Users/endaytrer/.conda/envs/NewProject/lib/python3.8/http/client.py", line 303, in begin
    version, status, reason = self._read_status()
  File "/Users/endaytrer/.conda/envs/NewProject/lib/python3.8/http/client.py", line 272, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

My matplotlib with the show plots in tool window in Tools -> Python Scientific unchecked (plot in original window instead of in SciView) worked normally.

Changing a few options such as debugging server’s port and python’s interpreter (anaconda3 (Python 3.7) and pure version of Python 3.8.3) does not help. I’ve also reinitialized a project, reinstalled PyCharm, reboot a couple of times, and reset all the settings in PyCharm, but the error still occurs.

I suppose that there is something wrong with my network configuration, but I do not know how to do.

System: macOS 10.15.3 (Hackintosh)

Advertisement

Answer

This is probably caused by the HTTP proxy. Please check and delete if you have set the http_proxy in the environment variable.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement