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

Add package from git not working on windows 10 #177

Closed
shawegit opened this issue Jun 5, 2018 · 5 comments
Closed

Add package from git not working on windows 10 #177

shawegit opened this issue Jun 5, 2018 · 5 comments
Labels
area/installer Related to the dependency installer area/solver Related to the dependency resolver kind/bug Something isn't working as expected

Comments

@shawegit
Copy link
Contributor

shawegit commented Jun 5, 2018

Adding a package from a git repository on windows 10 does not work. The package is downloaded from the git repository as required without any issue. However, at some point some files in pypoetry-git-package_nameSOME_VALUE\.git\objects\pack\ are tried to be deletethat are write protected. Below is a complete example stack trace showing the errors when trying to execute the command
poetry -v add pendulum --git https://github.com/sdispater/pendulum.git

A solution to this might be

import stat
def on_rm_error(func, path, exc_info):
    os.chmod(path, stat.S_IWRITE)
    os.unlink(path)

shutil.rmtree(tmp_dir.as_posix(), onerror=on_rm_error)

[PermissionError]
[WinError 5] Access is denied: 'C:/Users/Public/Temp/pypoetry-git-pendulumaj5p2d8l\.git\objects\pack\pack-37344d1961bffa13deda99e13c97ecda4c0c0013.idx'

Exception trace:
c:\program files (x86)\python36-32\lib\site-packages\cleo\application.py in run() at line 94
status_code = self.do_run(input_, output_)
c:\program files (x86)\python36-32\lib\site-packages\poetry\console\application.py in do_run() at line 87
return super(Application, self).do_run(i, o)
c:\program files (x86)\python36-32\lib\site-packages\cleo\application.py in do_run() at line 197
status_code = command.run(input_, output_)
c:\program files (x86)\python36-32\lib\site-packages\poetry\console\commands\command.py in run() at line 72
return super(BaseCommand, self).run(i, o)
c:\program files (x86)\python36-32\lib\site-packages\cleo\commands\base_command.py in run() at line 146
status_code = self.execute(input_, output_)
c:\program files (x86)\python36-32\lib\site-packages\cleo\commands\command.py in execute() at line 107
return self.handle()
c:\program files (x86)\python36-32\lib\site-packages\poetry\console\commands\add.py in handle() at line 134
status = installer.run()
c:\program files (x86)\python36-32\lib\site-packages\poetry\installation\installer.py in run() at line 75
self._do_install(local_repo)
c:\program files (x86)\python36-32\lib\site-packages\poetry\installation\installer.py in _do_install() at line 158
ops = solver.solve(use_latest=self._whitelist)
c:\program files (x86)\python36-32\lib\site-packages\poetry\puzzle\solver.py in solve() at line 35
self.package, provider, locked=locked, use_latest=use_latest
c:\program files (x86)\python36-32\lib\site-packages\poetry\mixology_init
.py in resolve_version() at line 8
return solver.solve()
c:\program files (x86)\python36-32\lib\site-packages\poetry\mixology\version_solver.py in solve() at line 79
next = self._choose_package_version()
c:\program files (x86)\python36-32\lib\site-packages\poetry\mixology\version_solver.py in _choose_package_version() at line 354
packages = self._provider.search_for(dependency)
c:\program files (x86)\python36-32\lib\site-packages\poetry\puzzle\provider.py in search_for() at line 104
packages = self.search_for_vcs(dependency)
c:\program files (x86)\python36-32\lib\site-packages\poetry\puzzle\provider.py in search_for_vcs() at line 220
shutil.rmtree(tmp_dir.as_posix())
c:\program files (x86)\python36-32\lib\shutil.py in rmtree() at line 494
return _rmtree_unsafe(path, onerror)
c:\program files (x86)\python36-32\lib\shutil.py in _rmtree_unsafe() at line 384
_rmtree_unsafe(fullname, onerror)
c:\program files (x86)\python36-32\lib\shutil.py in _rmtree_unsafe() at line 384
_rmtree_unsafe(fullname, onerror)
c:\program files (x86)\python36-32\lib\shutil.py in _rmtree_unsafe() at line 384
_rmtree_unsafe(fullname, onerror)
c:\program files (x86)\python36-32\lib\shutil.py in _rmtree_unsafe() at line 389
onerror(os.unlink, fullname, sys.exc_info())
c:\program files (x86)\python36-32\lib\shutil.py in _rmtree_unsafe() at line 387
os.unlink(fullname)

@ptink
Copy link

ptink commented Oct 10, 2018

Can confirm this is still an issue

@kylegentle
Copy link

kylegentle commented Nov 9, 2018

Still seeing this issue as well in version 0.12.7. The following change to puzzle/provider.py#L199 (from synap5e's reference above) serves as a temporary workaround, but prevents cleanup of the Temp folder:

except Exception:
    raise
finally:
-   shutil.rmtree(tmp_dir.as_posix())
+   pass

return [package]

@sdispater
Copy link
Member

Commit c12d86b should fix the issue.

It will land in the next bugfix version which should be released sometime next week.

@sdispater sdispater added kind/bug Something isn't working as expected area/solver Related to the dependency resolver area/installer Related to the dependency installer labels Nov 9, 2018
@sdispater
Copy link
Member

This should now be fixed in the latest 0.12.8 release.

dimbleby pushed a commit to dimbleby/poetry that referenced this issue Apr 21, 2022
Copy link

github-actions bot commented Mar 3, 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 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/installer Related to the dependency installer area/solver Related to the dependency resolver kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants