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

[BUG]: Numpy Multiarray - failure to run quickstart #793

Open
Lavaeolous opened this issue Jan 26, 2023 · 1 comment
Open

[BUG]: Numpy Multiarray - failure to run quickstart #793

Lavaeolous opened this issue Jan 26, 2023 · 1 comment
Labels
bug_on_windows bug Something isn't working

Comments

@Lavaeolous
Copy link

Lavaeolous commented Jan 26, 2023

Describe the bug
I installed BlenderProc via pip and wanted to start the quickstart demo. This failed with the error described in the log under "Additional Context".

General Information

  1. Which BlenderProc version are you using?
    2.5.0

  2. On which operating system are you?
    Windows 10 Pro

  3. Have you checked the issue tracker to see if a similar issue has been opened?
    Yes, there are two closed issues relating numpy/multiarray bugs ([BUG]: Import error when importing BlenderProc #722, [BUG]: No module named 'numpy.core._multiarray_umath' when trying to import numpy #780) in relation to add-ons used in blender. I use the blender version BlenderProc provided and have completely reset my user_prefs in blender and deactivated all add-ons, so i am not sure if they are related.

  4. Have you changed BlenderProc in any way besides the config file? If yes, are you sure that this change does not affect the problem you are having?
    I've only installed BlenderProc via pip into a new virtual environment without any changes to any file.

To Reproduce
Steps to reproduce the behavior:

  1. Provide the full command you used to run BlenderProc:
    blenderproc quickstart as well as blenderproc run quickstart.py after copying that to my working folder. Running blenderproc debug quickstart.py opens blender at least, but hitting run blenderproc generates the same error messages as without the debug option (see additional context). Run via VS Code terminal in my workspace, in the venv i created for the test. Running in a normal folder without a venv lead to the same issue.

  2. Provide the full python file, you used:

import blenderproc as bproc
import numpy as np

bproc.init()

# Create a simple object:
obj = bproc.object.create_primitive("MONKEY")

# Create a point light next to it
light = bproc.types.Light()
light.set_location([2, -2, 0])
light.set_energy(300)

# Set the camera to be in front of the object
cam_pose = bproc.math.build_transformation_mat([0, -5, 0], [np.pi / 2, 0, 0])
bproc.camera.add_camera_pose(cam_pose)

# Render the scene
data = bproc.renderer.render()

# Write the rendering into an hdf5 file
bproc.writer.write_hdf5("output/", data)
  1. Provide a link to all 3D models you used, if they are from one of the publicly available supported datasets, provide the name or path so that it is possible to reproduce the error.

Expected behavior
I expected the quickstart demo to run :D

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context - Log in VS Code
Further testing

  • Neither disabling nor removing all add-ons from blender helped
  • Installing BlenderProc on a different Machine (Windows 11) where no prior Python installation existed led to the quickstart working, So the issue seems to be dependend on my specific setup

Initial Log

(venv-test) PS D:\BlenderProc> blenderproc quickstart      
Warning: Changed install path from /home_local\DMNC... to C:\Users\DMNC..., there is no /home_local/ on this machine.
Using blender in C:\Users\DMNC\blender\blender-3.3.0-windows-x64
'blenderproc quickstart' is an alias for 'blenderproc run D:\BlenderProc\venv-test\lib\site-packages\blenderproc\scripts\quickstart.py'
Using temporary directory: C:\Users\DMNC\AppData\Local\Temp\blender_proc_fd20f66001e849df9d21e2c2a076f649
Blender 3.3.0 (hash 0759f671ce1f built 2022-09-07 00:44:18)
Read prefs: C:\Users\DMNC\AppData\Roaming\Blender Foundation\Blender\3.3\config\userpref.blend
Error: Python: Traceback (most recent call last):
  File "C:\Users\DMNC\blender\blender-3.3.0-windows-x64\blender-3.3.0-windows-x64\3.3\python\lib\site-packages\numpy\core\__init__.py", line 23, in <module>
    from . import multiarray
ImportError: cannot import name 'multiarray' from partially initialized module 'numpy.core' (most likely due to a circular import) (C:\Users\DMNC\blender\blender-3.3.0-windows-x64\blender-3.3.0-windows-x64\3.3\python\lib\site-packages\numpy\core\__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\BlenderProc\venv-test\lib\site-packages\blenderproc\scripts\quickstart.py", line 11, in <module>
    import blenderproc as bproc
  File "D:\BlenderProc\venv-test\lib\site-packages\blenderproc\__init__.py", line 20, in <module>
    SetupUtility.setup([])
  File "D:\BlenderProc\venv-test\lib\site-packages\blenderproc\python\utility\SetupUtility.py", line 59, in setup
    SetupUtility.setup_utility_paths(sys.argv[sys.argv.index("--") + 2])
  File "D:\BlenderProc\venv-test\lib\site-packages\blenderproc\python\utility\SetupUtility.py", line 78, in setup_utility_paths
    from blenderproc.python.utility.Utility import Utility, resolve_path
  File "D:\BlenderProc\venv-test\lib\site-packages\blenderproc\python\utility\Utility.py", line 16, in <module>
    import numpy as np
  File "C:\Users\DMNC\blender\blender-3.3.0-windows-x64\blender-3.3.0-windows-x64\3.3\python\lib\site-packages\numpy\__init__.py", line 144, in <module>
    from . import core
  File "C:\Users\DMNC\blender\blender-3.3.0-windows-x64\blender-3.3.0-windows-x64\3.3\python\lib\site-packages\numpy\core\__init__.py", line 49, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.10 from "C:\Users\DMNC\blender\blender-3.3.0-windows-x64\blender-3.3.0-windows-x64\3.3\python\bin\python.EXE"
  * The NumPy version is: "1.22.0"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: cannot import name 'multiarray' from partially initialized module 'numpy.core' (most likely due to a circular import) (C:\Users\DMNC\blender\blender-3.3.0-windows-x64\blender-3.3.0-windows-x64\3.3\python\lib\site-packages\numpy\core\__init__.py)

Error: script failed, file: 'D:\BlenderProc\venv-test\lib\site-packages\blenderproc\scripts\quickstart.py', exiting.
Cleaning temporary directory
@Lavaeolous Lavaeolous added the bug Something isn't working label Jan 26, 2023
@Lavaeolous Lavaeolous changed the title [BUG]: Numpy Multiarray - failure to run quicksart Jan 26, 2023
@Sebastian-Jung
Copy link
Contributor

Hello and thank you for the time to write an issue!

Can you provide us the following informations:

  1. How did you install blenderproc exactly? You mentioned Running in a normal folder without a venv lead to the same issue. did you also install blenderproc using the global python interpreter?
  2. Please provide the output of
// Activate you venv and run
which python
python --version
python -m pip list
python -c 'import numpy;print(numpy.__version__);print(numpy.__file__)'

// Test blender internal python interpreter
C:\Users\DMNC\blender\blender-3.3.0-windows-x64\blender-3.3.0-windows-x64\3.3\python\bin\python.EXE --version
C:\Users\DMNC\blender\blender-3.3.0-windows-x64\blender-3.3.0-windows-x64\3.3\python\bin\python.EXE -m pip list
C:\Users\DMNC\blender\blender-3.3.0-windows-x64\blender-3.3.0-windows-x64\3.3\python\bin\python.EXE  -c 'import numpy;print(numpy.__version__);print(numpy.__file__)'

You might have to change some of the commands to work with windows.

Thanks,
Seb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug_on_windows bug Something isn't working
3 participants