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

pip 20.0.2 does not support relative paths for cache dir #1061

Closed
kammala opened this issue Feb 10, 2020 · 2 comments · Fixed by #1062
Closed

pip 20.0.2 does not support relative paths for cache dir #1061

kammala opened this issue Feb 10, 2020 · 2 comments · Fixed by #1062
Labels
bug Something is not working good first issue A good item for first time contributors to work on

Comments

@kammala
Copy link
Contributor

kammala commented Feb 10, 2020

In this PR pip starts relying on path normalization outside of WheelCache class, while it is still being instantiated manually by pip-tools without path normalization.

Using normalized path should be backward compatible with older versions of pip as well, so it should be safe to do path normalization on pip-tools side.

Steps to reproduce:

> python3 -m venv venv
> venv/bin/pip install -U pip pip-tools
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
     |████████████████████████████████| 1.4MB 3.8MB/s 
Collecting pip-tools
  Downloading https://files.pythonhosted.org/packages/db/e3/e9c864e62c5e61f1fa6c3b6232cef135ce7365ceb4b1cfa145e47753ab07/pip_tools-4.4.1-py2.py3-none-any.whl (41kB)
     |████████████████████████████████| 51kB 47.7MB/s 
Collecting six (from pip-tools)
  Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting click>=7 (from pip-tools)
  Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
     |████████████████████████████████| 81kB 52.6MB/s 
Installing collected packages: pip, six, click, pip-tools
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
Successfully installed click-7.0 pip-20.0.2 pip-tools-4.4.1 six-1.14.0
> env XDG_CACHE_HOME='.cache' venv/bin/pip-compile --build-isolation reqs.in --output-file reqs.txt
Traceback (most recent call last):
  File "venv/bin/pip-compile", line 10, in <module>
    sys.exit(cli())
  File "venv/lib/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "venv/lib/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "venv/lib/python3.8/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "venv/lib/python3.8/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "venv/lib/python3.8/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "venv/lib/python3.8/site-packages/piptools/scripts/compile.py", line 275, in cli
    repository = PyPIRepository(
  File "venv/lib/python3.8/site-packages/piptools/repositories/pypi.py", line 66, in __init__
    self.session = self.command._build_session(self.options)
  File "venv/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 83, in _build_session
    assert not options.cache_dir or os.path.isabs(options.cache_dir)
AssertionError
@atugushev atugushev added the bug Something is not working label Feb 10, 2020
@atugushev
Copy link
Member

atugushev commented Feb 10, 2020

Hello @kammala,

Thanks for the issue and reproducible steps! You have already researched the bug, so nicely 🙏

@atugushev atugushev added the good first issue A good item for first time contributors to work on label Feb 10, 2020
@kammala
Copy link
Contributor Author

kammala commented Feb 10, 2020

was playing around and found another way to get into similar trouble using PIP_TOOLS_CACHE_DIR instead of XDG_CACHE_DIR:

> env PIP_TOOLS_CACHE_DIR='.cache' venv/bin/pip-compile --build-isolation reqs.in --output-file reqs.txt
Traceback (most recent call last):
  File "venv/bin/pip-compile", line 11, in <module>
    load_entry_point('pip-tools', 'console_scripts', 'pip-compile')()
  File "venv/lib/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "venv/lib/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "venv/lib/python3.8/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "venv/lib/python3.8/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "venv/lib/python3.8/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "pip-tools/piptools/scripts/compile.py", line 385, in cli
    results = resolver.resolve(max_rounds=max_rounds)
  File "pip-tools/piptools/resolver.py", line 165, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "pip-tools/piptools/resolver.py", line 260, in _resolve_one_round
    their_constraints.extend(self._iter_dependencies(best_match))
  File "pip-tools/piptools/resolver.py", line 366, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "pip-tools/piptools/repositories/pypi.py", line 287, in get_dependencies
    wheel_cache = WheelCache(self._cache_dir, self.options.format_control)
  File "pip-tools/venv/lib/python3.8/site-packages/pip/_internal/cache.py", line 287, in __init__
    super(WheelCache, self).__init__(
  File "pip-tools/venv/lib/python3.8/site-packages/pip/_internal/cache.py", line 53, in __init__
    assert not cache_dir or os.path.isabs(cache_dir)
AssertionError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working good first issue A good item for first time contributors to work on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants