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

POETRY_CACHE_DIR isn't applied during dependencies resolution #2519

Closed
3 tasks done
AlexisBRENON opened this issue Jun 8, 2020 · 6 comments
Closed
3 tasks done

POETRY_CACHE_DIR isn't applied during dependencies resolution #2519

AlexisBRENON opened this issue Jun 8, 2020 · 6 comments
Labels
kind/bug Something isn't working as expected

Comments

@AlexisBRENON
Copy link

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

I try to use poetry for CI build, hence setting the POETRY_CACHE_DIR environment variable. While virtual environment is created in the right directory, a lock file try to be created in ~/.cache/.... However in CI build environment, HOME is not set so I got an error:

poetry update -vvv

Creating virtualenv ...-Bvcf6ELA-py3.8 in /tmp/jenkins-bf642f55/workspace/.../pypoetry/virtualenvs
Using virtualenv: /tmp/jenkins-bf642f55/workspace/.../pypoetry/virtualenvs/...-Bvcf6ELA-py3.8
Updating dependencies
Resolving dependencies...
   1: fact: ... is 0.0.0
   1: derived: ...
   1: fact: ... depends on kafka-python (^2.0.1)
   1: fact: ... depends on prometheus_client (^0.7.1)
   1: fact: ... depends on python-snappy (^0.5.4)
   1: fact: ... depends on msgpack (^1.0.0)
   1: fact: ... depends on pytest (^4.6)
   1: fact: ... depends on coverage (^5.0.3)
   1: fact: ... depends on pytest (^4.6)
   1: fact: ... depends on coverage (^5.0.3)
   1: selecting ... (0.0.0)
   1: derived: coverage (^5.0.3)
   1: derived: pytest (^4.6)
   1: derived: msgpack (^1.0.0)
   1: derived: python-snappy (^0.5.4)
   1: derived: prometheus_client (^0.7.1)
   1: derived: kafka-python (^2.0.1)
   1: Version solving took 0.036 seconds.
   1: Tried 1 solutions.

[LockFailed]
failed to create /.cache/pypoetry/cache/repositories/pypi/_http/2/9/a/b/8/4ea91933c570-4d0d4740.173908512058976494407

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/usr/local/lib/python3.8/site-packages/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/usr/local/lib/python3.8/site-packages/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/usr/local/lib/python3.8/site-packages/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/usr/local/lib/python3.8/site-packages/poetry/console/commands/update.py", line 49, in handle
    return installer.run()
  File "/usr/local/lib/python3.8/site-packages/poetry/installation/installer.py", line 74, in run
    self._do_install(local_repo)
  File "/usr/local/lib/python3.8/site-packages/poetry/installation/installer.py", line 161, in _do_install
    ops = solver.solve(use_latest=self._whitelist)
  File "/usr/local/lib/python3.8/site-packages/poetry/puzzle/solver.py", line 36, in solve
    packages, depths = self._solve(use_latest=use_latest)
  File "/usr/local/lib/python3.8/site-packages/poetry/puzzle/solver.py", line 180, in _solve
    result = resolve_version(
  File "/usr/local/lib/python3.8/site-packages/poetry/mixology/__init__.py", line 7, in resolve_version
    return solver.solve()
  File "/usr/local/lib/python3.8/site-packages/poetry/mixology/version_solver.py", line 80, in solve
    next = self._choose_package_version()
  File "/usr/local/lib/python3.8/site-packages/poetry/mixology/version_solver.py", line 350, in _choose_package_version
    dependency = min(*unsatisfied, key=_get_min)
  File "/usr/local/lib/python3.8/site-packages/poetry/mixology/version_solver.py", line 343, in _get_min
    return len(self._provider.search_for(dependency))
  File "/usr/local/lib/python3.8/site-packages/poetry/puzzle/provider.py", line 140, in search_for
    packages = self._pool.find_packages(
  File "/usr/local/lib/python3.8/site-packages/poetry/repositories/pool.py", line 148, in find_packages
    packages += repo.find_packages(
  File "/usr/local/lib/python3.8/site-packages/poetry/repositories/pypi_repository.py", line 104, in find_packages
    info = self.get_package_info(name)
  File "/usr/local/lib/python3.8/site-packages/poetry/repositories/pypi_repository.py", line 256, in get_package_info
    return self._cache.store("packages").remember_forever(
  File "/usr/local/lib/python3.8/site-packages/cachy/repository.py", line 174, in remember_forever
    val = value(callback)
  File "/usr/local/lib/python3.8/site-packages/cachy/helpers.py", line 6, in value
    return val()
  File "/usr/local/lib/python3.8/site-packages/poetry/repositories/pypi_repository.py", line 257, in <lambda>
    name, lambda: self._get_package_info(name)
  File "/usr/local/lib/python3.8/site-packages/poetry/repositories/pypi_repository.py", line 261, in _get_package_info
    data = self._get("pypi/{}/json".format(name))
  File "/usr/local/lib/python3.8/site-packages/poetry/repositories/pypi_repository.py", line 356, in _get
    json_response = self._session.get(self._base_url + endpoint)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 683, in send
    r.content
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 829, in content
    self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 751, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 576, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 519, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "/usr/local/lib/python3.8/site-packages/cachecontrol/filewrapper.py", line 65, in read
    self._close()
  File "/usr/local/lib/python3.8/site-packages/cachecontrol/filewrapper.py", line 52, in _close
    self.__callback(self.__buf.getvalue())
  File "/usr/local/lib/python3.8/site-packages/cachecontrol/controller.py", line 308, in cache_response
    self.cache.set(
  File "/usr/local/lib/python3.8/site-packages/cachecontrol/caches/file_cache.py", line 126, in set
    with self.lock_class(name) as lock:
  File "/usr/local/lib/python3.8/site-packages/lockfile/__init__.py", line 197, in __enter__
    self.acquire()
  File "/usr/local/lib/python3.8/site-packages/lockfile/linklockfile.py", line 21, in acquire
    raise LockFailed("failed to create %s" % self.unique_name)
@AlexisBRENON AlexisBRENON added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 8, 2020
@sr-rolando
Copy link

Setting HOME (right were you're setting POETRY_CACHE_DIR) is not an option?

@AlexisBRENON
Copy link
Author

AlexisBRENON commented Jul 19, 2020 via email

@dylrich
Copy link

dylrich commented Oct 1, 2020

I had the same issue with Jenkins -- setting $HOME as a hack works for now but it'd be nice if poetry fell back to the current directory if $HOME isn't available.

@usinelogicielle
Copy link

Hi,

I have the same problem.
When I run "poetry config list", I'm not sure the cache-dir is overidden.

poetry config --list
2022-06-03 09:30:03  cache-dir = "/home/il/jenkins/.cache/pypoetry"  # /tmp/srv_jenkins/workspace/url_feature_check_confluence_url/pypoetry

@abn
Copy link
Member

abn commented Jun 3, 2022

Should be resolved with #5672.

@abn abn closed this as completed Jun 3, 2022
@abn abn removed the status/triage This issue needs to be triaged label Jun 3, 2022
Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

5 participants