I'll briefly explain my setup before describing the problem in detail.

I am on Windows 10 and using the geth client in Light Sync Mode, along with web3.py on Jupyter Notebook and Metamask as a wallet.

I have already succeeded in connecting to Rinkeby network through an Infura Node, but now i want to do the same using geth.

So, basically i want something along the lines of web3.py being able to communicate with the geth client. both of these are running on the same machine, hence i see no reason to use the HTTP provider in web3.py.

I want to use the IPCProvider of web3.py and i have tried to do so, but with no success so far.

After starting geth in light mode, i tried this in Jupyter,;

from web3 import Web3
w3 = Web3(Web3.IPCProvider(''))

I left the IPCProvider brackets empty since it auto-detects the path of the geth pipe in windows, which is ( i have tried manually inputting the path as string, but it has given me errors, so i went with the auto-detect )


and examning 'w3' variable in jupyter results in;

web3.main.Web3 object at 0x00000266CBEDB080

meaning that it is indeed a web3 instance.



results in False. Even though geth is running in the background successfully.

Also, using any arbitrary web3 functions results in an OS error

e.g if i want to get a list of accounts;


will give;

OSError: (5, 'CreateFile', 'Access is denied.')

From the very little documentation available on windows IPC, i have gathered that windows uses named pipes for interprocess communication, where one process writes to the pipe and the other process reads from it. But that is pretty much it and there are no helpful guides or tutorials to properly tell about how to use windows Pipes practically.

I just want to connected web3.py to geth, using IPC. So that i can send commands to the geth client from the web3.py interface

since there's very little information about geth IPC with windows, i am completely lost.

please help me out

  • did you solved it? I'm having the same issue. Apr 8 at 20:46

IPC constructor allows you to pass in None for the IPC path (uses default Geth path). There is an issue with str(Path(ipc_path).expanduser().resolve()). Read https://bugs.python.org/issue31842

You solution is to to not specify the IPC path and rely on self.ipc_path = get_default_ipc_path()

Related code:

    def __init__(
        ipc_path: Union[str, Path] = None,
        timeout: int = 10,
        *args: Any,
        **kwargs: Any,
    ) -> None:
        if ipc_path is None:
            self.ipc_path = get_default_ipc_path()
        elif isinstance(ipc_path, str) or isinstance(ipc_path, Path):
            self.ipc_path = str(Path(ipc_path).expanduser().resolve())
            raise TypeError("ipc_path must be of type string or pathlib.Path")


w3 = Web3(Web3.IPCProvider())

or (when Python Issue31842 is fixed)

w3 = Web3(Web3.IPCProvider(web3.providers.ipc.get_default_ipc_path()))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.