Skip to content

Conversation

@hannesdelbeke
Copy link
Contributor

@hannesdelbeke hannesdelbeke commented Sep 25, 2022

fix for #9

blender pip now installs to the blender modules folder.
specifically, site packages, which keeps it separated from the default python modules included with blender

@hannesdelbeke hannesdelbeke changed the title first pass - install to site packages install to site packages instead of user appdata Sep 25, 2022
@amb
Copy link
Owner

amb commented Sep 27, 2022

Does it work on both Mac and Linux? Mac has some write protection issues with binaries and Linux uses its system Python for Blender. There's also 'modules' folder right next to the 'scripts' folder inside Blender that could possibly work. Also is the static path to Python lib/site-packages in the Python stable API? Or is it something that can break later.

@hannesdelbeke
Copy link
Contributor Author

since i don't have mac and linux, i d need someone to test this.

I would assume it works since we get the paths from python and blender, which both are compatible with mac & linux.

There's also 'modules' folder right next to the 'scripts' folder inside Blender that could possibly work

the site packages live inside that folder :)
if you install to the modules folder directly, it can be unclear what modules you can safely uninstall later
This is why python has a site packages folder

@hannesdelbeke
Copy link
Contributor Author

Linux uses its system Python

not sure what the best way here would be
system python means it also uses the userpath, which is not the case on blender windows.
I can't find much info online regarding python blender on linux

@amb
Copy link
Owner

amb commented Oct 3, 2022

I tested it on Linux and it does not work. The install of Python modules through PIP works fine but it goes into a wrong folder, thus Blender being unable to load them.

@hannesdelbeke
Copy link
Contributor Author

that's unfortenate. what do you think would be a good way to handle this?

@hannesdelbeke
Copy link
Contributor Author

recently found out about bpy.utils.script_path_user()
which could be the solution to this.

it's a userscript path handled by blender. so should be supported on all OS
will make a PR update and test

should support all OS since path is handled by blender now
doesn't seem to be imported anywhere
@hannesdelbeke
Copy link
Contributor Author

hannesdelbeke commented Jan 2, 2023

could you have another test on mac and linux?
it should work now

tested on windows

@hannesdelbeke
Copy link
Contributor Author

i've also removed init_utils.bat sicne it doesn't seem to be used anywhere, and is probably not relevant to this addon

@hannesdelbeke
Copy link
Contributor Author

hannesdelbeke commented Mar 15, 2023

been using Path(str(bpy.utils.script_path_user())) / "addons/modules" lately and this seems to work quite well.
think this PR might need updating to add addons/modules

@hannesdelbeke hannesdelbeke force-pushed the install-to-site-packages branch from 72496a7 to 6a415ec Compare June 17, 2023 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants