Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blenderproc installed from repo and using 'pip install -e .' doesn't work with Python 3.11 #1134

Open
Griperis opened this issue Jul 30, 2024 · 1 comment
Labels
question Question, not yet a bug ;)

Comments

@Griperis
Copy link
Contributor

Griperis commented Jul 30, 2024

Describe the issue

If blenderproc is installed from the repository using pip install -e . in Python 3.12 everything works, and the command blenderproc prints help. If you have Python 3.11 and use the command above, launching blenderproc fails with an exception.

Hopefully, this isn't specific to my setup, but I tried cleaning python stuff wherever possible.

Traceback (most recent call last):
  File "\\?\C:\Python311\Scripts\blenderproc-script.py", line 33, in <module>
    sys.exit(load_entry_point('blenderproc', 'console_scripts', 'blenderproc')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\\?\C:\Python311\Scripts\blenderproc-script.py", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\importlib\metadata\__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "c:\users\gripe\polygoniq_projects\blenderproc\blenderproc\__init__.py", line 64, in <module>
    raise RuntimeError("\n###############\nThis script can only be run by \"blenderproc run\", instead of calling:"
RuntimeError:
###############
This script can only be run by "blenderproc run", instead of calling:
        python \\?\C:\Python311\Scripts\blenderproc
call:
        blenderproc run \\?\C:\Python311\Scripts\blenderproc
###############

Leads

I have not investigated whether something changed in how pip bundles packages, but checked out the file_names_on_stack variable, in blenderproc.__init__.py.

In Python 3.11:

['blenderproc-script.py', 'blenderproc-script.py', '__init__.py', '__init__.py', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap_external>', '<frozen importlib._bootstrap>', '__init__.py']

In Python 3.12:

['<frozen runpy>', '<frozen runpy>', '__main__.py', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap>', '<frozen importlib._bootstrap_external>', '<frozen importlib._bootstrap>', '__init__.py']

In Python 3.12 the condition in blenderproc.__init__.py:L50 passes, in 3.11 I can't see how the command can work without exception.

Minimal code example

# Have Python 3.11
# git clone this repo
pip install -e .
blenderproc

Files required to run the code

No response

Expected behavior

No RuntimeError, the blenderproc works without issues.

BlenderProc version

main

@cornerfarmer
Copy link
Member

cornerfarmer commented Dec 5, 2024

I could not really reproduce the error (on linux). Shouldn't there be the OUTSIDE_OF_THE_INTERNAL_BLENDER_PYTHON_ENVIRONMENT_BUT_IN_RUN_SCRIPT env var set when using the cli? So the error message shouldn't be thrown if that is the case (https://github.com/DLR-RM/BlenderProc/blob/main/blenderproc/__init__.py#L60)
Could you check whether the env var is set in your case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question, not yet a bug ;)
Projects
None yet
Development

No branches or pull requests

2 participants