JacquesLucke / blender_vscode

Visual Studio Code extension for Blender development.
MIT License
545 stars 74 forks source link

Version 0.0.15 could not install debugpy #99

Open paulb5352 opened 3 years ago

paulb5352 commented 3 years ago

Version 0.0.14 works perfectly OK. After upgrading to 0.0.15 and issuing the Blender: Start command I now get

Executing task: c:\Program Files\Blender Foundation\Blender 2.90\blender.exe --python c:\Users\Paul Brassington.vscode\extensions\jacqueslucke.blender-development-0.0.15\pythonFiles\launch.py <

Read prefs: C:\Users\Paul Brassington\AppData\Roaming\Blender Foundation\Blender\2.90\config\userpref.blend found bundled python: c:\Program Files\Blender Foundation\Blender 2.90\2.90\python [{'load_dir': 'c:\Users\Paul Brassington\Documents\Code\Blender\PBB', 'module_name': 'PBB'}] Read prefs: C:\Users\Paul Brassington\AppData\Roaming\Blender Foundation\Blender\2.90\config\userpref.blend found bundled python: c:\Program Files\Blender Foundation\Blender 2.90\2.90\python unknown argument, loading as file: -m Error: Cannot read file 'c:\Program Files\Blender Foundation\Blender 2.90-m': No such file or directory Error: argument has no '.blend' file extension, not using as new file, exiting! c:\Program Files\Blender Foundation\Blender 2.90-m Saved session recovery to 'C:\Users\PAULBR~1\AppData\Local\Temp\quit.blend'

Blender quit

################################################################################

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

Saved session recovery to 'C:\Users\PAULBR~1\AppData\Local\Temp\quit.blend'

JacquesLucke commented 3 years ago

The extension probably installed ptvsd some time ago for you and since then it was working. The problem is that ptvsd was deprecated and caused some issues. You could try:

jacastillol-bairesdev commented 3 years ago

After following the steps and start vscode as administrator I get the following time out:

image

nmarchuk commented 3 years ago

Having this issue as well.

Griperis commented 3 years ago

Same for me. After I install debugpy to blender python it asks for flask, so I install flask too and then I get error as @jacastillol-bairesdev mentions. Blender version 2.83 LTS.

RobertHue commented 3 years ago

I think this blender extension only works for Blender 2.92 now.

But I'm not sure why that is. I have tested it with 2.80 and 2.83 now, but receiving this "timeout" error as well.

2.92 is working though. So the README.md needs to be adapted.

RobertHue commented 3 years ago

This issue is related to #96 and #95.

gaiaclary commented 3 years ago

As mentioned in #96 the reason for the failure is that All Blender versions before Blender 2.92 have the environment variable sys.executable wrongly pointing to the Blender executable instead of the Python executable. But debugpy uses the environment variable for its own purposes, hence things go very wrong when the debug client tries to connect to the debug server by using blender.exe as the python engine :)

So, this Blender Development plugin 0.0.15 only works on Blender 2.92 and newer, while 0.0.14 only works on older Blender versions. As long as there is no significant change in the plugin i believe its best to install 0.0.14 when you work with older blender versions.

KhyatiSethia commented 3 years ago

I uninstalled "Blender Development 0.0.15" extension in VS Code. Then installed "Blender Development 0.0.14" extension which I downloaded from here [[https://marketplace.visualstudio.com/items?itemName=JacquesLucke.blender-development]]. Now, I am not facing this issue anymore.

AcylSilane commented 3 years ago

Neither 0.0.15 nor 0.0.16 seem to work out of the box with 2.93. Same error message as the OP about debugpy in both cases. I tried installing debugpy, and the error messaged complained about Flask instead. So, I installed flask as well through Blender's console.

Now I'm getting a permission error on the AppData/Roaming/Blender/2.93/scripts/addons/[name-of-the-addon] directory, despite running VSCode with administrative privileges.

I am getting the correct behavior on 0.0.15 and 0.0.16 for Blender 2.91, however. Was there ever a resolution to this, that would work with the current version of Blender?

shogerr commented 2 years ago

@AcylSilane Yes, it is possible to get 2.91 and greater working by manually installing each of the python modules in an Adminstrator's console.

&'c:\Program Files\Blender Foundation\Blender 2.93\2.93\python\bin\python.EXE' -m pip install debugpy click flask

There may be some other modules that need escalated privilege.

nypam commented 2 years ago

As @JacquesLucke mentioned, starting vscode as administrator when using the extension the first time solved the issue for me. It's a privilege problem.

Jantolick commented 2 years ago

I was unable to get this solved with elevated privileges in VS Code - I assume it may be because Blender doesn't launch with elevated privileges.

However, if you look at the console output when attempting to start the app, it will give the directory it's trying to copy the Python files from and to after downloading them with pip. If you just manually copy those directories, everything will work fine.

On Windows 10, I just used command line with admin privileges and XCODE with the the appropriate switches (/E and /H I think?) to recursively copy the plugin directories to where the app wanted them. Everything worked fine thereafter.

flolu commented 2 years ago

I am having this problem again in Blender 3.1.0

Traceback (most recent call last):
  File "/home/flo/.vscode/extensions/jacqueslucke.blender-development-0.0.16/pythonFiles/include/blender_vscode/external/get-pip.py", line 20890, in <module>
    main()
  File "/home/flo/.vscode/extensions/jacqueslucke.blender-development-0.0.16/pythonFiles/include/blender_vscode/external/get-pip.py", line 197, in main
    bootstrap(tmpdir=tmpdir)
  File "/home/flo/.vscode/extensions/jacqueslucke.blender-development-0.0.16/pythonFiles/include/blender_vscode/external/get-pip.py", line 82, in bootstrap
    import pip._internal

ImportError: cannot import name 'Mapping' from 'collections' (/home/flo/Documents/software/blender-3.1.0-linux-x64/3.1/python/lib/python3.10/collections/__init__.py)
/home/flo/Documents/software/blender-3.1.0-linux-x64/3.1/python/bin/python3.10: No module named pip

################################################################################
>   could not install debugpy
################################################################################
flolu commented 2 years ago

I fixed the problem by running

./blender-3.1.0-linux-x64/3.1/python/bin/python3.10 -m ensurepip
elliotwoods commented 2 years ago

Testing here with Windows x64 Blender Development v0.0.16 Blender 3.0.1

last error reads:

PermissionError: [WinError 5] Access is denied: 'c:\\Program Files\\Blender Foundation\\Blender 3.0\\3.0\\python\\lib\\site-packages\\debugpy'

Then tried:

Now it works (also after restarting VSCode without admin). Probably didn't need the admin privileges since installed from command line. Also simply running as admin didn't work (needed to manually install those bits from command line)

When i try with Blender 2.93.5 it also works (following same steps).

kirdaybov commented 2 years ago

Same issue Windows 10, Blender Development 0.0.16 Blender 3.0.0

UPD: the only thing that helped is to use the portable version of the Blender. Well, that's the way it is :)