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 self update --preview leads to [WinError 5] Access is denied: 'py3.7\\msgpack\\_cmsgpack.cp37-win_amd64.pyd' #2681

Closed
3 tasks done
AlxndrJhn opened this issue Jul 17, 2020 · 15 comments
Labels
status/duplicate Duplicate issues

Comments

@AlxndrJhn
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).
  • OS version and name: Windows 10 pro, version 1909
  • Poetry version: 1.0.9
  • Link of a Gist with the contents of your pyproject.toml file: no project specific probelm

Issue

I use powershell and pyenv on windows with python 3.7. Python 3.7.5 is the newest version according to pyenv install -l
Updating to the latest preview does not work as expected, I assumed poetry self update --preview would work.
But see the log below, I can reproduce it every time with the same error. Installing/using poetry 1.0.9 works without issues.
I guess it is similar to #1032 as shutil.py is involved in both problems, but the error is different.

Steps to reproduce

  1. install poetry with (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python
  2. try to update with poetry self update --preview

Afterwards the poetry installation is corrupted and does not work anymore

Workaround powershell command

  1. delete the .poetry folder manually (located in user home directory)
  2. (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python - --preview

Log that shows error

PS C:\Users\jahna> (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python
Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

%USERPROFILE%\.poetry\bin

This path will then be added to your `PATH` environment variable by
modifying the `HKEY_CURRENT_USER/Environment/PATH` registry key.

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing version: 1.0.9
  - Downloading poetry-1.0.9-win32.tar.gz (10.72MB)

Poetry (1.0.9) is installed now. Great!

To get started you need Poetry's bin directory (%USERPROFILE%\.poetry\bin) in your `PATH`
environment variable. Future applications will automatically have the
correct environment, but you may need to restart your current shell.

PS C:\Users\jahna> poetry self update --preview -vvv
Updating to 1.1.0a3

[PermissionError]
[WinError 5] Access is denied: 'C:\\Users\\jahna\\.poetry\\lib\\poetry\\_vendor\\py3.7\\msgpack\\_cmsgpack.cp37-win_amd64.pyd'

Traceback (most recent call last):
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\console_application.py", line 131, in run
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\api\command\command.py", line 120, in handle
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\api\command\command.py", line 171, in _do_handle
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\cleo\commands\command.py", line 92, in wrap_handle
  File "C:\Users\jahna\.poetry\lib\poetry\console\commands\self\update.py", line 134, in handle
  File "C:\Users\jahna\.poetry\lib\poetry\console\commands\self\update.py", line 146, in update
  File "C:\Users\jahna\.pyenv\pyenv-win\versions\3.7.5-amd64\lib\shutil.py", line 516, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\Users\jahna\.pyenv\pyenv-win\versions\3.7.5-amd64\lib\shutil.py", line 395, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\jahna\.pyenv\pyenv-win\versions\3.7.5-amd64\lib\shutil.py", line 395, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\jahna\.pyenv\pyenv-win\versions\3.7.5-amd64\lib\shutil.py", line 395, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  [Previous line repeated 1 more time]
  File "C:\Users\jahna\.pyenv\pyenv-win\versions\3.7.5-amd64\lib\shutil.py", line 400, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\jahna\.pyenv\pyenv-win\versions\3.7.5-amd64\lib\shutil.py", line 398, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\jahna\\.poetry\\lib\\poetry\\_vendor\\py3.7\\msgpack\\_cmsgpack.cp37-win_amd64.pyd'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\jahna\.poetry\bin\poetry", line 18, in <module>
    main()
  File "C:\Users\jahna\.poetry\lib\poetry\console\__init__.py", line 5, in main
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\console_application.py", line 139, in run
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\ui\components\exception_trace.py", line 58, in render
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\ui\components\exception_trace.py", line 63, in _render_traceback
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\ui\components\exception_trace.py", line 75, in _format_traceback_frame
TypeError: 'NoneType' object is not subscriptable
@AlxndrJhn AlxndrJhn added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jul 17, 2020
@myliyifei
Copy link

myliyifei commented Jul 26, 2020

I'm having the same problem, even with the latest 1.1.0B2 version, I tested powershell, cmd and elevated cmd with the same error.

Updating to 1.1.0b1
Traceback (most recent call last):
File "C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\clikit\console_application.py", line 131, in run
File "C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\clikit\api\command\command.py", line 120, in handle
File "C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\clikit\api\command\command.py", line 171, in _do_handle
File "C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\cleo\commands\command.py", line 92, in wrap_handle
File "C:\Users\yifeili.poetry\lib\poetry\console\commands\self\update.py", line 128, in handle
File "C:\Users\yifeili.poetry\lib\poetry\console\commands\self\update.py", line 140, in update
File "C:\Users\yifeili\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 737, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Users\yifeili\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 610, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "C:\Users\yifeili\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 610, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "C:\Users\yifeili\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 610, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
[Previous line repeated 1 more time]
File "C:\Users\yifeili\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 615, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Users\yifeili\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 613, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\Users\yifeili\.poetry\lib\poetry\_vendor\py3.8\msgpack\_cmsgpack.cp38-win_amd64.pyd'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\yifeili.poetry\bin\poetry", line 18, in
main()
File "C:\Users\yifeili.poetry\lib\poetry\console_init_.py", line 5, in main
File "C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\clikit\console_application.py", line 142, in run
File "C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\clikit\ui\components\exception_trace.py", line 232, in render
File "C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\clikit\ui\components\exception_trace.py", line 251, in _render_exception
ModuleNotFoundError: No module named 'crashtest.inspector'

@abn
Copy link
Member

abn commented Jul 26, 2020

@myliyifei can you try installing with pipx or pip? Just want to make it's not an issue with the installer.

@myliyifei
Copy link

@myliyifei can you try installing with pipx or pip? Just want to make it's not an issue with the installer.

What you mean is, first I use get-poetry.py to uninstall the version that installed in "C:\Users\xxx.poetry", then I use pip to install poetry into the current version of python site-packages directory, is that correct?

@abn
Copy link
Member

abn commented Jul 26, 2020

If the script is working yes. Otherwise, can just remove the directory from path or remove the poetry install directory. Note that the latter is destructive. :)

@hemanta212
Copy link
Contributor

I was updating poetry from 1.0.9 version to 1.0.10 using 'poetry self update' on administer prompt and I still get this error
[WinError 5] Access is denied: 'C:\\Users\\hp\\.poetry\\lib\\poetry\\_vendor\\py3.8\\msgpack\\_cmsgpack.cp38-win_amd64.pyd'

@mbrrg
Copy link

mbrrg commented Oct 8, 2020

Just encountered this problem when trying to upgrade 1.1.0 to 1.1.2. Access denied and broken poetry install.

@hemanta212
Copy link
Contributor

In windows I never feel comfortable update poetry and always run the get-poetry script it replaces poetry but configs are saved.

@alimantu
Copy link

alimantu commented Oct 8, 2020

Same here, just tried to update from 1.0.5 to 1.1.2 using poetry self update from bash console with admin rights and received ->

$ poetry self update
Updating to 1.1.2

[PermissionError]
[WinError 5] Access is denied: 'C:\\Users\\asalynskiy\\.poetry\\lib\\poetry\\_vendor\\py3.7\\msgpack\\_cmsgpack.cp37-win_amd64.pyd'

OS version and name: Windows 10 Pro, Build 19041
Poetry version: 1.0.5

UPD: It's a shame, my issue seems to be connected to poetry .venv working in some other console. So if you also face this issue, check you don't have poetry running somewhere else. 😅

@jaepil-choi
Copy link

Same here. I think this problem has been around since like before poetry 1.0.0
It happens on all shells - PowerShell, CMD, Bash on Windows.
My workaround to this problem is practically re-installing with curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - command as if I'm fresh installing it.

@earonesty
Copy link

earonesty commented Dec 17, 2020

in general, poetry should manage its own dependencies in a separate folder, and not pollute the env it's running in. we only have issues with msgpack in repos that also depend on msgpack. making sure your version matches poetry's version seemed to fix it. related issue: #1584 . basically if your project uses msgpack it has to be the same version as poetry.

@earonesty
Copy link

duplicate of #977

@mrtolkien
Copy link

Still having the same issue in 2021, had to uninstall and use the new install script to get the preview working:

(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -UseBasicParsing).Content | python - --preview

Not finding any definitive solution online and I followed the exact install steps, not sure how to fix it without a full re-install.

@vinhloc30796
Copy link

Just got this problem on Windows 11 - had to reinstall using the Powershell method too

@neersighted neersighted added status/duplicate Duplicate issues and removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 20, 2023
@neersighted
Copy link
Member

Closing as duplicate of #1031.

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Jan 20, 2023
Copy link

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 Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests