JacquesLucke / blender_vscode

Visual Studio Code extension for Blender development.
MIT License
557 stars 76 forks source link

debugpy issues #169

Closed ninetyfive666 closed 1 month ago

ninetyfive666 commented 1 month ago
Collecting debugpy
  Obtaining dependency information for debugpy from https://files.pythonhosted.org/packages/23/b1/3fc28ba2921234e3fad4a421dcb3185c38066eab0f92702c0d88ce891381/debugpy-1.8.2-cp311-cp311-win_amd64.whl.metadata
  Using cached debugpy-1.8.2-cp311-cp311-win_amd64.whl.metadata (1.1 kB)
Using cached debugpy-1.8.2-cp311-cp311-win_amd64.whl (4.7 MB)
Installing collected packages: debugpy
Successfully installed debugpy-1.8.2
ERROR: Exception:
Traceback (most recent call last):
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\shutil.py", line 825, in move
    os.rename(src, real_dst)
PermissionError: [WinError 5] Zugriff verweigert: 'C:\\Users\\Lightmapper\\AppData\\Local\\Temp\\pip-target-9lrlk066\\lib\\python\\debugpy' -> 'c:\\Program Files\\Blender Foundation\\Blender 4.2\\4.2\\python\\Lib\\site-packages\\debugpy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\site-packages\pip\_internal\cli\base_command.py", line 180, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\site-packages\pip\_internal\cli\req_command.py", line 248, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\site-packages\pip\_internal\commands\install.py", line 510, in run
    self._handle_target_dir(
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\site-packages\pip\_internal\commands\install.py", line 569, in _handle_target_dir
    shutil.move(os.path.join(lib_dir, item), target_item_dir)
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\shutil.py", line 841, in move
    copytree(src, real_dst, copy_function=copy_function,
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\shutil.py", line 561, in copytree
    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Program Files\Blender Foundation\Blender 4.2\4.2\python\Lib\shutil.py", line 459, in _copytree
    os.makedirs(dst, exist_ok=dirs_exist_ok)
  File "<frozen os>", line 225, in makedirs
PermissionError: [WinError 5] Zugriff verweigert: 'c:\\Program Files\\Blender Foundation\\Blender 4.2\\4.2\\python\\Lib\\site-packages\\debugpy'

[notice] A new release of pip is available: 23.2.1 -> 24.1.2
[notice] To update, run: python.exe -m pip install --upgrade pip

################################################################################
>   could not install debugpy
################################################################################

I tried installing everything manually, the version of pip i have installed is actually 24.1.2. It seems this addon uses a different environment? Anyway i cant launch blender 4.2 LTS, the older versions like 3.6.12 work fine.

Mateusz-Grzelinski commented 1 month ago

Just a quick reply from phone: you are using blender installed in global location c:\Program Files\Blender Foundation This means that you blender is most likely installed with admin privileges and it can not be modified by normal user. And installing debugpy is a modification that you are trying to make. The easiest fix is to download portable version of blender and use that for development

AlaaCG commented 1 month ago

I'm having the same issue, also with another addon's dependency,

Previously I used to install addons dependencies using subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'debugpy']) inside of blender

but in 4.2, I call it, and it returns: requirements already satisfied but modules are never found when Imported in blender

The easiest fix is to download portable version of blender and use that for development

is there another way to make the normal blender installation use the user's installed packages ?

ranidspace commented 1 month ago

I'm having issues even with a portable version, i'm getting issues with create_link_in_user_addon_directory, and with access denied to \\AppData\\Roaming\\Blender Foundation\\Blender\\4.2\\scripts\\addons\\[add-on name], despite it being a portable installation

Antyos commented 1 month ago

I was able to get the extension working with Blender 4.2 on Windows 11. Here's what I did:

cd "C:\Program Files\Blender Foundation\Blender 4.2\4.2\python\bin"
sudo ./python.exe -m pip install --force debugpy flask requests

Two important notes:

  1. I originally had run pip install without admin privileges and it defaulted to user installations of the modules (placing them in %USERPROFILE%\AppData\Roaming\Python\Python311\site-packages\ which is not in the Blender's Python path). Because of this, I had to follow up with a pip install --force to reinstall them in the correct location.
  2. sudo is with gsudo, however, you can achieve the same effect with an administrator shell.
AlaaCG commented 1 month ago

I was able to get the extension working with Blender 4.2 on Windows 11. Here's what I did:

cd "C:\Program Files\Blender Foundation\Blender 4.2\4.2\python\bin"
sudo ./python.exe -m pip install --force debugpy flask requests

Thanks, this worked from CMD admin shell, and Worked from inside blender running as administrator

I'm guessing addons will have to be self contained or use wheels for packaging, as per the new extensions documentation

Mateusz-Grzelinski commented 1 month ago

summing up: vs code tried to install pip packages and it does not have rights to do that. This is known issue.