pip icon indicating copy to clipboard operation
pip copied to clipboard

Didn't set proxy but it says proxy is malform

Open flamecopper opened this issue 1 year ago • 4 comments

Description

pip3 install flask Defaulting to user installation because normal site-packages is not writeable ERROR: Could not install packages due to an OSError: Please check proxy URL. It is malformed and could be missing the host.

No proxy is set: printenv | grep proxy

Expected behavior

No response

pip version

24.0.0

Python version

3.10

OS

Ubuntu

How to Reproduce

Do a simple installation

Output

No response

Code of Conduct

flamecopper avatar Apr 24 '24 23:04 flamecopper

Can you please share the output of pip config debug in the environment where you're running into this issue?

ichard26 avatar Apr 25 '24 19:04 ichard26

Can you please share the output of pip config debug in the environment where you're running into this issue?

Ok, there is a global.proxy set some where. I remove it and it is working now. Thanks.

flamecopper avatar Apr 26 '24 23:04 flamecopper

It may be worth it to catch proxy exceptions from requests and emit a more specific error message, which suggests to check pip config debug for misconfigured proxies.

ichard26 avatar Apr 27 '24 15:04 ichard26

It may be worth it to catch proxy exceptions from requests and emit a more specific error message, which suggests to check pip config debug for misconfigured proxies.

I could try to add that line in a PR. I have two ideas in mind, the second being the good one I think:

  1. In src/pip/_vendor/requests/adapters.py at this line of get_connection it looks like the Exception is raised. I think it would be enough to modify that string in the exception constructor. But that would mean modifying a _vendor portion of code, I don't know if it's feasible/accepted. Also architecturally, if that comes from an outside library which is integrated, a solution suggestion related to pip shouldn't stay there.
  2. In src/pip/_internal/commands/install.py there is the function create_os_error_message which could be modified to add some lines checking for InvalidProxyURL and providing a suggestion. It could also be possible to add a unit test for that function in tests/unit/test_command_install.py.

I think that 2 is the best choice, and probably I would like to try and fix that.

nucccc avatar May 09 '24 09:05 nucccc