user site-packages path no longer in sys.path, resulting in modules installed there can no longer be imported any more by Blender's python #76993
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#76993
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Linux-4.15.0-96-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1050/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 435.21
Blender Version
Broken: version: 2.83 (sub 15), branch: master, commit date: 2020-05-03 18:42, hash:
331bf04fad
Worked: '1239cab11f'
Short description of error
Blender no longer considers python modules installed to the user site-packages path (if it exists), as of
331bf04fad
(first build I've noticed it on, probably earlier though).As a consequence any modules installed in this location can no longer be imported from Blender's python.
The user site-packages path on Windows is
C:\Users\name\AppData\Roaming\Python\Python37\site-packages
On Linux
/home/name/.local/lib/python3.7/site-packages
On MacOS (I think)
/Users/name/Library/Python/3.7/lib/python/site-packages
It can be fetched by doing
Here are two system_info files to demonstrate it:
system-info_31bf04fad93.txt user site-packages path missing
system-info_1239cab11ff9.txt user site-packages path present:
/home/x/.local/lib/python3.7/site-packages
Exact steps for others to reproduce the error
1239cab11f
or earlier, as well as331bf04fad
or newerAdded subscriber: @MACHIN3
user site-packages path no longer in sys.path, resulting in modules installed there can't be imported any more by Blender's pythonto user site-packages path no longer in sys.path, resulting in modules installed there can no longer be imported any more by Blender's pythonApparently, its intentional? https://developer.blender.org/rBS79a58eef059ffc3f12d11bd68938cfb1b4cd2462
Added subscriber: @brecht
I'm ready to close this but can somebody offer a suggestion what addons relying on non-supplied modules should do?
I can just append the path to sys.path when registering of course. @brecht?
Added subscriber: @rjg
In #71420 it was debated whether Blender would get it's own site-packages directory for the ones installed with the
--user
flag by settingPYTHONUSERBASE
. Not sure if there's been a decision for these changes yet.Installing the packages directly appears to be the way to go at the moment.
Added subscriber: @CansecoGPC
I was wondering why an add-on i was using didn't pick up it's dependencies, good to know.
Sadly the solution provided doesn't work, because as soon as i try to install with pip without --user flag on Linux this is what happens.
"Defaulting to user installation because normal site-packages is not writeable"
I hope the solution isn't launching Blender with root privileges.
As it should be to be honest.
I just run this now, when registering my addon:
@MACHIN3 @brecht Both certainly works, not sure what is currently recommended in the context of Blender. Having a proper and unified way of installing, managing and isolating dependencies would be nice. Perhaps that's a project I could get involved in once my thesis is done.
It's a worthy cause for sure :) Good luck with your thesis and thanks for your input!
@MACHIN3 Thank you! No problem, you're welcome.
Just needed to import os, sys, and site and it worked. Thanks for the solution.
Added subscriber: @ideasman42
Changed status from 'Needs Triage' to: 'Archived'
This is working as intended, pass
--python-use-system-env
for previous behavior.@ideasman42 Since add-on developers can't expect that Blender is started with this command line flag, I assume that installing packages without the
--user
flag is currently the intended approach?I can understand that, but honestly, this is a terrible thing to ask of addon users.
Added subscriber: @StephenLeger
Would rather say this is not working for average user anymore.
Create a site_package in user folder as working alternative out of the box and set the path according instead make a bit more sense than simply removing and let addon devs deal without.
%user%/scripts/site_package/
Added subscriber: @martiaus1028
@MACHIN3 Thank you for the tip! did you include that snippet in the register function just once? and then you still pip install and just have it go to the user installation?
Yes, I only run it once in
__init__.py
inregister()
To install pip, I do
to install a module - PIL/Pillow in my case, I do:
In both cases
--user
ensures the user site packages path is used.