Prefer IPv4 for conda on Windows

Windows users generally should not disable IPv6. Upon network upgrades or working in a new location with IPv6, network operations that previously worked may fail. An example of this is “conda install” or “conda update” commands that hang or fail with a timeout error. While curl has an option “-4” or “–ipv4” to force IPv4 connections only, the “conda” command does not have a “force IPv4” option currently. Windows can be set to prioritize IPv4 over IPv6, which can help with conda operations and other network operations. Reprioritizing IPv4 over IPv6 is vastly preferable to disabling IPv6, as it allows for compatibility with IPv6 networks.

Check existing IPv6 settings with the command:

netsh interface ipv6 show prefixpolicies

ℹ️ Note

If there are only one or zero prefix policy entries, then IPv6 is likely not configured correctly. The rest of this procedure would not help as Windows will go to factory defaults and ignore the IPv4 preference. Fix the IPv6 configuration first, then proceed with the steps below.

Set the prefix policy for IPv4 to have a higher priority than IPv6 by running the following command in an elevated PowerShell or Command Prompt:

netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 46 4

Check that the IPv6 prefix policy has been set correctly by running:

netsh interface ipv6 show prefixpolicies

Then execute the “conda install” or “conda update” command again.


To restore the default Windows settings of IPv6 having priority over IPv4:

netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 35 4