Fixing Missing dependencies for SOCKS support

One pip command fixes it. If you never asked for SOCKS, an environment variable did, and installing the package is the wrong fix.

6 min readTested on requests 2.34 · PySocks 1.7.1 · httpx 0.28
requests needs the separate PySocks package for socks5 proxy URLs; without it the request fails with Missing dependencies for SOCKS support before anything is sent.A socks5:// URL needs a package requests doesn’t installrequests.exceptions.InvalidSchema:Missing dependencies for SOCKS support.requestsinstalledPySocksnot installedSOCKS5 proxynever contactedpip install "requests[socks]"requests 2.34 · PySocks 1.7.1

In short

Run pip install "requests[socks]" in the environment your script uses. If your code has no SOCKS proxy in it, look for ALL_PROXY in your environment instead. Then write the proxy URL with socks5h://, so the proxy resolves hostnames.

pip install "requests[socks]"socks5h://

requests speaks HTTP proxies out of the box. SOCKS is a different protocol, and requests hands it to a separate package, PySocks, which it does not install by default. The moment it meets a proxy URL starting with socks5://, socks5h:// or socks4:// without that package, it stops:

txt
requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.

Nothing was sent. The proxy, its address and your login have not been tested yet, so this error says nothing about whether they are right. Install the missing part:

bash
python -m pip install "requests[socks]"

Using python -m pip with the same python that runs your script matters. The usual reason the error survives the install is that pip put the package into another Python: the system one instead of your virtual environment, or the other way round.

Many people who search for this error have no proxy in their code at all. requests also takes proxies from the environment, and ALL_PROXY is a common one for VPN clients and proxy tools to set. We ran a plain requests.get(url) with no proxy argument:

InvalidSchemaALL_PROXY=socks5://… requests.get(url)the variable is used
InvalidSchemaall_proxy=socks5h://… requests.get(url)lowercase counts too
200session.trust_env = Falseenvironment ignored

Check with env | grep -i proxy. If the variable is a leftover, unset it. If you don’t want your script to follow the environment, use a Session with trust_env = False. Installing PySocks would make the error go away too, but then your script quietly sends everything through that proxy, which may not be what you want.

Both schemes work once PySocks is installed. The difference is who turns the website’s name into an IP address. With socks5:// your machine does the DNS lookup and hands the proxy an address. With socks5h:// the name goes to the proxy and is resolved there. We asked for a hostname that doesn’t exist, to see who answers:

SchemeError for an unknown hostnameWho looked it up
socks5://[Errno -2] Name or service not knownYour machine
socks5h://0x01: General SOCKS server failureThe proxy
Fig. 1 — requests 2.34 with PySocks 1.7.1 through via.proxies.vision:11000, October 14, 2026.

Use socks5h with a proxy

With socks5://, every hostname you visit is looked up from your own connection before the proxy is involved. That shows your resolver which sites you request, and a site that answers differently by region may hand you a server near you instead of near the exit. socks5h:// keeps the lookup on the proxy’s side.

The errors that come next

With PySocks installed, the proxy is finally contacted. These are the messages it produced when we broke the URL on purpose.

MessageWhat we brokeFix
SOCKS5 authentication failedWrong password, a targeting value the gateway can’t read, or a session on the rotating portCopy the login again; check the targeting values and the port
All offered SOCKS5 authentication methods were rejectedNo username and password in the URLAdd USER:PASS@
0x01: General SOCKS server failureFilters no exit matches, or an unknown hostnameRemove the narrowest filter; check the URL
Connection closed unexpectedlysocks4:// on a SOCKS5 proxyUse socks5h://
Unable to determine SOCKS version from socks://…The scheme socks://Write socks5h://
[Errno 61] Connection refusedA port where nothing listensCheck the port
ConnectTimeoutErrorA SOCKS URL pointing at an HTTP-only proxyUse that proxy’s SOCKS port, or http://
Fig. 2 — Each message appears at the end of a ConnectionError that starts with SOCKSHTTPSConnectionPool(host=…). requests 2.34, PySocks 1.7.1, October 14, 2026.

SOCKS5 has no status codes

Over HTTP, a proxy can say 407 for a bad password and 403 for a username it can’t read. SOCKS5 only knows “authentication failed”. On our gateway a wrong password and a value it can’t read, such as -country-usa, gave the identical message. If you’re stuck, try the same login over http:// once to get the more specific answer; here is what each status means.

Don’t name your file socks.py

We did, while testing this article. PySocks is imported as socks, so Python loaded our own file instead and the script died with partially initialized module 'requests' has no attribute 'get'. Rename the file and delete the __pycache__ folder next to it.

httpx

httpx uses a different package and says so: Using SOCKS proxy, but the 'socksio' package is not installed. Install httpx[socks]. It accepts socks5:// and socks5h://; socks4:// fails with “Unknown scheme for proxy URL”. A wrong password reads ProxyError: Invalid username/password.

A setup that works

Our gateway takes SOCKS5 on port 11000 (12000 for sticky sessions) and HTTP on 9000. Both scripts ran as shown.

fetch_socks.py
import os

import requests  # pip install "requests[socks]"

USER = os.environ["PROXY_USER"]
PASS = os.environ["PROXY_PASS"]

# socks5h: the proxy resolves the hostname. socks5: your machine does.
proxy = f"socks5h://{USER}:{PASS}@via.proxies.vision:11000"

r = requests.get("https://ipinfo.io/ip", proxies={"http": proxy, "https": proxy}, timeout=30)
print(r.status_code, r.text.strip())
fetch_socks_httpx.py
import os

import httpx  # pip install "httpx[socks]"

USER = os.environ["PROXY_USER"]
PASS = os.environ["PROXY_PASS"]

with httpx.Client(proxy=f"socks5h://{USER}:{PASS}@via.proxies.vision:11000", timeout=30) as client:
    r = client.get("https://ipinfo.io/ip")
    print(r.status_code, r.text.strip())

Do you need SOCKS at all?

For fetching web pages, an HTTP proxy does the same job with no extra package and clearer errors: replace the scheme with http:// and the port with 9000, and keep the login. SOCKS5 earns its place when the traffic isn’t HTTP.

What is the pip command to fix 'Missing dependencies for SOCKS support'?
pip install "requests[socks]". That installs PySocks, the package requests needs for socks5:// proxy URLs. pip install pysocks does the same. Install it into the environment your script runs in.
I installed PySocks and still get the error. Why?
It went into a different Python than the one running your script. Run python -m pip install "requests[socks]" with the same python you start the script with, or activate the virtual environment first.
I don't use SOCKS. Why do I get this error?
An environment variable does: ALL_PROXY, HTTP_PROXY or HTTPS_PROXY is set to a socks5:// address, often by a VPN or proxy tool. requests reads those variables on its own. Unset the variable, or set session.trust_env = False.
What is the difference between socks5:// and socks5h://?
Who looks up the hostname. With socks5:// your machine resolves the website's name and sends the proxy an IP address. With socks5h:// the proxy resolves it. Use socks5h:// with a proxy, so that no DNS request leaves from your own connection.
How do I fix the same error in httpx?
httpx says: Using SOCKS proxy, but the 'socksio' package is not installed. Install it with pip install "httpx[socks]".

Residential proxies, pay per GB

HTTP and SOCKS5. Country, city and sticky sessions in the username. No subscription.