Websockets and VS Code

Viewed 1608

Sorry if this question is too elementary, but I am having a hard time installing extensions through VS Code, primarily websockets in this case.

I am running Anaconda through VS Code and tried implementing websockets from the package installed from the pypi website: https://pypi.org/project/websockets/.

I accessed the anaconda and was able to install it via the prompt: conda install -c conda-forge websockets

However, when I try to import websockets through VS Code, it gives me the 'No module named...' error and the extensions downloaded through VS Code all look like web servers, which I don't think are the same. All other info I can find to rectify this is through the pip/pip2/pip3 installer method but I don't know if this works with Anaconda and which terminal to run them through, as I have never had any success installing packages through these methods.

Any insight or documentation as to how to use VS Code with Anaconda as my base would be greatly appreciated, as my ability to install packages seems very hit or miss.

1 Answers

I have come across this specific issue. It's not a websocket issue or a vscode issue, but the fact that to be able to import the websocket module, the need to install the websocket-client package.

You need this:

pip install websocket-client

You can then import websocket like this:

import websocket
# do code
# ...

The link is here:

https://pypi.org/project/websocket-client/

Related