Python: Importing zstandard fails #107137

Open
opened 2023-04-19 18:40:27 +02:00 by Simon Thommes · 6 comments
Member

System Information
Operating system: Linux-5.17.15-76051715-generic-x86_64-with-glibc2.35 64 Bits, X11 UI
Graphics card: Quadro RTX 6000/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 515.48.07

Blender Version
Broken: version: 3.6.0 Alpha, branch: main, commit date: 2023-04-19 14:50, hash: 45c0762f1b9b
Worked: (newest version of Blender that worked as expected)

Short description of error
Importing zstandard with import zstandard gives the following error:

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "/home/guest/.local/lib/python3.10/site-packages/zstandard/__init__.py", line 39, in <module>
    from .backend_c import *  # type: ignore
ImportError: zstd C API versions mismatch; Python bindings were not compiled/linked against expected zstd version (10500 returned by the lib, 10502 hardcoded in zstd headers, 10502 hardcoded in the cext)

Exact steps for others to reproduce the error
import zstandard

**System Information** Operating system: Linux-5.17.15-76051715-generic-x86_64-with-glibc2.35 64 Bits, X11 UI Graphics card: Quadro RTX 6000/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 515.48.07 **Blender Version** Broken: version: 3.6.0 Alpha, branch: main, commit date: 2023-04-19 14:50, hash: `45c0762f1b9b` Worked: (newest version of Blender that worked as expected) **Short description of error** Importing zstandard with `import zstandard` gives the following error: ``` Traceback (most recent call last): File "<blender_console>", line 1, in <module> File "/home/guest/.local/lib/python3.10/site-packages/zstandard/__init__.py", line 39, in <module> from .backend_c import * # type: ignore ImportError: zstd C API versions mismatch; Python bindings were not compiled/linked against expected zstd version (10500 returned by the lib, 10502 hardcoded in zstd headers, 10502 hardcoded in the cext) ``` **Exact steps for others to reproduce the error** `import zstandard`
Simon Thommes added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-04-19 18:40:28 +02:00

We were looking into the issue with Simon. We did not notice that the zstandard is coming from the local pip install.

But this is actually something that feels strange. One would imagine that Blender will use the zstandard shipped with it, and not the one from pip. Otherwise it feels to be too easy to run into library version mismatch like that.

We were looking into the issue with Simon. We did not notice that the `zstandard` is coming from the local pip install. But this is actually something that feels strange. One would imagine that Blender will use the `zstandard ` shipped with it, and not the one from pip. Otherwise it feels to be too easy to run into library version mismatch like that.
Member

It's already a bit of a hassle to keep this in check, we ship very specific versions of both zstd and the python addon for this reason. The odd thing here is it using site packages outside the blender folder which as far as i know shouldn't happen unless you start blender with the --python-use-system-env flag?

It's already a bit of a hassle to keep this in check, we ship very specific versions of both zstd and the python addon for this reason. The odd thing here is it using site packages outside the blender folder which as far as i know shouldn't happen unless you start blender with the `--python-use-system-env` flag?

We just downloaded Blender from the buildbot and run it form the terminal without extra command line arguments.
What I am not sure about is the environment variables. Is there such variable with the same meaning as the --python-use-system-env flag?

We just downloaded Blender from the buildbot and run it form the terminal without extra command line arguments. What I am not sure about is the environment variables. Is there such variable with the same meaning as the `--python-use-system-env` flag?
Member

not that i'm aware of, we're venturing into campbell territory real quick, best diagnostics i have is

[root@SRV blender-3.6.0-alpha+main.45c0762f1b9b-linux.x86_64-release]# ./blender --log "bpy.interface" --log-level -1 -b --python-expr "import zstandard"
Blender 3.6.0 Alpha (hash 45c0762f1b9b built 2023-04-19 15:11:26)
shared memfd open() failed: Function not implemented
INFO (bpy.interface): source/blender/python/intern/bpy_interface.c:320 BPY_python_start: Initializing *without* support for the systems Python environment such as 'PYTHONPATH' and the user-site directory.

Blender quit

that'll tell you if it's allowing env vars to be respected or not

not that i'm aware of, we're venturing into campbell territory real quick, best diagnostics i have is ``` [root@SRV blender-3.6.0-alpha+main.45c0762f1b9b-linux.x86_64-release]# ./blender --log "bpy.interface" --log-level -1 -b --python-expr "import zstandard" Blender 3.6.0 Alpha (hash 45c0762f1b9b built 2023-04-19 15:11:26) shared memfd open() failed: Function not implemented INFO (bpy.interface): source/blender/python/intern/bpy_interface.c:320 BPY_python_start: Initializing *without* support for the systems Python environment such as 'PYTHONPATH' and the user-site directory. Blender quit ``` that'll tell you if it's allowing env vars to be respected or not

I kind of managed to reproduce the issue on my workstation by placing zstandard from python3.10 pip to my ~/.local/lib/python3.10/site-packages/zstandard (I had to do it manually since there is no easy way to me to install actual python3.10).

After that using the current buildbot build:

sergey@ws-sergey:~/Downloads/blender-3.6.0-alpha+main.f87e474af004-linux.x86_64-release$ ./blender --factory-startup --log "bpy.interface" --log-level -1 -b --python-expr "import zstandard"
Blender 3.6.0 Alpha (hash f87e474af004 built 2023-04-20 02:16:03)
Failed to open dir (No such file or directory): /run/user/1000/gvfs/
INFO (bpy.interface): source/blender/python/intern/bpy_interface.c:320 BPY_python_start: Initializing *without* support for the systems Python environment such as 'PYTHONPATH' and the user-site directory.
Error: Python: Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/sergey/.local/lib/python3.10/site-packages/zstandard/__init__.py", line 39, in <module>
    from .backend_c import *  # type: ignore
ImportError: zstd C API versions mismatch; Python bindings were not compiled/linked against expected zstd version (10500 returned by the lib, 10502 hardcoded in zstd headers, 10502 hardcoded in the cext)

Blender quit

And to my knowledge I do not have any special Blender or python environment variables.
The log also says *without* support for the systems Python environment such as 'PYTHONPATH' and the user-site directory, which does not seem to be the observed behavior.

I kind of managed to reproduce the issue on my workstation by placing zstandard from python3.10 pip to my `~/.local/lib/python3.10/site-packages/zstandard` (I had to do it manually since there is no easy way to me to install actual python3.10). After that using the current buildbot build: ``` sergey@ws-sergey:~/Downloads/blender-3.6.0-alpha+main.f87e474af004-linux.x86_64-release$ ./blender --factory-startup --log "bpy.interface" --log-level -1 -b --python-expr "import zstandard" Blender 3.6.0 Alpha (hash f87e474af004 built 2023-04-20 02:16:03) Failed to open dir (No such file or directory): /run/user/1000/gvfs/ INFO (bpy.interface): source/blender/python/intern/bpy_interface.c:320 BPY_python_start: Initializing *without* support for the systems Python environment such as 'PYTHONPATH' and the user-site directory. Error: Python: Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/sergey/.local/lib/python3.10/site-packages/zstandard/__init__.py", line 39, in <module> from .backend_c import * # type: ignore ImportError: zstd C API versions mismatch; Python bindings were not compiled/linked against expected zstd version (10500 returned by the lib, 10502 hardcoded in zstd headers, 10502 hardcoded in the cext) Blender quit ``` And to my knowledge I do not have any special Blender or python environment variables. The log also says `*without* support for the systems Python environment such as 'PYTHONPATH' and the user-site directory`, which does not seem to be the observed behavior.
Member

Looks like this is confirmed.
While not API related, will put on the Python API modules desk and summon @ideasman42 for further investigation.

Looks like this is confirmed. While not API related, will put on the `Python API` modules desk and summon @ideasman42 for further investigation.
Philipp Oeser changed title from Importing zstandard fails to Python: Importing zstandard fails 2023-04-21 11:08:39 +02:00
Sign in to join this conversation.
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
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#107137
No description provided.