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 add" fails when temp directory cannot be deleted on Windows #1446

Closed
3 tasks done
NotTheEconomist opened this issue Oct 7, 2019 · 4 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected

Comments

@NotTheEconomist
Copy link

NotTheEconomist commented Oct 7, 2019

  • 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

From a fresh poetry project, adding the PyPI project P4Python fails with a PermissionError.

poetry new my_project
poetry add P4Python  # CRASH!

The error (with verbose logging) is included below:

C:\Users\asmith\tmpdir2>poetry -vvv add P4Python
Using virtualenv: C:\Users\asmith\AppData\Local\pypoetry\Cache\virtualenvs\tmpdir2-py3.7
PyPI: No release information found for P4Python-1.0, skipping
PyPI: No release information found for P4Python-1.1, skipping
PyPI: No release information found for P4Python-1.2, skipping
PyPI: 15 packages found for P4Python *
Using version ^2019.1 for P4Python

Updating dependencies
Resolving dependencies...
   1: fact: tmpdir2 is 0.1.0
   1: derived: tmpdir2
   1: fact: tmpdir2 depends on click (^7.0)
   1: fact: tmpdir2 depends on P4Python (^2019.1)
   1: fact: tmpdir2 depends on pytest (^3.0)
   1: selecting tmpdir2 (0.1.0)
   1: derived: pytest (^3.0)
   1: derived: P4Python (^2019.1)
   1: derived: click (^7.0)
   1: fact: pytest (3.10.1) depends on py (>=1.5.0)
   1: fact: pytest (3.10.1) depends on six (>=1.10.0)
   1: fact: pytest (3.10.1) depends on attrs (>=17.4.0)
   1: fact: pytest (3.10.1) depends on more-itertools (>=4.0.0)
   1: fact: pytest (3.10.1) depends on atomicwrites (>=1.0)
   1: fact: pytest (3.10.1) depends on pluggy (>=0.7)
   1: fact: pytest (3.10.1) depends on colorama (*)
   1: selecting pytest (3.10.1)
   1: derived: colorama (*)
   1: derived: pluggy (>=0.7)
   1: derived: atomicwrites (>=1.0)
   1: derived: more-itertools (>=4.0.0)
   1: derived: attrs (>=17.4.0)
   1: derived: six (>=1.10.0)
   1: derived: py (>=1.5.0)
PyPI: No release information found for p4python-1.0, skipping
PyPI: No release information found for p4python-1.1, skipping
PyPI: No release information found for p4python-1.2, skipping
PyPI: 1 packages found for p4python >=2019.1,<2020.0
PyPI: Getting info for p4python (2019.1.1858212) from PyPI
PyPI: No dependencies found, downloading archives
PyPI: Downloading sdist: p4python-2019.1.1858212.tar.gz
   1: Version solving took 0.601 seconds.
   1: Tried 1 solutions.

[PermissionError]
[WinError 5] Access is denied: 'C:\\Users\\asmith\\AppData\\Local\\Temp\\tmpclrcjsmg\\unpacked\\p4python-2019.1.1858212\\devnotes.txt'

Exception trace:
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\cleo\application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\console\application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\cleo\application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\console\commands\command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\cleo\commands\base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\cleo\commands\command.py in execute() at line 107
   return self.handle()
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\console\commands\add.py in handle() at line 139
   status = installer.run()
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\installation\installer.py in run() at line 73
   self._do_install(local_repo)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\installation\installer.py in _do_install() at line 165
   ops = solver.solve(use_latest=self._whitelist)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\puzzle\solver.py in solve() at line 38
   packages, depths = self._solve(use_latest=use_latest)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\puzzle\solver.py in _solve() at line 171
   self._package, self._provider, locked=locked, use_latest=use_latest
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\mixology\__init__.py in resolve_version() at line 7
   return solver.solve()
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\mixology\version_solver.py in solve() at line 79
   next = self._choose_package_version()
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\mixology\version_solver.py in _choose_package_version() at line 377
   version = self._provider.complete_package(version)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\puzzle\provider.py in complete_package() at line 465
   package.name, package.version.text, extras=package.requires_extras
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\repositories\pool.py in package() at line 49
   package = repository.package(name, version, extras=extras)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\repositories\pypi_repository.py in package() at line 159
   release_info = self.get_release_info(name, version)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\repositories\pypi_repository.py in get_release_info() at line 262
   "{}:{}".format(name, version), lambda: self._get_release_info(name, version)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\cachy\repository.py in remember_forever() at line 174
   val = value(callback)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\cachy\helpers.py in value() at line 6
   return val()
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\repositories\pypi_repository.py in <lambda>() at line 262
   "{}:{}".format(name, version), lambda: self._get_release_info(name, version)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\repositories\pypi_repository.py in _get_release_info() at line 324
   info = self._get_info_from_urls(urls)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\repositories\pypi_repository.py in _get_info_from_urls() at line 434
   return self._get_info_from_sdist(urls["sdist"][0])
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\repositories\pypi_repository.py in _get_info_from_sdist() at line 572
   return info
 c:\users\asmith\appdata\local\programs\python\python37\lib\contextlib.py in __exit__() at line 119
   next(self.gen)
 c:\users\asmith\appdata\local\programs\python\python37\lib\site-packages\poetry\utils\helpers.py in temporary_directory() at line 36
   yield name
 c:\users\asmith\appdata\local\programs\python\python37\lib\tempfile.py in __exit__() at line 805
   self.cleanup()
 c:\users\asmith\appdata\local\programs\python\python37\lib\tempfile.py in cleanup() at line 809
   _shutil.rmtree(self.name)
 c:\users\asmith\appdata\local\programs\python\python37\lib\shutil.py in rmtree() at line 516
   return _rmtree_unsafe(path, onerror)
 c:\users\asmith\appdata\local\programs\python\python37\lib\shutil.py in _rmtree_unsafe() at line 395
   _rmtree_unsafe(fullname, onerror)
 c:\users\asmith\appdata\local\programs\python\python37\lib\shutil.py in _rmtree_unsafe() at line 395
   _rmtree_unsafe(fullname, onerror)
 c:\users\asmith\appdata\local\programs\python\python37\lib\shutil.py in _rmtree_unsafe() at line 400
   onerror(os.unlink, fullname, sys.exc_info())
 c:\users\asmith\appdata\local\programs\python\python37\lib\shutil.py in _rmtree_unsafe() at line 398
   os.unlink(fullname)

add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...

This is almost certainly caused by P4Python not having its dependencies easily referenceable as mentioned here, however I would expect Poetry not to crash if some temp files fail to delete.

@NotTheEconomist NotTheEconomist added the kind/bug Something isn't working as expected label Oct 7, 2019
@NotTheEconomist NotTheEconomist changed the title Poetry add" "Poetry add" fails when temp directory cannot be deleted on Windows Oct 7, 2019
@absassi
Copy link

absassi commented Oct 10, 2019

This seems to be duplicate of #1031 and would be fixed by #1032

@stale
Copy link

stale bot commented Dec 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 9, 2019
@neersighted neersighted removed the Stale label Nov 11, 2021
@finswimmer
Copy link
Member

Duplicate of #1031

@finswimmer finswimmer marked this as a duplicate of #1031 Oct 20, 2022
Copy link

github-actions bot commented Mar 1, 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 1, 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

4 participants