command line arg "--python-use-system-env" not working anymore #88930

Closed
opened 2021-06-07 20:35:01 +02:00 by Tino Schmidhofer · 17 comments

System Information
Operating system: Windows-10-10.0.18363-SP0 64 Bits
Graphics card: Intel(R) UHD Graphics 620 Intel 4.5.0 - Build 26.20.100.7263

Blender Version
Broken: version: 2.93.0, branch: master, commit date: 2021-06-02 11:21, hash: 84da05a8b8
Worked: (newest version of Blender that worked as expected)

Short description of error
I am using an external python installation with additional installed modules.
Out of an set python environment I started blender with the --python-use-system-env argument. Blender starts but the in addition installed packages cannot be imported.

Exact steps for others to reproduce the error
[Please describe the exact steps needed to reproduce the issue]
[Based on the default startup or an attached .blend file (as simple as possible)]

Start of blender out of command shell:
Renamed blender python to python_
Made a link directory link to my conda python installation (same python version, additional installed packages) and named the junction link "python"

Start blender out of my conda environment:

"C:\Program Files\Blender Foundation\Blender 2.93\blender.exe" --python-use-system-env
Try to import within PYTHON INTERACTIVE CONSOLE 3.9.2 :
>>> import flask

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\site-packages\flask\__init__.py", line 16, in <module>
    from werkzeug.exceptions import abort
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\site-packages\werkzeug\__init__.py", line 1, in <module>
    from .serving import run_simple as run_simple
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\site-packages\werkzeug\serving.py", line 18, in <module>
    import socket
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\socket.py", line 49, in <module>
    import _socket
ImportError: DLL load failed while importing _socket: The specified module could not be found.

Everything worked fine in Blender 2.92

**System Information** Operating system: Windows-10-10.0.18363-SP0 64 Bits Graphics card: Intel(R) UHD Graphics 620 Intel 4.5.0 - Build 26.20.100.7263 **Blender Version** Broken: version: 2.93.0, branch: master, commit date: 2021-06-02 11:21, hash: `84da05a8b8` Worked: (newest version of Blender that worked as expected) **Short description of error** I am using an external python installation with additional installed modules. Out of an set python environment I started blender with the --python-use-system-env argument. Blender starts but the in addition installed packages cannot be imported. **Exact steps for others to reproduce the error** [Please describe the exact steps needed to reproduce the issue] [Based on the default startup or an attached .blend file (as simple as possible)] Start of blender out of command shell: Renamed blender python to python_ Made a link directory link to my conda python installation (same python version, additional installed packages) and named the junction link "python" Start blender out of my conda environment: ``` "C:\Program Files\Blender Foundation\Blender 2.93\blender.exe" --python-use-system-env Try to import within PYTHON INTERACTIVE CONSOLE 3.9.2 : >>> import flask Traceback (most recent call last): File "<blender_console>", line 1, in <module> File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\site-packages\flask\__init__.py", line 16, in <module> from werkzeug.exceptions import abort File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\site-packages\werkzeug\__init__.py", line 1, in <module> from .serving import run_simple as run_simple File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\site-packages\werkzeug\serving.py", line 18, in <module> import socket File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\python\lib\socket.py", line 49, in <module> import _socket ImportError: DLL load failed while importing _socket: The specified module could not be found. ``` Everything worked fine in Blender 2.92

Added subscriber: @schmti

Added subscriber: @schmti

Added subscriber: @Zandman

Added subscriber: @Zandman

Why do you rename Blender's Python and use a directory junction link? Shouldn't it be that once you use --python-use-system-env argument your custom Python stuff can simply be defined using environment variables, like PYTHONPATH? No need to overwrite Blender stuff. I could be wrong.

Why do you rename Blender's Python and use a directory junction link? Shouldn't it be that once you use `--python-use-system-env` argument your custom Python stuff can simply be defined using environment variables, like `PYTHONPATH`? No need to overwrite Blender stuff. I could be wrong.

Added subscriber: @iss

Added subscriber: @iss

Can not reproduce this issue, I have tried importing flask and cv2 modules, all were good. My python from https://www.python.org/downloads/release/python-395/. I don't have anything else like conda set up here.

Can not reproduce this issue, I have tried importing `flask` and `cv2` modules, all were good. My python from https://www.python.org/downloads/release/python-395/. I don't have anything else like conda set up here.
Member

Added subscriber: @ankitm

Added subscriber: @ankitm
Member

https://developer.blender.org/P2184 There are differences indeed in 2.93 and 2.92's sys.path with the --python-use-system-env flag.

https://developer.blender.org/P2184 There are differences indeed in 2.93 and 2.92's `sys.path` with the `--python-use-system-env` flag.
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

Also cannot reproduce this (everything in PYTHONPATH ends up in sys.path for me with the flag), or cannot really tell why these steps are necessary:

Renamed blender python to python_
Made a link directory link to my conda python installation (same python version, additional installed packages) and named the junction link "python"

@schmti : is there anything in PYTHONPATH for you?

Reg. the differences @ankitm was noticing (the local site-packages /Users/ankitkumar/.local/lib/python3.7/site-packages seems to be included in 2.92, but not in 2.93): same question here: @ankitm : is there anything in PYTHONPATH for you? Or is the addition of the the local site-packages purely "automatic"?
Now since 2.93 uses python 3.9, do you have something like /Users/ankitkumar/.local/lib/python3.9/site-packages as well?

Note: I have .local folders for both python versions, but they are not added automagically [neither with --python-use-system-env nor without -- only if I put them in PYTHONPATH]

Also cannot reproduce this (everything in `PYTHONPATH` ends up in `sys.path` for me with the flag), or cannot really tell why these steps are necessary: > Renamed blender python to python_ > Made a link directory link to my conda python installation (same python version, additional installed packages) and named the junction link "python" @schmti : is there anything in PYTHONPATH for you? Reg. the differences @ankitm was noticing (the local `site-packages` `/Users/ankitkumar/.local/lib/python3.7/site-packages` seems to be included in 2.92, but not in 2.93): same question here: @ankitm : is there anything in PYTHONPATH for you? Or is the addition of the the local `site-packages` purely "automatic"? Now since 2.93 uses python 3.9, do you have something like `/Users/ankitkumar/.local/lib/python3.9/site-packages` as well? Note: I have `.local` folders for both python versions, but they are not added automagically [neither with `--python-use-system-env` nor without -- only if I put them in PYTHONPATH]
Member

--python-use-system-env
Allow Python to use system environment variables such as PYTHONPATH and the user site-packages directory.

https://docs.python.org/3/library/site.html#site.USER_SITE

I can't redo it anymore..
In 2.93.0, 2.93.5, 3.0, .local site package dir is added to sys.path when using --python-use-system-env without using any env variable.

> --python-use-system-env > Allow Python to use system environment variables such as PYTHONPATH and the user site-packages directory. https://docs.python.org/3/library/site.html#site.USER_SITE I can't redo it anymore.. In 2.93.0, 2.93.5, 3.0, .local site package dir is added to sys.path when using `--python-use-system-env` without using any env variable.
Member

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'
Member

Added subscriber: @OmarEmaraDev

Added subscriber: @OmarEmaraDev
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

I can't replicate this either. As mentioned before, this is probably not how you should install additional modules from another environment, can you try without messing with Blender's python?
Assuming you have some environment with a compatible python version, you can launch blender with PYTHONPATH=/path/to/environment/lib/python3.10/site-packages blender --python-use-system-env.
Also see https://developer.blender.org/T75291#901886.

I can't replicate this either. As mentioned before, this is probably not how you should install additional modules from another environment, can you try without messing with Blender's python? Assuming you have some environment with a compatible python version, you can launch blender with `PYTHONPATH=/path/to/environment/lib/python3.10/site-packages blender --python-use-system-env`. Also see https://developer.blender.org/T75291#901886.

Changed status from 'Needs User Info' to: 'Archived'

Changed status from 'Needs User Info' to: 'Archived'

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed.

Thanks again for the report. If the problem persists please open a new report with the required information.

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed. Thanks again for the report. If the problem persists please open a new report with the required information.
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
6 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#88930
No description provided.