2

ubuntu 20, Blender installed via snap package. default location (i managed to find) is

  • /snap/blender/current/2.xx/

I have also installed Prism (VFX pipeline tool) This tool needs PySide2 Package installed in python (shipped with blender). As per forums, i need to copy PySide2 directory inside

  • blender/2.xx/python/lib/site-packages

But i am unable to paste that in SNAPPED blender. (right click paste is disabled). I have already tried via root (still failed) 'sudo nautilus' right click paste is also disabled.

Any ideas / suggestions. thanks in advance.

haseeb
  • 33
  • 5
  • 1
    Ubuntu Core 20 can only use *snaps* so why mention it? (or did you mean Ubuntu Desktop which uses the *yy.mm* format for releases, *yy* being used only for *snap* based release). What is the full directory of what you're trying to paste? *Snaps* have two confinement models, the *classic* allows pretty free access to your underlying *file system*, but you're limited if running a *confined* snap (with minimal adjustments for certain directories possible, but you didn't specify what directories you're talking about). – guiverc Sep 01 '20 at 05:21
  • Reason to mention snap was, previously, i used to download and extract in a directory, create menu item and work etc. through a venv, i installed exact python ( matches blender python version) and then installed PySide2 and shiboken via pip. I then need to copy these 2 directories from venv (site packages) to /snap/blender/45/2.90/python/lib/python3.7/site-packages – haseeb Sep 01 '20 at 07:35
  • snap list command shows following blender 2.90.0 45 latest/stable blenderfoundation✓ classic which blender shows following /snap/bin/blender – haseeb Sep 01 '20 at 07:37

1 Answers1

3

This solution is for Blender users, but the approach might possibly be adapted to other programs with embedded Python consoles.

In Blender's Python Console (not the scripting editor) enter:

import sys
print(sys.path)

the output will include all the folders in which Blender's python searches for python modules when a Blender python import command is executed. In my case this included 10 folders of which all but one was a snap subfolder, hence they were "read only" 'mounted', meaning that even a sudo command could not write/copy to/paste to any of those folders. The exception was the 2nd to last of those folders. It was not a snap subfolder (see my copied result of the print('sys.path') below). I almost missed it, but as soon as I saw it, I brightened up because my strategy was to put the needed Python module (*.py file) in that folder. I first used PIP to install that needed python module into my System's (non-Blender) python module area (which is not snap-protected) and then copied it from there to the /home/vic/.config/blender/2.92/scripts/addons/modules folder (I had to create the last three levels of this folder path). At first it didnt' work, but after closing Blender and restarting, Blender's Python found the needed, but previously absent python module.

I hope this helps others, as it took me quite a while to get past that hurdle. I expect there are benefits to snap's security approach of making all those sub-directories unwritable, but I am glad someone was smart enough to allow at least one back door for installing additional python modules in the case of Blender’s embedded Python environment.

sys.path
#~ ['/snap/blender/111/2.92/scripts/startup', 
'/snap/blender/111/2.92/scripts/modules', 
'/snap/blender/111/2.92/python/lib/python37.zip', 
'/snap/blender/111/2.92/python/lib/python3.7', 
'/snap/blender/111/2.92/python/lib/python3.7/lib-dynload',
'/snap/blender/111/2.92/python/lib/python3.7/site-packages', 
'/snap/blender/111/2.92/scripts/freestyle/modules', 
'/snap/blender/111/2.92/scripts/addons/modules', 
'/home/vic/.config/blender/2.92/scripts/addons/modules', 
'/snap/blender/111/2.92/scripts/addons']
#~ 
vicmail12
  • 46
  • 3