when I try to install a package out of my anaconda environment I get a "ValueError: Invalid IPv6 URL" error message (full error below). Specifically it looks like the error is in urlsplit
.
I am behind a proxy, thus I have tried to explicitely set the proxy details both in the .pip/pip.conf and explicitely appending it to the command line. The error is slightly different in the two cases. Note that in my password I have none of these special symbols @, $, -, #. I do have some special characters though since they are required by the system. I have tried to put them into quote, double quotes, backslahs... nothing.
$ cat .pip/pip.conf
[global]
timeout = 60
index-url = https://pypi.python.org/simple/
trusted-host = pypi.python.org
pypi.org
files.pythonhosted.org
proxy = http://username:password@ipadress:port
[install]
index-url = https://pypi.python.org/simple/
The original commnadnd + error message is here:
$ pip3 install Cython
Collecting Cython
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 328, in run
wb.build(autobuilding=True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 512, in _prepare_file
finder, self.upgrade, require_hashes)
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 273, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python3/dist-packages/pip/index.py", line 442, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python3/dist-packages/pip/index.py", line 400, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python3/dist-packages/pip/index.py", line 545, in _get_pages
page = self._get_page(location)
File "/usr/lib/python3/dist-packages/pip/index.py", line 648, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python3/dist-packages/pip/index.py", line 757, in get_page
"Cache-Control": "max-age=600",
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 492, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/pip/download.py", line 378, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 588, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 343, in send
conn = self.get_connection(request.url, proxies)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 253, in get_connection
proxy = prepend_scheme_if_needed(proxy, 'http')
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/utils.py", line 666, in prepend_scheme_if_needed
scheme, netloc, path, params, query, fragment = urlparse(url, new_scheme)
File "/usr/lib/python3.5/urllib/parse.py", line 295, in urlparse
splitresult = urlsplit(url, scheme, allow_fragments)
File "/usr/lib/python3.5/urllib/parse.py", line 363, in urlsplit
raise ValueError("Invalid IPv6 URL")
ValueError: Invalid IPv6 URL
By appending the proxy to the command line, I get a slightly shorter message:
$ pip install Cython --proxy = https://username:password@ipadress:port
ERROR: Exception:
Traceback (most recent call last):
File "/home/mdi0316/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 164, in exc_logging_wrapper
status = run_func(*args)
File "/home/mdi0316/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
return func(self, options, args)
File "/home/mdi0316/anaconda3/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 305, in run
reqs = self.get_requirements(args, options, finder, session)
File "/home/mdi0316/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 385, in get_requirements
user_supplied=True,
File "/home/mdi0316/anaconda3/lib/python3.6/site-packages/pip/_internal/req/constructors.py", line 366, in install_req_from_line
parts = parse_req_from_line(name, line_source)
File "/home/mdi0316/anaconda3/lib/python3.6/site-packages/pip/_internal/req/constructors.py", line 281, in parse_req_from_line
link = Link(name)
File "/home/mdi0316/anaconda3/lib/python3.6/site-packages/pip/_internal/models/link.py", line 73, in __init__
self._parsed_url = urllib.parse.urlsplit(url)
File "/home/mdi0316/anaconda3/lib/python3.6/urllib/parse.py", line 460, in urlsplit
raise ValueError("Invalid IPv6 URL")
ValueError: Invalid IPv6 URL
What else can I try?
Thank you.
PS, why am I using pip3 instead of pip? For some reason my default pip is the anaconda one, thus I can also anaconda3/pip install it, but then /usr/bin/python would not recognize it.
$which python
> /usr/bin/python
$ python --version
> Python 3.5.2
$ which pip
> /usr/bin/pip
$ pip --version
> pip 21.3.1 from /home/userid/anaconda3/lib/python3.6/site-packages/pip (python 3.6)
$ which python3
> /usr/bin/python3
$ python3 --version
> Python 3.5.2
$ which pip3
> /usr/bin/pip3
$ pip3 --version
> pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)
I then tryed to sudo apt-get remove python-pip
and sudo apt install python-pip
but I got the same anaconda3 version back:
$ which pip
> /usr/bin/pip
$ pip --version
> pip 21.3.1 from /home/userid/anaconda3/lib/python3.6/site-packages/pip (python 3.6)