Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when opearating behind a socks proxy server #2

Open
kngharv opened this issue Jan 6, 2025 · 2 comments
Open

error when opearating behind a socks proxy server #2

kngharv opened this issue Jan 6, 2025 · 2 comments

Comments

@kngharv
Copy link

kngharv commented Jan 6, 2025

Due to the environment constraint, I am forced to use a socks proxy server to get onto the Internet.

When I am trying to use VisioNomicon, I encounter the following error:

Traceback (most recent call last):
  File "/home/user/.local/bin/VisioNomicon", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.10/site-packages/VisioNomicon/main.py", line 32, in main
    new_filepaths: list[str] = generate_mapping(args)
  File "/home/user/.local/lib/python3.10/site-packages/VisioNomicon/main.py", line 140, in generate_mapping
    elif name_validation(new_name, args.template):
  File "/home/user/.local/lib/python3.10/site-packages/VisioNomicon/gpt.py", line 180, in name_validation
    completion = openai.chat.completions.create(
  File "/home/user/.local/lib/python3.10/site-packages/openai/_utils/_proxy.py", line 20, in __getattr__
    proxied = self.__get_proxied__()
  File "/home/user/.local/lib/python3.10/site-packages/openai/_utils/_proxy.py", line 55, in __get_proxied__
    return self.__load__()
  File "/home/user/.local/lib/python3.10/site-packages/openai/_module_client.py", line 12, in __load__
    return _load_client().chat
  File "/home/user/.local/lib/python3.10/site-packages/openai/__init__.py", line 328, in _load_client
    _client = _ModuleClient(
  File "/home/user/.local/lib/python3.10/site-packages/openai/_client.py", line 130, in __init__
    super().__init__(
  File "/home/user/.local/lib/python3.10/site-packages/openai/_base_client.py", line 860, in __init__
    self._client = http_client or SyncHttpxClientWrapper(
  File "/home/user/.local/lib/python3.10/site-packages/openai/_base_client.py", line 755, in __init__
    super().__init__(**kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/httpx/_client.py", line 686, in __init__
    proxy_map = self._get_proxy_map(proxy, allow_env_proxies)
  File "/home/user/.local/lib/python3.10/site-packages/httpx/_client.py", line 244, in _get_proxy_map
    return {
  File "/home/user/.local/lib/python3.10/site-packages/httpx/_client.py", line 245, in <dictcomp>
    key: None if url is None else Proxy(url=url)
  File "/home/user/.local/lib/python3.10/site-packages/httpx/_config.py", line 214, in __init__
    raise ValueError(f"Unknown scheme for proxy URL {url!r}")
ValueError: Unknown scheme for proxy URL URL(socks://127.0.0.1:7890/)

I was hoping installing httpx[socks] library will solve the problem. it doesn't.

What else can I do to get around with this error?

@rehanzo
Copy link
Owner

rehanzo commented Jan 7, 2025

I'm not too familiar with socks proxies myself. Looking online, it seems you have to use something like socks5://127.0.0.1:7890/ or socks4://127.0.0.1:7890/, instead of socks://127.0.0.1:7890/. Try that, and let me know.

@kngharv
Copy link
Author

kngharv commented Feb 5, 2025

I'm not too familiar with socks proxies myself. Looking online, it seems you have to use something like socks5://127.0.0.1:7890/ or socks4://127.0.0.1:7890/, instead of socks://127.0.0.1:7890/. Try that, and let me know.

Ok, I found the problem.

I didn't even know I have set my environment variable all_proxy.

Once I removed all_proxy (e.g. set to blank) , VisioNomicon at least started to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants