JacquesLucke / blender_vscode

Visual Studio Code extension for Blender development.
MIT License
580 stars 75 forks source link

Windows: pip install packages fails with PermissionError: [Errno 13] Permission denied #173

Closed dsaltm closed 2 months ago

dsaltm commented 4 months ago

When I save (and auto update) I'm getting permission errors with VSCode in admin mode on Windows using Blender 4.2 located in Program Files...

Extension: unexpected error updating wheels, this is is a bug!
Traceback (most recent call last):
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\addon_utils.py", line 1019, in _initialize_extensions_compat_data
    _initialize_extensions_compat_ensure_up_to_date_wheels(extensions_directory, wheel_list)
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\addon_utils.py", line 963, in _initialize_extensions_compat_ensure_up_to_date_wheels
    _extension_sync_wheels(
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\addon_utils.py", line 1153, in _extension_sync_wheels
    apply_action(
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\_bpy_internal\extensions\wheel_manager.py", line 361, in apply_action
    _rmtree_safe(filepath_abs, local_dir)
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\_bpy_internal\extensions\wheel_manager.py", line 145, in _rmtree_safe
    shutil.rmtree(dir_remove)
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\shutil.py", line 759, in rmtree
    return _rmtree_unsafe(path, onerror)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\shutil.py", line 622, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\shutil.py", line 620, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\Dan\\AppData\\Roaming\\Blender Foundation\\Blender\\4.2\\extensions\\.local\\lib\\python3.11\\site-packages\\markupsafe\\_speedups.cp311-win_amd64.pyd'

Skipping wheel for other system (macosx_10_9_x86_64 != win_amd64): psutil-5.9.8-cp27-cp27m-macosx_10_9_x86_64.whl
Skipping wheel for other system (manylinux2010_i686 != win_amd64): psutil-5.9.8-cp27-cp27m-manylinux2010_i686.whl
Skipping wheel for other system (manylinux2010_x86_64 != win_amd64): psutil-5.9.8-cp27-cp27m-manylinux2010_x86_64.whl
Skipping wheel for other system (manylinux2010_i686 != win_amd64): psutil-5.9.8-cp27-cp27mu-manylinux2010_i686.whl
Skipping wheel for other system (manylinux2010_x86_64 != win_amd64): psutil-5.9.8-cp27-cp27mu-manylinux2010_x86_64.whl
Skipping wheel for other system (win32 != win_amd64): psutil-5.9.8-cp27-none-win32.whl
Skipping wheel for other system (macosx_10_9_x86_64 != win_amd64): psutil-5.9.8-cp36-abi3-macosx_10_9_x86_64.whl
Skipping wheel for other system (manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686 != win_amd64): psutil-5.9.8-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Skipping wheel for other system (manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64 != win_amd64): psutil-5.9.8-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Skipping wheel for other system (win32 != win_amd64): psutil-5.9.8-cp36-cp36m-win32.whl
Skipping wheel for other system (win32 != win_amd64): psutil-5.9.8-cp37-abi3-win32.whl
Skipping wheel for other system (macosx_11_0_arm64 != win_amd64): psutil-5.9.8-cp38-abi3-macosx_11_0_arm64.whl
Extension: unexpected error updating wheels, this is is a bug!
Traceback (most recent call last):
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\addon_utils.py", line 1019, in _initialize_extensions_compat_data
    _initialize_extensions_compat_ensure_up_to_date_wheels(extensions_directory, wheel_list)
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\addon_utils.py", line 963, in _initialize_extensions_compat_ensure_up_to_date_wheels
    _extension_sync_wheels(
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\addon_utils.py", line 1153, in _extension_sync_wheels
    apply_action(
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\_bpy_internal\extensions\wheel_manager.py", line 380, in apply_action
    _zipfile_extractall_safe(zip_fh, local_dir_site_packages, local_dir)
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\_bpy_internal\extensions\wheel_manager.py", line 187, in _zipfile_extractall_safe
    zip_fh.extract(member, path_restrict)
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\zipfile.py", line 1664, in extract
    return self._extract_member(member, path, pwd)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\zipfile.py", line 1735, in _extract_member
    open(targetpath, "wb") as target:
    ^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Dan\\AppData\\Roaming\\Blender Foundation\\Blender\\4.2\\extensions\\.local\\lib\\python3.11\\site-packages\\psutil\\_psutil_windows.pyd'
Mateusz-Grzelinski commented 3 months ago

yes, this is a known issue, if you want to use vs code with global blender installation you need to install required python modules manually. Similar to #169. I might fix it by putting the modules in directory %appdata$\Blender Foundation\Blender\4.2\scripts\modules. Just making note for myself for future. Reference: https://docs.blender.org/manual/en/4.2/editors/preferences/file_paths.html#script-directories

Mateusz-Grzelinski commented 2 months ago

this issue should no longer occur after version [0.0.22] - 2024-09-04. Please check.