JacquesLucke / blender_vscode

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

Blender 2.92 fails to install pip with get-pip.py #90

Closed chubei-oppen closed 2 years ago

chubei-oppen commented 3 years ago

I'm using Blender 2.92 with bundled Python on Ubuntu 18.04. When trying to Blender: Start, pip installation failed with following message:

Traceback (most recent call last):
  File "/home/chubei/.vscode/extensions/jacqueslucke.blender-development-0.0.13/pythonFiles/include/blender_vscode/external/get-pip.py", line 20890, in <module>
    main()
  File "/home/chubei/.vscode/extensions/jacqueslucke.blender-development-0.0.13/pythonFiles/include/blender_vscode/external/get-pip.py", line 197, in main
    bootstrap(tmpdir=tmpdir)
  File "/home/chubei/.vscode/extensions/jacqueslucke.blender-development-0.0.13/pythonFiles/include/blender_vscode/external/get-pip.py", line 175, in bootstrap
    sys.exit(pip._internal.main(args))
  File "/tmp/tmp0qhd0cin/pip.zip/pip/_internal/__init__.py", line 78, in main
  File "/tmp/tmp0qhd0cin/pip.zip/pip/_internal/cli/base_command.py", line 184, in main
  File "/tmp/tmp0qhd0cin/pip.zip/pip/_internal/cli/base_command.py", line 76, in _build_session
  File "/opt/blender-2.92.0-linux64/2.92/python/lib/python3.7/posixpath.py", line 80, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not int

It looks like some problem within get-pip.py.

I later solved this problem using ensurepip, which comes with the bundled Python.

@JacquesLucke Would it better to try ensurepip before get-pip.py in this extension? I'll be happy to make a PR if you find it acceptable.

JacquesLucke commented 3 years ago

That seems acceptable. Feel free to make a pull request. The get-pip.py fallback will probably still be necessary. In the past I found that ensurepip is not always available.

I still hope that one day I can revamp the entire extension to improve dealing with these kinds of errors (e.g. by making the pip installation process more explicit when it doesn't just work)..

schroef commented 3 years ago

I also see that warning on Windows 10 20H2. it starts and then close and returns these errors. Failed at code 1


The terminal process "c:\Program Files\Blender Foundation\Blender 2.91\blender.exe '--python', 'c:\Users\romboutversluijs\.vscode\extensions\jacqueslucke.blender-development-0.0.14\pythonFiles\launch.py'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

also shows this error


Traceback (most recent call last):
  File "c:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\modules\addon_utils.py", line 351, in enable
    mod = __import__(module_name)
ModuleNotFoundError: No module named 'save_all_renderlayers_and_passes_bl280'
Traceback (most recent call last):
  File "c:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\modules\addon_utils.py", line 351, in enable
    mod = __import__(module_name)
ModuleNotFoundError: No module named 'save_all_viewlayers_passes_bl280-v006'
[{'load_dir': 'c:\\Users\\romboutversluijs\\AppData\\Roaming\\Blender Foundation\\Blender\\2.91\\scripts\\addons\\save-renderlayers-passes', 'module_name': 'save-renderlayers-passes'}]Collecting ptvsd
  Using cached https://files.pythonhosted.org/packages/f8/0c/310467fae43421c44131f9a445c8fd925933d4710bf501c7fa42ff86b1af/ptvsd-4.3.2-cp37-cp37m-win_amd64.whl
Installing collected packages: ptvsd
Successfully installed ptvsd-4.3.2
ERROR: Exception:
Traceback (most recent call last):
  File "c:\Program Files\Blender Foundation\Blender 2.91\2.91\python\lib\shutil.py", line 566, in move
    os.rename(src, real_dst)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\ROMBOU~2\\AppData\\Local\\Temp\\pip-target-kpu6qpnc\\lib\\python\\ptvsd' -> 'c:\\Program Files\\Blender Foundation\\Blender 
2.91\\2.91\\python\\lib\\site-packages\\ptvsd'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Program Files\Blender Foundation\Blender 2.91\2.91\python\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in main
    status = self.run(options, args)
  File "c:\Program Files\Blender Foundation\Blender 2.91\2.91\python\lib\site-packages\pip\_internal\commands\install.py", line 455, in run
    options.target_dir, target_temp_dir, options.upgrade
  File "c:\Program Files\Blender Foundation\Blender 2.91\2.91\python\lib\site-packages\pip\_internal\commands\install.py", line 512, in _handle_target_dir
    target_item_dir
  File "c:\Program Files\Blender Foundation\Blender 2.91\2.91\python\lib\shutil.py", line 577, in move
    symlinks=True)
  File "c:\Program Files\Blender Foundation\Blender 2.91\2.91\python\lib\shutil.py", line 324, in copytree
    os.makedirs(dst)
  File "c:\Program Files\Blender Foundation\Blender 2.91\2.91\python\lib\os.py", line 223, in makedirs
    mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'c:\\Program Files\\Blender Foundation\\Blender 2.91\\2.91\\python\\lib\\site-packages\\ptvsd'
WARNING: You are using pip version 19.2.3, however version 21.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.      

You should consider upgrading via the 'python -m pip install --upgrade pip' command.        

################################################################################
>   could not install ptvsd
################################################################################
schroef commented 3 years ago

I solved my issue, im more of an OSX user and being Admin is simply being Admin. WIndows is to complicated i think.

It was a permission issue. I solved the pip issue also, as well persmission issue to upgrade. Now set both blender and python folders to full control and it works.

stjseidel commented 3 years ago

image Thanks, @schroef, that solved it for me.

schroef commented 3 years ago

Yes @stjseidel i did that but not for all users