python site-packages are not recognized after install (bug on linux / workes fine on Windows) #104000
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#104000
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-6.0.12-76060006-generic-x86_64-with-glibc2.35 64 Bits
Graphics card: NVIDIA GeForce RTX 2080 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 510.108.03
Blender Version
Broken: version: 3.4.1, branch: blender-v3.4-release, commit date: 2022-12-19 17:00, hash:
55485cb379
Worked: (3.0.0, not 100% shure)
Short description of error
I have an add-on that uses Pillow, so I would install Pillow to blenders Python.
This stopped working recently.
The add-on is installed (I checked, by looking into the site-packages folder and by executing blenders Python in a terminal -> outside of blender the import PIL works, in blender it doesn't)
The strangest thing is, that Pillow gets recognized, if you type:
pillow will work again, but will fail again, if you restart blender.
On Windows this bug doesn't exist.
Is this a bug on Linux builds, when blender tries to load its python site-packages?
Exact steps for others to reproduce the error
Open blender and go to the python console and type this:
Added subscriber: @ClemensBeute
Added subscriber: @lichtwerk
Dont forget the following (for someone that doesnt have pip yet), will include in the report.
Anyways, I cannot reproduce here (in both 3.0.0 and 3.4.1, also 3.5, I can import PIL right adter getting it...)
Added subscriber: @sebastian_k
I can kind of confirm this.
Linux-6.0.12-76060006-generic-x86_64-with-glibc2.35 64 Bits
3.4.1, branch: blender-v3.4-release, commit date: 2022-12-20 08:50, hash:
ef9ca44dee
Fresh install (download from buildbox, extract, ensurepip, pip install gspread), go to console, type "import gspread" -> module not found.
Type "help("modules")", type "import gspread" again and it works.
However, when I do the exact same thing on our server, it works!
Linux 5.4.0-125-generic #141-Ubuntu SMP Wed Aug 10 13:42:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
It's so weird! So, could it be an OS kind of thing?
Added subscriber: @ideasman42
While I can't redo this, it seems likely the
sys.path
changes before & after runninghelp("modules")
could someone check if this is the case.Also, can this problem be reproduced from a Python instance running outside of Blender?
Changed status from 'Needs Triage' to: 'Needs User Info'
I checked it. In Blender sys.path changes after help("modules"), outside blender (running the blenders python executable) sys.path doesn't change.
But one other thing i noticed, is that numpy throws a warning:
Here are the full console logs
blender_console.txt
system_console_blender_python.txt
This is likely caused by Python not using the local environment by default: see
7c2f0074f3
Passing
--python-use-system-env
to Blender on startup should make Blender behave like regular Python.This was an intentional change though, so we'd need to consider if including user site-packages by default is worth adding back, or if there are other alternatives.
Ok, thank you. Starting blender with --python-use-system-env works for us.
But it seems like a workaround to me. As I understand, this gives Blender access to the system python modules.
I'm curious now, because I program add-ons for our company, and sometimes we need external modules...
Is there an official/correct way, how to use external python modules like Pillow in a blender add-on?
My approach was to install them with a command like this inside blender:
This issue was referenced by
72c012ab4a
Changed status from 'Needs User Info' to: 'Resolved'