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

Julia code returns lists with Blender's numpy #2

Open
paulmelis opened this issue Sep 3, 2020 · 24 comments
Open

Julia code returns lists with Blender's numpy #2

paulmelis opened this issue Sep 3, 2020 · 24 comments

Comments

@paulmelis
Copy link
Owner

Comparing the returned values of the subdivide() in catmull-clark.jl call under Blender and from regular Python I noticed the following. This is based on the code in test/subdiv.py, which is also stored in test.blend under (text) in the Blender Text Editor.

Python 3.8.5 (command-line)

melis@juggle 20:46:~/concepts/blender-julia-test/test$ python subdiv.py
/usr/lib/python3.8/site-packages/numpy/__init__.py
1.19.1
/home/melis/.local/lib/python3.8/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.533ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 21.688ms
<class 'numpy.ndarray'>
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ]
<class 'numpy.ndarray'>
[ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93]
<class 'numpy.ndarray'>
[4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
<class 'numpy.ndarray'>
[15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]

Blender 2.90 (Run script from UI)

/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/__init__.py
1.17.5
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 0.018ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 0.127ms
<class 'list'>
[-0.5555555820465088, -0.5555555820465088, -0.5555555820465088, -0.5061728358268738, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.6049383282661438, -0.5061728358268738, -0.5061728358268738, 0.5665295124053955, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.5665295124053955, -0.44581618905067444, 0.5208048224449158, 0.520804762840271, 0.520804762840271, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, -0.75, -0.75, 0.0, -0.75, 0.0, 0.75, -0.75, 0.75, 0.0, -0.75, 0.0, -0.75, 0.0, 0.75, 0.75, 0.75, 0.75, 0.0, 0.0, 0.75, -0.75, 0.75, 0.0, 0.75, 0.75, -0.75, 0.0, 0.75, 0.0, -0.75, 0.0, -0.75, 0.75, 0.0, -0.75, -0.75]
<class 'list'>
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93]
<class 'list'>
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
<class 'list'>
[15, 2, 16, 9, 16, 4, 17, 9, 17, 3, 18, 9, 18, 1, 15, 9, 17, 4, 19, 10, 19, 8, 20, 10, 20, 7, 21, 10, 21, 3, 17, 10, 20, 8, 22, 11, 22, 6, 23, 11, 23, 5, 24, 11, 24, 7, 20, 11, 23, 6, 25, 12, 25, 2, 15, 12, 15, 1, 26, 12, 26, 5, 23, 12, 21, 7, 24, 13, 24, 5, 26, 13, 26, 1, 18, 13, 18, 3, 21, 13, 19, 4, 16, 14, 16, 2, 25, 14, 25, 6, 22, 14, 22, 8, 19, 14]

Summary

Python 3.8.5 (command-line):

  • subdivide() returns a tuple of 4 numpy.ndarray values, as expected
  • NumPy version 1.19.1
  • PyJulia version 0.5.4

Blender 2.90 (UI):

  • subdivide() returns a tuple of 4 lists
  • Python 3.7.7 (as included in Blender)
  • NumPy 1.17.5
  • PyJulia 0.5.4

So the differences are probably caused by a different version for Python and/or NumPy.

Rebuilding PyCall from within Blender ((rebuild pycall) text tab) makes no difference.

@paulmelis
Copy link
Owner Author

Checking differences in julia.install() output.

Command-line Python:

melis@juggle 20:47:~/concepts/blender-julia-test/test$ python
Python 3.8.5 (default, Jul 27 2020, 08:42:51) 
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import julia
>>> julia.install()
[ Info: Julia version info
Julia Version 1.5.0
Commit 96786e22cc* (2020-08-01 23:44 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      "Arch Linux"
  uname: Linux 5.7.12-arch1-1 #1 SMP PREEMPT Fri, 31 Jul 2020 17:38:22 +0000 x86_64 unknown
  CPU: Intel(R) Core(TM) i5-4460  CPU @ 3.20GHz: 
              speed         user         nice          sys         idle          irq
       #1  3337 MHz     194500 s         83 s      85782 s    6606330 s      14217 s
       #2  3287 MHz     188803 s         67 s      67846 s    6627848 s      23495 s
       #3  3391 MHz     178286 s         71 s      54574 s    6655102 s       4923 s
       #4  3351 MHz     159383 s         72 s      49577 s    6696040 s       2958 s
       
  Memory: 7.712959289550781 GB (3372.6640625 MB free)
  Uptime: 69968.0 sec
  Load Avg:  0.521484375  0.4716796875  0.3701171875
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-10.0.1 (ORCJIT, haswell)
Environment:
  XDG_SESSION_PATH = /org/freedesktop/DisplayManager/Session0
  HOME = /home/melis
  XDG_SEAT_PATH = /org/freedesktop/DisplayManager/Seat0
  PYTHONPATH = /home/melis/projects/mvq-py-git:/home/melis/software/pywebkitgtk/lib64/python2.7/site-packages/:
  TERM = xterm-color
  CUDA_PATH = /opt/cuda
  MOZ_PLUGIN_PATH = /usr/lib/mozilla/plugins
  PATH = /home/melis/software/miniconda3/condabin:/home/melis/projects/packages:/home/melis/.local/bin:/home/melis/software/ParaView-5.5.2-Qt5-MPI-Linux-64bit/bin:/home/melis/scripts:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/opt/cuda/bin:/usr/lib/emscripten:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
[ Info: Julia executable: /usr/bin/julia
[ Info: Trying to import PyCall...
┌ Info: PyCall is already installed and compatible with Python executable.
│ 
│ PyCall:
│     python: /usr/bin/python3
│     libpython: /usr/lib/libpython3.8.so.1.0
│ Python:
│     python: /usr/bin/python
└     libpython: /usr/lib/libpython3.8.so.1.0

Blender:

[ Info: Julia version info
Julia Version 1.5.0
Commit 96786e22cc* (2020-08-01 23:44 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      "Arch Linux"
  uname: Linux 5.7.12-arch1-1 #1 SMP PREEMPT Fri, 31 Jul 2020 17:38:22 +0000 x86_64 unknown
  CPU: Intel(R) Core(TM) i5-4460  CPU @ 3.20GHz: 
              speed         user         nice          sys         idle          irq
       #1  3327 MHz     194747 s         83 s      85909 s    6610245 s      14246 s
       #2  3390 MHz     189044 s         67 s      67909 s    6631992 s      23502 s
       #3  3306 MHz     178639 s         71 s      54635 s    6659083 s       4931 s
       #4  3298 MHz     159463 s         72 s      49620 s    6700351 s       2962 s
       
  Memory: 7.712959289550781 GB (3357.9375 MB free)
  Uptime: 70013.0 sec
  Load Avg:  0.44189453125  0.4521484375  0.36669921875
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-10.0.1 (ORCJIT, haswell)
Environment:
  XDG_SESSION_PATH = /org/freedesktop/DisplayManager/Session0
  HOME = /home/melis
  XDG_SEAT_PATH = /org/freedesktop/DisplayManager/Seat0
  PYTHONPATH = /home/melis/projects/mvq-py-git:/home/melis/software/pywebkitgtk/lib64/python2.7/site-packages/:
  TERM = xterm-color
  CUDA_PATH = /opt/cuda
  MOZ_PLUGIN_PATH = /usr/lib/mozilla/plugins
  PATH = /home/melis/software/miniconda3/condabin:/home/melis/projects/packages:/home/melis/.local/bin:/home/melis/software/ParaView-5.5.2-Qt5-MPI-Linux-64bit/bin:/home/melis/scripts:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/opt/cuda/bin:/usr/lib/emscripten:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
[ Info: Julia executable: /usr/bin/julia
[ Info: Trying to import PyCall...
┌ Warning: PyCall is already installed.  However, you may have trouble using
│ this Python executable because it is statically linked to libpython.
│ 
│ For more information, see:
│     https://pyjulia.readthedocs.io/en/latest/troubleshooting.html
│ 
│ Python executable:
│     /home/melis/software/blender-2.90.0-linux64/blender
│ Julia executable:
│     /usr/bin/julia
└ @ Main ~/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/julia/install.jl:90

So the fact that Blender links statically to libpython is definitly a difference that might be of influence here.

paulmelis added a commit that referenced this issue Sep 3, 2020
…when

running the same code under plain Python (where it returns numpy arrays).
No clear cause found, see #2 for details
@paulmelis
Copy link
Owner Author

paulmelis commented Sep 4, 2020

With a locally compiled version of Python 3.7.7 statically linked to libpython and NumPy 1.19.1 it works correctly:

melis@juggle 09:04:~/concepts/blender-julia-test/test$ ~/software/python-3.7.7-static/bin/python3.7m -m pip install -U numpy --user
Collecting numpy
  Downloading https://files.pythonhosted.org/packages/50/8f/29d5688614f9bba59931683d5d353d738d4a3007833219ee19c455732753/numpy-1.19.1-cp37-cp37m-manylinux2010_x86_64.whl (14.5MB)
     |████████████████████████████████| 14.5MB 5.7MB/s 
Installing collected packages: numpy
Successfully installed numpy-1.19.1
melis@juggle 09:04:~/concepts/blender-julia-test/test$ ~/software/python-3.7.7-static/bin/python3.7m -m pip install -U julia --user
Collecting julia
  Using cached https://files.pythonhosted.org/packages/af/d2/15aeddffc2d6799fef41552a9949b72983f59659cf68e94add1c6a3e2631/julia-0.5.4-py2.py3-none-any.whl
Installing collected packages: julia
Successfully installed julia-0.5.4
melis@juggle 09:04:~/concepts/blender-julia-test/test$ ~/software/python-3.7.7-static/bin/python3.7m subdiv.py 
/home/melis/.local/lib/python3.7/site-packages/numpy/__init__.py
1.19.1
/home/melis/.local/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.531ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 22.324ms
<class 'numpy.ndarray'>
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ]
<class 'numpy.ndarray'>
[ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93]
<class 'numpy.ndarray'>
[4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
<class 'numpy.ndarray'>
[15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]

So could be a NumPy version-related issue?

@paulmelis
Copy link
Owner Author

paulmelis commented Sep 4, 2020

Python 3.8.5 (system version) with older NumPy 1.17.5 WORKS:

melis@juggle 09:15:/tmp$ virtualenv env
created virtual environment CPython3.8.5.final.0-64 in 3219ms
  creator CPython3Posix(dest=/tmp/env, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/home/melis/.local/share/virtualenv/seed-app-data/v1.0.1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
melis@juggle 09:16:/tmp$ source env/bin/activate
(env) melis@juggle 09:16:/tmp$ which python
/tmp/env/bin/python
(env) melis@juggle 09:16:/tmp$ python
Python 3.8.5 (default, Jul 27 2020, 08:42:51) 
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
>>> 
(env) melis@juggle 09:16:/tmp$ which pip
/tmp/env/bin/pip
(env) melis@juggle 09:16:/tmp$ pip install numpy==1.17.5
Collecting numpy==1.17.5
  Downloading numpy-1.17.5-cp38-cp38-manylinux1_x86_64.whl (20.5 MB)
     |████████████████████████████████| 20.5 MB 6.6 MB/s 
Installing collected packages: numpy
Successfully installed numpy-1.17.5
(env) melis@juggle 09:18:/tmp$ pip install julia
Collecting julia
  Using cached julia-0.5.4-py2.py3-none-any.whl (66 kB)
Installing collected packages: julia
Successfully installed julia-0.5.4

(env) melis@juggle 09:18:~$ cd concepts/blender-julia-test/test
(env) melis@juggle 09:18:~/concepts/blender-julia-test/test$ python subdiv.py 
/tmp/env/lib/python3.8/site-packages/numpy/__init__.py
1.17.5
/tmp/env/lib/python3.8/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.535ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 21.894ms
<class 'numpy.ndarray'>
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ]
<class 'numpy.ndarray'>
[ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93]
<class 'numpy.ndarray'>
[4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
<class 'numpy.ndarray'>
[15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]

Dang, so it's not just the older NumPy

@paulmelis
Copy link
Owner Author

paulmelis commented Sep 4, 2020

Static Python 3.7.7 with older Numpy 1.17.5 WORKS:

melis@juggle 09:24:~/concepts/blender-julia-test/test$ ~/software/python-3.7.7-static/bin/python3.7m -m pip install -U numpy==1.17.5
Collecting numpy==1.17.5
  Downloading https://files.pythonhosted.org/packages/b1/51/20098150b6108061cb7542af3de7bfcfe0182bca21613697153e49dc4adc/numpy-1.17.5-cp37-cp37m-manylinux1_x86_64.whl (20.0MB)
     |████████████████████████████████| 20.0MB 6.5MB/s 
Installing collected packages: numpy
  Found existing installation: numpy 1.19.1
    Uninstalling numpy-1.19.1:
      Successfully uninstalled numpy-1.19.1
Successfully installed numpy-1.17.5
melis@juggle 09:24:~/concepts/blender-julia-test/test$ ~/software/python-3.7.7-static/bin/python3.7m 
Python 3.7.7 (default, Sep  4 2020, 09:00:20) 
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__version__
'1.17.5'
>>> 
melis@juggle 09:24:~/concepts/blender-julia-test/test$ ~/software/python-3.7.7-static/bin/python3.7m subdiv.py 
/home/melis/software/python-3.7.7-static/lib/python3.7/site-packages/numpy/__init__.py
1.17.5
/home/melis/.local/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.527ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 22.234ms
<class 'numpy.ndarray'>
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ]
<class 'numpy.ndarray'>
[ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93]
<class 'numpy.ndarray'>
[4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
<class 'numpy.ndarray'>
[15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]

@paulmelis
Copy link
Owner Author

paulmelis commented Sep 4, 2020

Using the python3.7m interpreter included in Blender (3.7.7, statically linked to libpython, NumPy 1.17.5) FAILS:

melis@juggle 09:25:~/concepts/blender-julia-test/test$ ldd ~/software/blender-2.90.0-linux64/2.90/python/bin/python3.7m
	linux-vdso.so.1 (0x00007ffc432d7000)
	libcrypt.so.1 => /usr/lib/libcrypt.so.1 (0x00007f63760b8000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f6376096000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f6376090000)
	libutil.so.1 => /usr/lib/libutil.so.1 (0x00007f637608b000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f6375f46000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f6375d7f000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6376172000)
melis@juggle 09:25:~/concepts/blender-julia-test/test$ ~/software/blender-2.90.0-linux64/2.90/python/bin/python3.7m 
Python 3.7.7 (default, Jul  9 2020, 12:52:49) 
[GCC 9.3.1 20200408 (Red Hat 9.3.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__version__
'1.17.5'
>>> 
melis@juggle 09:27:~/concepts/blender-julia-test/test$ ~/software/blender-2.90.0-linux64/2.90/python/bin/python3.7m subdiv.py 
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/__init__.py
1.17.5
/home/melis/.local/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.547ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 22.337ms
<class 'list'>
[-0.5555555820465088, -0.5555555820465088, -0.5555555820465088, -0.5061728358268738, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.6049383282661438, -0.5061728358268738, -0.5061728358268738, 0.5665295124053955, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.5665295124053955, -0.44581618905067444, 0.5208048224449158, 0.520804762840271, 0.520804762840271, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, -0.75, -0.75, 0.0, -0.75, 0.0, 0.75, -0.75, 0.75, 0.0, -0.75, 0.0, -0.75, 0.0, 0.75, 0.75, 0.75, 0.75, 0.0, 0.0, 0.75, -0.75, 0.75, 0.0, 0.75, 0.75, -0.75, 0.0, 0.75, 0.0, -0.75, 0.0, -0.75, 0.75, 0.0, -0.75, -0.75]
<class 'list'>
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93]
<class 'list'>
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
<class 'list'>
[15, 2, 16, 9, 16, 4, 17, 9, 17, 3, 18, 9, 18, 1, 15, 9, 17, 4, 19, 10, 19, 8, 20, 10, 20, 7, 21, 10, 21, 3, 17, 10, 20, 8, 22, 11, 22, 6, 23, 11, 23, 5, 24, 11, 24, 7, 20, 11, 23, 6, 25, 12, 25, 2, 15, 12, 15, 1, 26, 12, 26, 5, 23, 12, 21, 7, 24, 13, 24, 5, 26, 13, 26, 1, 18, 13, 18, 3, 21, 13, 19, 4, 16, 14, 16, 2, 25, 14, 25, 6, 22, 14, 22, 8, 19, 14]

@paulmelis
Copy link
Owner Author

Comparing python binaries linking statically to libpython:

# Blender
melis@juggle 09:28:~/concepts/blender-julia-test/test$ ldd ~/software/blender-2.90.0-linux64/2.90/python/bin/python3.7m
	linux-vdso.so.1 (0x00007ffc432d7000)
	libcrypt.so.1 => /usr/lib/libcrypt.so.1 (0x00007f63760b8000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f6376096000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f6376090000)
	libutil.so.1 => /usr/lib/libutil.so.1 (0x00007f637608b000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f6375f46000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f6375d7f000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6376172000)
# Manually built
melis@juggle 09:28:~/concepts/blender-julia-test/test$ ldd ~/software/python-3.7.7-static/bin/python3.7m
	linux-vdso.so.1 (0x00007ffddf1f5000)
	libcrypt.so.1 => /usr/lib/libcrypt.so.1 (0x00007f37fe5b4000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f37fe592000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f37fe58c000)
	libutil.so.1 => /usr/lib/libutil.so.1 (0x00007f37fe587000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f37fe442000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f37fe27b000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f37fe9ae000)

I.e. same set of dynamic libs used

@paulmelis
Copy link
Owner Author

Manually built Python 3.7.7 using Blender's site-packages (i.e. numpy and pyjulia) FAILS:

melis@juggle 09:31:~/concepts/blender-julia-test/test$ PYTHONPATH=$HOME/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages ~/software/python-3.7.7-static/bin/python3.7m
Python 3.7.7 (default, Sep  4 2020, 09:00:20) 
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__file__
'/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/__init__.py'
>>> 
melis@juggle 09:34:~/concepts/blender-julia-test/test$ PYTHONPATH=$HOME/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages ~/software/python-3.7.7-static/bin/python3.7m subdiv.py 
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/__init__.py
1.17.5
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.487ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 21.800ms
<class 'list'>
[-0.5555555820465088, -0.5555555820465088, -0.5555555820465088, -0.5061728358268738, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.6049383282661438, -0.5061728358268738, -0.5061728358268738, 0.5665295124053955, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.5665295124053955, -0.44581618905067444, 0.5208048224449158, 0.520804762840271, 0.520804762840271, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, -0.75, -0.75, 0.0, -0.75, 0.0, 0.75, -0.75, 0.75, 0.0, -0.75, 0.0, -0.75, 0.0, 0.75, 0.75, 0.75, 0.75, 0.0, 0.0, 0.75, -0.75, 0.75, 0.0, 0.75, 0.75, -0.75, 0.0, 0.75, 0.0, -0.75, 0.0, -0.75, 0.75, 0.0, -0.75, -0.75]
<class 'list'>
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93]
<class 'list'>
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
<class 'list'>
[15, 2, 16, 9, 16, 4, 17, 9, 17, 3, 18, 9, 18, 1, 15, 9, 17, 4, 19, 10, 19, 8, 20, 10, 20, 7, 21, 10, 21, 3, 17, 10, 20, 8, 22, 11, 22, 6, 23, 11, 23, 5, 24, 11, 24, 7, 20, 11, 23, 6, 25, 12, 25, 2, 15, 12, 15, 1, 26, 12, 26, 5, 23, 12, 21, 7, 24, 13, 24, 5, 26, 13, 26, 1, 18, 13, 18, 3, 21, 13, 19, 4, 16, 14, 16, 2, 25, 14, 25, 6, 22, 14, 22, 8, 19, 14]

So there really appears to be something different in the numpy included with Blender (as pyjulia is the same).

@paulmelis
Copy link
Owner Author

Blender's numpy is patched, but nothing of importance here.

Numpy build script in Blender also doesn't reveal anything noteworthy.

@paulmelis
Copy link
Owner Author

paulmelis commented Sep 4, 2020

Running Blender's python3.7m binary with the site-packages of the manually built Python 3.7.7 WORKS:

melis@juggle 09:40:~/concepts/blender-julia-test/test$ PYTHONPATH=$HOME/software/python-3.7.7-static/lib/python3.7/site-packages/ ~/software/blender-2.90.0-linux64/2.90/python/bin/python3.7m subdiv.py 
/home/melis/software/python-3.7.7-static/lib/python3.7/site-packages/numpy/__init__.py
1.17.5
/home/melis/.local/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.494ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 22.240ms
<class 'numpy.ndarray'>
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ]
<class 'numpy.ndarray'>
[ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93]
<class 'numpy.ndarray'>
[4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
<class 'numpy.ndarray'>
[15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]

So that's pretty definitive, it is the numpy in Blender that's causing this.

@paulmelis
Copy link
Owner Author

paulmelis commented Sep 4, 2020

Doing the same trick with Blender itself (i.e. override PYTHONPATH to point to the site-packages of the manually built Python 3.7.7) WORKS!

melis@juggle 09:44:~/concepts/blender-julia-test$ PYTHONPATH=$HOME/software/python-3.7.7-static/lib/python3.7/site-packages/ ~/software/blender-2.90.0-linux64/blender --python-use-system-env
Read prefs: /home/melis/.config/blender/2.90/config/userpref.blend
found bundled python: /home/melis/software/blender-2.90.0-linux64/2.90/python
Read blend: /home/melis/concepts/blender-julia-test/test.blend
Initializing Julia (this might take a moment the first time)...
Done!
(Blender) Preparing data took 0.499ms
(Julia) Building half edges done in 1.479ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 21.253ms
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ] [ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93] [4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4] [15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]
<class 'numpy.ndarray'>
(Blender) Call to Julia subdivision took 2110.277ms
(Blender) Updating subdivided mesh took 0.733ms
(Blender) Total time: 2111.508ms
Info: Deleted 1 object(s)

Initializing Julia (this might take a moment the first time)...
Done!
(Blender) Preparing data took 0.042ms
(Julia) Building half edges done in 0.019ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 0.158ms
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ] [ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93] [4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4] [15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]
<class 'numpy.ndarray'>
(Blender) Call to Julia subdivision took 211.427ms
(Blender) Updating subdivided mesh took 0.602ms
(Blender) Total time: 212.071ms

Getting back numpy arrays instead of lists from Julia also provides (as expected) a massive speedup. Here's the Bunny model:

Initializing Julia (this might take a moment the first time)...
Done!
(Blender) Preparing data took 1.863ms
(Julia) Building half edges done in 79.709ms
(Julia) Input: 35947 vertices, 69451 polygons, 104288 polygon edges
(Julia) Output: 209686 vertices, 208353 quads
(Julia) Subdivision done in 54.399ms
[-0.26612237  0.04188797  0.94303054 ... -0.5553862  -0.2588799
  0.0315131 ] [     1      5      9 ... 833401 833405 833409] [4 4 4 ... 4 4 4] [105399  21216 105400 ...  17278 209686 105398]
<class 'numpy.ndarray'>
(Blender) Call to Julia subdivision took 351.701ms
(Blender) Updating subdivided mesh took 269.674ms
(Blender) Total time: 623.238ms

So 623.674ms total instead of 1379.705ms as reported in the readme. Another factor of 2.2x faster, wow. So compared to the subsurf modifier time of 13583.849ms the Julia version would be 21.8x faster...

@paulmelis paulmelis changed the title Differences in return types between Blender and standalone Python Julia code returns lists with Blender's numpy Sep 4, 2020
@paulmelis
Copy link
Owner Author

paulmelis commented Sep 4, 2020

Hmm, this might still be something with the julia package as installed in Blender. Doing the subdiv.py test from Blender uses julia from .local and WORKS:

/home/melis/software/python-3.7.7-static/lib/python3.7/site-packages/numpy/__init__.py
1.17.5
/home/melis/.local/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 0.018ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 0.150ms
<class 'numpy.ndarray'>
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ]
<class 'numpy.ndarray'>
[ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93]
<class 'numpy.ndarray'>
[4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
<class 'numpy.ndarray'>
[15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]

Removing julia from Blender's site-packages are retesting from within Blender using the site-packages from the manually built Python WORKS:

melis@juggle 09:55:~/concepts/blender-julia-test$ rm -rf ~/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/julia*
melis@juggle 09:55:~/concepts/blender-julia-test$ PYTHONPATH=$HOME/software/python-3.7.7-static/lib/python3.7/site-packages/ ~/software/blender-2.90.0-linux64/blender --python-use-system-env
Read prefs: /home/melis/.config/blender/2.90/config/userpref.blend
found bundled python: /home/melis/software/blender-2.90.0-linux64/2.90/python
Read blend: /home/melis/concepts/blender-julia-test/test.blend
/home/melis/software/python-3.7.7-static/lib/python3.7/site-packages/numpy/__init__.py
1.17.5
/home/melis/.local/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.488ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 21.158ms
<class 'numpy.ndarray'>
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ]
<class 'numpy.ndarray'>
[ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93]
<class 'numpy.ndarray'>
[4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
<class 'numpy.ndarray'>
[15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]

So the julia package isn't of influence. Hmmm, just to make sure running subdiv.py test from within Blender but allowing Blender to pick up the julia package from .local (but still using Blender's own numpy) FAILS:

melis@juggle 09:57:~/concepts/blender-julia-test$ ~/software/blender-2.90.0-linux64/blender --python-use-system-env
Read prefs: /home/melis/.config/blender/2.90/config/userpref.blend
found bundled python: /home/melis/software/blender-2.90.0-linux64/2.90/python
Read blend: /home/melis/concepts/blender-julia-test/test.blend
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/__init__.py
1.17.5
/home/melis/.local/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.578ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 22.457ms
<class 'list'>
[-0.5555555820465088, -0.5555555820465088, -0.5555555820465088, -0.5061728358268738, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.6049383282661438, -0.5061728358268738, -0.5061728358268738, 0.5665295124053955, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.5665295124053955, -0.44581618905067444, 0.5208048224449158, 0.520804762840271, 0.520804762840271, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, -0.75, -0.75, 0.0, -0.75, 0.0, 0.75, -0.75, 0.75, 0.0, -0.75, 0.0, -0.75, 0.0, 0.75, 0.75, 0.75, 0.75, 0.0, 0.0, 0.75, -0.75, 0.75, 0.0, 0.75, 0.75, -0.75, 0.0, 0.75, 0.0, -0.75, 0.0, -0.75, 0.75, 0.0, -0.75, -0.75]
<class 'list'>
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93]
<class 'list'>
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
<class 'list'>
[15, 2, 16, 9, 16, 4, 17, 9, 17, 3, 18, 9, 18, 1, 15, 9, 17, 4, 19, 10, 19, 8, 20, 10, 20, 7, 21, 10, 21, 3, 17, 10, 20, 8, 22, 11, 22, 6, 23, 11, 23, 5, 24, 11, 24, 7, 20, 11, 23, 6, 25, 12, 25, 2, 15, 12, 15, 1, 26, 12, 26, 5, 23, 12, 21, 7, 24, 13, 24, 5, 26, 13, 26, 1, 18, 13, 18, 3, 21, 13, 19, 4, 16, 14, 16, 2, 25, 14, 25, 6, 22, 14, 22, 8, 19, 14]

So still points to Blender's numpy being at fault.

@paulmelis
Copy link
Owner Author

paulmelis commented Sep 4, 2020

Upgrading Blender's numpy using pip (and reinstall a local copy of pyjulia) fixes this for now:

melis@juggle 09:59:~/concepts/blender-julia-test$ ~/software/blender-2.90.0-linux64/2.90/python/bin/python3.7m -m pip install numpy
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/50/8f/29d5688614f9bba59931683d5d353d738d4a3007833219ee19c455732753/numpy-1.19.1-cp37-cp37m-manylinux2010_x86_64.whl
Installing collected packages: numpy
Successfully installed numpy-1.19.1
melis@juggle 10:01:~/concepts/blender-julia-test$ ~/software/blender-2.90.0-linux64/blender
Read prefs: /home/melis/.config/blender/2.90/config/userpref.blend
found bundled python: /home/melis/software/blender-2.90.0-linux64/2.90/python
Read blend: /home/melis/concepts/blender-julia-test/test.blend
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/__init__.py
1.19.1
Traceback (most recent call last):
  File "/home/melis/concepts/blender-julia-test/test.blend/(test)", line 6, in <module>
ModuleNotFoundError: No module named 'julia'
Error: Python script failed, check the message in the system console

Saved session recovery to '/tmp/quit.blend'

Blender quit
melis@juggle 10:01:~/concepts/blender-julia-test$ ~/software/blender-2.90.0-linux64/2.90/python/bin/python3.7m -m pip install julia
Requirement already satisfied: julia in /home/melis/.local/lib/python3.7/site-packages (0.5.4)
melis@juggle 10:01:~/concepts/blender-julia-test$ ~/software/blender-2.90.0-linux64/2.90/python/bin/python3.7m -m pip install -U julia
Requirement already up-to-date: julia in /home/melis/.local/lib/python3.7/site-packages (0.5.4)
melis@juggle 10:02:~/concepts/blender-julia-test$ ~/software/blender-2.90.0-linux64/2.90/python/bin/python3.7m -m pip install -U julia --force-reinstall
Collecting julia
  Using cached https://files.pythonhosted.org/packages/af/d2/15aeddffc2d6799fef41552a9949b72983f59659cf68e94add1c6a3e2631/julia-0.5.4-py2.py3-none-any.whl
Installing collected packages: julia
  Found existing installation: julia 0.5.4
    Uninstalling julia-0.5.4:
      Successfully uninstalled julia-0.5.4
Successfully installed julia-0.5.4
melis@juggle 10:02:~/concepts/blender-julia-test$ ls ~/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/
certifi  chardet  idna  julia  julia-0.5.4.dist-info  libextern_draco.so  numpy  numpy-1.19.1.dist-info  numpy.libs  requests  urllib3
melis@juggle 10:02:~/concepts/blender-julia-test$ ~/software/blender-2.90.0-linux64/blender
Read prefs: /home/melis/.config/blender/2.90/config/userpref.blend
found bundled python: /home/melis/software/blender-2.90.0-linux64/2.90/python
Read blend: /home/melis/concepts/blender-julia-test/test.blend
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/__init__.py
1.19.1
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.445ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 21.566ms
<class 'numpy.ndarray'>
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ]
<class 'numpy.ndarray'>
[ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93]
<class 'numpy.ndarray'>
[4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
<class 'numpy.ndarray'>
[15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]

But has the downside of using a non-standard installation of Blender.

@paulmelis
Copy link
Owner Author

Well, what do you know? Manually building NumPy 1.17.5 with the manually built static Python 3.3.7 FAILS:

melis@juggle 20:48:~/c$ wget https://github.com/numpy/numpy/archive/v1.17.5.tar.gz -O numpy-1.17.5.tar.gz
melis@juggle 20:49:~/c$ tar xf numpy-1.17.5.tar.gz 
melis@juggle 20:49:~/c$ cd numpy-1.17.5
melis@juggle 20:49:~/c/numpy-1.17.5$ ~/software/python-3.7.7-static/bin/python3 setup.py build
...
gcc -pthread -shared build/temp.linux-x86_64-3.7/numpy/random/mtrand.o build/temp.linux-x86_64-3.7/numpy/random/src/legacy/legacy-distributions.o build/temp.linux-x86_64-3.7/numpy/random/src/distributions/logfactorial.o build/temp.linux-x86_64-3.7/numpy/random/src/distributions/distributions.o -Lbuild/temp.linux-x86_64-3.7 -lm -o build/lib.linux-x86_64-3.7/numpy/random/mtrand.cpython-37m-x86_64-linux-gnu.so
...
melis@juggle 20:52:~/c/numpy-1.17.5$ cd build/lib.linux-x86_64-3.7/
melis@juggle 20:53:~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7$ ~/software/python-3.7.7-static/bin/python3
Python 3.7.7 (default, Sep  4 2020, 09:00:20) 
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__file__
'/home/melis/c/numpy-1.17.5/build/lib.linux-x86_64-3.7/numpy/__init__.py'
>>> 
melis@juggle 20:53:~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7$ ~/software/python-3.7.7-static/bin/python3 -m pip install -U julia
melis@juggle 20:53:~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7$ ls ~/software/python-3.7.7-static/lib/python3.7/site-packages/
julia  julia-0.5.4.dist-info  numpy  numpy-1.17.5.dist-info  README.txt

melis@juggle 20:54:~/concepts/blender-julia-test/test$ PYTHONPATH=~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7 ~/software/python-3.7.7-static/bin/python3.7m subdiv.py 
/home/melis/c/numpy-1.17.5/build/lib.linux-x86_64-3.7/numpy/__init__.py
1.17.5
/home/melis/software/python-3.7.7-static/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.513ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 22.505ms
<class 'list'>
[-0.5555555820465088, -0.5555555820465088, -0.5555555820465088, -0.5061728358268738, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.6049383282661438, -0.5061728358268738, -0.5061728358268738, 0.5665295124053955, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.5665295124053955, -0.44581618905067444, 0.5208048224449158, 0.520804762840271, 0.520804762840271, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, -0.75, -0.75, 0.0, -0.75, 0.0, 0.75, -0.75, 0.75, 0.0, -0.75, 0.0, -0.75, 0.0, 0.75, 0.75, 0.75, 0.75, 0.0, 0.0, 0.75, -0.75, 0.75, 0.0, 0.75, 0.75, -0.75, 0.0, 0.75, 0.0, -0.75, 0.0, -0.75, 0.75, 0.0, -0.75, -0.75]
<class 'list'>
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93]
<class 'list'>
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
<class 'list'>
[15, 2, 16, 9, 16, 4, 17, 9, 17, 3, 18, 9, 18, 1, 15, 9, 17, 4, 19, 10, 19, 8, 20, 10, 20, 7, 21, 10, 21, 3, 17, 10, 20, 8, 22, 11, 22, 6, 23, 11, 23, 5, 24, 11, 24, 7, 20, 11, 23, 6, 25, 12, 25, 2, 15, 12, 15, 1, 26, 12, 26, 5, 23, 12, 21, 7, 24, 13, 24, 5, 26, 13, 26, 1, 18, 13, 18, 3, 21, 13, 19, 4, 16, 14, 16, 2, 25, 14, 25, 6, 22, 14, 22, 8, 19, 14]

@paulmelis
Copy link
Owner Author

One more test: building a regular (non-static) version of Python 3.7.7 and manually building NumPy 1.17.5 with that Python.

melis@juggle 20:55:/tmp$ tar xf ~/dl/Python-3.7.7.tar.xz 
melis@juggle 20:55:/tmp$ cd Python-3.7.7/
melis@juggle 20:56:/tmp/Python-3.7.7$ ./configure --prefix=$HOME/software/python-3.7.7
melis@juggle 20:56:/tmp/Python-3.7.7$ make -j4 install
melis@juggle 20:58:/tmp/Python-3.7.7$ cd ~/c/
melis@juggle 20:58:~/c$ rm -rf numpy-1.17.5
melis@juggle 20:59:~/c$ cd numpy-1.17.5
melis@juggle 20:59:~/c/numpy-1.17.5$ ldd ~/software/python-3.7.7/bin/python3
	linux-vdso.so.1 (0x00007ffdfa139000)
	libcrypt.so.1 => /usr/lib/libcrypt.so.1 (0x00007fbd9f005000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fbd9efe3000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fbd9efdd000)
	libutil.so.1 => /usr/lib/libutil.so.1 (0x00007fbd9efd8000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007fbd9ee93000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007fbd9eccc000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fbd9f3ff00

Errr, why is python not dynamically linked to libpython.so? Well, let's first see if a Python built without any special options shows the issue:

melis@juggle 20:59:~/c/numpy-1.17.5$ ~/software/python-3.7.7/bin/python3.7m setup.py build
...
gcc -pthread -shared build/temp.linux-x86_64-3.7/numpy/random/mtrand.o build/temp.linux-x86_64-3.7/numpy/random/src/legacy/legacy-distributions.o build/temp.linux-x86_64-3.7/numpy/random/src/distributions/logfactorial.o build/temp.linux-x86_64-3.7/numpy/random/src/distributions/distributions.o -Lbuild/temp.linux-x86_64-3.7 -lm -o build/lib.linux-x86_64-3.7/numpy/random/mtrand.cpython-37m-x86_64-linux-gnu.so
melis@juggle 21:05:~/c/numpy-1.17.5$ cd build/lib.linux-x86_64-3.7/
melis@juggle 21:06:~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7$ ~/software/python-3.7.7/bin/python3.7m -m pip install -U julia
Collecting julia
  Using cached https://files.pythonhosted.org/packages/af/d2/15aeddffc2d6799fef41552a9949b72983f59659cf68e94add1c6a3e2631/julia-0.5.4-py2.py3-none-any.whl
Installing collected packages: julia
Successfully installed julia-0.5.4

And the answer is NOPE:

melis@juggle 21:03:~/concepts/blender-julia-test/test$ PYTHONPATH=~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7 ~/software/python-3.7.7/bin/python3.7m subdiv.py 
/home/melis/c/numpy-1.17.5/build/lib.linux-x86_64-3.7/numpy/__init__.py
1.17.5
/home/melis/software/python-3.7.7/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.482ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 22.185ms
<class 'list'>
[-0.5555555820465088, -0.5555555820465088, -0.5555555820465088, -0.5061728358268738, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.6049383282661438, -0.5061728358268738, -0.5061728358268738, 0.5665295124053955, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.5665295124053955, -0.44581618905067444, 0.5208048224449158, 0.520804762840271, 0.520804762840271, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, -0.75, -0.75, 0.0, -0.75, 0.0, 0.75, -0.75, 0.75, 0.0, -0.75, 0.0, -0.75, 0.0, 0.75, 0.75, 0.75, 0.75, 0.0, 0.0, 0.75, -0.75, 0.75, 0.0, 0.75, 0.75, -0.75, 0.0, 0.75, 0.0, -0.75, 0.0, -0.75, 0.75, 0.0, -0.75, -0.75]
<class 'list'>
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93]
<class 'list'>
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
<class 'list'>
[15, 2, 16, 9, 16, 4, 17, 9, 17, 3, 18, 9, 18, 1, 15, 9, 17, 4, 19, 10, 19, 8, 20, 10, 20, 7, 21, 10, 21, 3, 17, 10, 20, 8, 22, 11, 22, 6, 23, 11, 23, 5, 24, 11, 24, 7, 20, 11, 23, 6, 25, 12, 25, 2, 15, 12, 15, 1, 26, 12, 26, 5, 23, 12, 21, 7, 24, 13, 24, 5, 26, 13, 26, 1, 18, 13, 18, 3, 21, 13, 19, 4, 16, 14, 16, 2, 25, 14, 25, 6, 22, 14, 22, 8, 19, 14]

Trying the same with a Python version dynamically linking to libpython.so:

melis@juggle 21:08:~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7$ cd /tmp
melis@juggle 21:08:/tmp$ rm -rf Python-3.7.7/
melis@juggle 21:08:/tmp$ tar xf ~/dl/Python-3.7.7.tar.xz 
melis@juggle 21:09:/tmp$ rm -rf ~/software/python-3.7.7
melis@juggle 21:09:/tmp$ cd Python-3.7.7/
melis@juggle 21:09:/tmp/Python-3.7.7$ ./configure --prefix=~/software/python-3.7.7 --enabled-shared
melis@juggle 21:12:/tmp/Python-3.7.7$ make -j4 install
melis@juggle 21:13:/tmp/Python-3.7.7$ cd
melis@juggle 21:14:~$ cd c/numpy-1.17.5/build/lib.linux-x86_64-3.7/
melis@juggle 21:14:~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7$ 
melis@juggle 21:14:~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7$ ~/software/python-3.7.7/bin/python3.7m
/home/melis/software/python-3.7.7/bin/python3.7m: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
melis@juggle 21:14:~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7$ ldd ~/software/python-3.7.7/bin/python3.7m
	linux-vdso.so.1 (0x00007ffc0e322000)
	libpython3.7m.so.1.0 => not found
	libcrypt.so.1 => /usr/lib/libcrypt.so.1 (0x00007fa933205000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fa9331e3000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fa9331dd000)
	libutil.so.1 => /usr/lib/libutil.so.1 (0x00007fa9331d8000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007fa933093000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007fa932eca000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fa9332c4000)

Aha! So now python3.7m is indeed dynamically linked.

melis@juggle 21:16:~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7$ LD_LIBRARY_PATH=$HOME/software/python-3.7.7/lib/ ~/software/python-3.7.7/bin/python3.7m
Python 3.7.7 (default, Sep  4 2020, 21:12:41) 
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__file__
'/home/melis/c/numpy-1.17.5/build/lib.linux-x86_64-3.7/numpy/__init__.py'
>>> import julia
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'julia'
>>> 
melis@juggle 21:16:~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7$ LD_LIBRARY_PATH=$HOME/software/python-3.7.7/lib/ ~/software/python-3.7.7/bin/python3.7m -m pip install -U julia
Collecting julia
  Using cached https://files.pythonhosted.org/packages/af/d2/15aeddffc2d6799fef41552a9949b72983f59659cf68e94add1c6a3e2631/julia-0.5.4-py2.py3-none-any.whl
Installing collected packages: julia
Successfully installed julia-0.5.4

Fingers crossed... nope, still FAILS:

melis@juggle 21:07:~/concepts/blender-julia-test/test$ PYTHONPATH=~/c/numpy-1.17.5/build/lib.linux-x86_64-3.7 LD_LIBRARY_PATH=$HOME/software/python-3.7.7/lib/ ~/software/python-3.7.7/bin/python3.7m subdiv.py 
/home/melis/c/numpy-1.17.5/build/lib.linux-x86_64-3.7/numpy/__init__.py
1.17.5
/home/melis/software/python-3.7.7/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.510ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 22.120ms
<class 'list'>
[-0.5555555820465088, -0.5555555820465088, -0.5555555820465088, -0.5061728358268738, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.6049383282661438, -0.5061728358268738, -0.5061728358268738, 0.5665295124053955, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.5665295124053955, -0.44581618905067444, 0.5208048224449158, 0.520804762840271, 0.520804762840271, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, -0.75, -0.75, 0.0, -0.75, 0.0, 0.75, -0.75, 0.75, 0.0, -0.75, 0.0, -0.75, 0.0, 0.75, 0.75, 0.75, 0.75, 0.0, 0.0, 0.75, -0.75, 0.75, 0.0, 0.75, 0.75, -0.75, 0.0, 0.75, 0.0, -0.75, 0.0, -0.75, 0.75, 0.0, -0.75, -0.75]
<class 'list'>
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93]
<class 'list'>
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
<class 'list'>
[15, 2, 16, 9, 16, 4, 17, 9, 17, 3, 18, 9, 18, 1, 15, 9, 17, 4, 19, 10, 19, 8, 20, 10, 20, 7, 21, 10, 21, 3, 17, 10, 20, 8, 22, 11, 22, 6, 23, 11, 23, 5, 24, 11, 24, 7, 20, 11, 23, 6, 25, 12, 25, 2, 15, 12, 15, 1, 26, 12, 26, 5, 23, 12, 21, 7, 24, 13, 24, 5, 26, 13, 26, 1, 18, 13, 18, 3, 21, 13, 19, 4, 16, 14, 16, 2, 25, 14, 25, 6, 22, 14, 22, 8, 19, 14]

@paulmelis
Copy link
Owner Author

So apparently all manually built NumPy 1.17.5 variants fail. Checking by using the pip version:

melis@juggle 21:17:~/concepts/blender-julia-test/test$ LD_LIBRARY_PATH=$HOME/software/python-3.7.7/lib/ ~/software/python-3.7.7/bin/python3.7m 
Python 3.7.7 (default, Sep  4 2020, 21:12:41) 
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
>>> 
melis@juggle 21:21:~/concepts/blender-julia-test/test$ LD_LIBRARY_PATH=$HOME/software/python-3.7.7/lib/ ~/software/python-3.7.7/bin/python3.7m -m pip install -U numpy==1.17.5
Collecting numpy==1.17.5
  Using cached https://files.pythonhosted.org/packages/b1/51/20098150b6108061cb7542af3de7bfcfe0182bca21613697153e49dc4adc/numpy-1.17.5-cp37-cp37m-manylinux1_x86_64.whl
Installing collected packages: numpy
Successfully installed numpy-1.17.5

Guess what, this combo WORKS:

melis@juggle 21:21:~/concepts/blender-julia-test/test$ LD_LIBRARY_PATH=$HOME/software/python-3.7.7/lib/ ~/software/python-3.7.7/bin/python3.7m subdiv.py 
/home/melis/software/python-3.7.7/lib/python3.7/site-packages/numpy/__init__.py
1.17.5
/home/melis/software/python-3.7.7/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.518ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 21.780ms
<class 'numpy.ndarray'>
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ]
<class 'numpy.ndarray'>
[ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93]
<class 'numpy.ndarray'>
[4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
<class 'numpy.ndarray'>
[15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]

@paulmelis
Copy link
Owner Author

paulmelis commented Sep 4, 2020

I guess the summary (from what I can deduce so far) is that numpy always fails to return numpy arrays from Julia with a manually built NumPy 1.17.5. With the prebuilt pip version it always succeeds.

@paulmelis
Copy link
Owner Author

As a sanity check here's with my Arch Linux built packages (that do not come from pip), which WORKS:

melis@juggle 21:27:~/concepts/blender-julia-test/test$ python subdiv.py 
/usr/lib/python3.8/site-packages/numpy/__init__.py
1.19.1
/home/melis/.local/lib/python3.8/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.541ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 21.727ms
<class 'numpy.ndarray'>
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ]
<class 'numpy.ndarray'>
[ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93]
<class 'numpy.ndarray'>
[4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
<class 'numpy.ndarray'>
[15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]

@paulmelis
Copy link
Owner Author

So what about a manually built NumPy 1.19.1?

melis@juggle 21:29:/tmp$ wget https://github.com/numpy/numpy/archive/v1.19.1.tar.gz -O numpy-1.19.1.tar.gz
melis@juggle 21:30:/tmp$ tar xf numpy-1.19.1.tar.gz 
melis@juggle 21:30:/tmp$ cd numpy-1.19.1
melis@juggle 21:30:/tmp/numpy-1.19.1$ python setup.py build

Oh boy, seems we're on to something as this FAILS:

melis@juggle 21:33:~/concepts/blender-julia-test/test$ PYTHONPATH=/tmp/numpy-1.19.1/build/lib.linux-x86_64-3.8 python subdiv.py 
/tmp/numpy-1.19.1/build/lib.linux-x86_64-3.8/numpy/__init__.py
1.19.1
/home/melis/.local/lib/python3.8/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.510ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 22.648ms
<class 'list'>
[-0.5555555820465088, -0.5555555820465088, -0.5555555820465088, -0.5061728358268738, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.6049383282661438, -0.5061728358268738, -0.5061728358268738, 0.5665295124053955, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.5665295124053955, -0.44581618905067444, 0.5208048224449158, 0.520804762840271, 0.520804762840271, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, -0.75, -0.75, 0.0, -0.75, 0.0, 0.75, -0.75, 0.75, 0.0, -0.75, 0.0, -0.75, 0.0, 0.75, 0.75, 0.75, 0.75, 0.0, 0.0, 0.75, -0.75, 0.75, 0.0, 0.75, 0.75, -0.75, 0.0, 0.75, 0.0, -0.75, 0.0, -0.75, 0.75, 0.0, -0.75, -0.75]
<class 'list'>
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93]
<class 'list'>
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
<class 'list'>
[15, 2, 16, 9, 16, 4, 17, 9, 17, 3, 18, 9, 18, 1, 15, 9, 17, 4, 19, 10, 19, 8, 20, 10, 20, 7, 21, 10, 21, 3, 17, 10, 20, 8, 22, 11, 22, 6, 23, 11, 23, 5, 24, 11, 24, 7, 20, 11, 23, 6, 25, 12, 25, 2, 15, 12, 15, 1, 26, 12, 26, 5, 23, 12, 21, 7, 24, 13, 24, 5, 26, 13, 26, 1, 18, 13, 18, 3, 21, 13, 19, 4, 16, 14, 16, 2, 25, 14, 25, 6, 22, 14, 22, 8, 19, 14]

So it's not a NumPy version-specific thing after all...

@paulmelis
Copy link
Owner Author

Reduced the test case (should have done that much sooner 😄):

melis@juggle 21:42:~/concepts/blender-julia-test/test$ cat return_array.jl 
function fn()
    return Array{Float32}([1,2,3,4,5])
end
melis@juggle 21:42:~/concepts/blender-julia-test/test$ cat t_return_array.py 
import numpy
print(numpy.__file__)
print(numpy.__version__)

import julia
print(julia.__file__)
print(julia.__version__)
from julia.api import Julia

print('Initializing Julia (this might take a moment the first time)...')
jl = Julia(compiled_modules=False)
print('Done!')

# Needs to come after the creation of the Julia instance above
from julia import Main

jl.eval('include("return_array.jl")')

res = Main.fn()

print(type(res))
print(res)

print('item 0 =', type(res[0]))

@paulmelis
Copy link
Owner Author

paulmelis commented Sep 4, 2020

Now Julia does not allow line tracing, but Python does. So perhaps we can figure out the differences that way.

melis@juggle 22:03:~/concepts/blender-julia-test/test$ python -m trace -t t_return_array.py > correct.txt
melis@juggle 22:03:~/concepts/blender-julia-test/test$ PYTHONPATH=/tmp/numpy-1.19.1/build/lib.linux-x86_64-3.8 python -m trace -t t_return_array.py > wrong.txt
<several minutes of diff and meld>
melis@juggle 22:04:~/concepts/blender-julia-test/test$ ls -l correct.txt wrong.txt 
-rw-r--r-- 1 melis users 15293094 Sep  4 22:03 correct.txt
-rw-r--r-- 1 melis users 14655910 Sep  4 22:04 wrong.txt
melis@juggle 22:04:~/concepts/blender-julia-test/test$ grep julia correct.txt > c2.txt 
melis@juggle 22:04:~/concepts/blender-julia-test/test$ grep julia wrong.txt > w2.txt 
melis@juggle 22:04:~/concepts/blender-julia-test/test$ diff -ur c2.txt w2.txt 
melis@juggle 22:04:~/concepts/blender-julia-test/test$ 

Strangely, there's no great differences, except for the code printing the value (which is of a different type of course). So that suggests that the differences are in the non-Python parts, i.e. code in a shared lib being used.

Conversion from a Julia Array to Python is handled in PyCall's numpy.jl for Numpy arrays, specifically this piece:

function PyObject(a::StridedArray{T}) where T<:PYARR_TYPES
    try
        return NpyArray(a, false)
    catch
        return array2py(a) # fallback to non-NumPy version
    end
end

Function array2py is in conversions.jl and is responsible for generating the Python list for an Array it seems:

# recursive conversion of A to a list of list of lists... starting
# with dimension dim and Cartesian index i in A.
function array2py(A::AbstractArray{<:Any, N}, dim::Integer, i::CartesianIndex{N}) where {N}
    if dim > N # base case
        return PyObject(A[i])
    else # recursively store multidimensional array as list of lists
        ilast = CartesianIndex(ntuple(j -> j == dim ? lastindex(A, dim) : i[j], Val{N}()))
        o = PyObject(@pycheckn ccall((@pysym :PyList_New), PyPtr, (Int,), size(A, dim)))
        for icur in cirange(i,ilast)
            oi = array2py(A, dim+1, icur)
            @pycheckz ccall((@pysym :PyList_SetItem), Cint, (PyPtr,Int,PyPtr),
                             o, icur[dim]-i[dim], oi)
            pyincref(oi) # PyList_SetItem steals the reference
        end
        return o
    end
end

But since the output Array is generated fully on the Julia side and we assume those environments are the same between the cases why would array2py get called in the one case but not the other? By hacking PyCall's numpy.jl file, specifically the PyObject() function above it's definitely the case that the call to NpyArray raises an exception in the failed case. So what goes wrong in this call:

function NpyArray(a::StridedArray{T}, revdims::Bool) where T<:PYARR_TYPES
    @npyinitialize
    size_a = revdims ? reverse(size(a)) : size(a)
    strides_a = revdims ? reverse(strides(a)) : strides(a)
    p = @pycheck ccall(npy_api[:PyArray_New], PyPtr,    
          (PyPtr,Cint,Ptr{Int},Cint, Ptr{Int},Ptr{T}, Cint,Cint,PyPtr),
          npy_api[:PyArray_Type],
          ndims(a), Int[size_a...], npy_type(T),
          Int[strides_a...] * sizeof(eltype(a)), a, sizeof(eltype(a)),
          NPY_ARRAY_ALIGNED | NPY_ARRAY_WRITEABLE,
          C_NULL)
    return PyObject(p, a)
end

Removing the @pycheck macro in the call does nothing, strangely enough. Hmm, adding some more println() managed to narrow it down to the @npyinitialize macro that fails. Looking closer at function npyinitialize(). Exception happens in this piece:

    # Parse __multiarray_api.h to obtain length and meaning of PyArray_API
    try
        hdrfile = open(joinpath(inc, "numpy", "__multiarray_api.h"))
        hdr = read(hdrfile, String)
        close(hdrfile)
    catch e
        error("could not read __multiarray_api.h to parse PyArray_API ", e)
    end

The value of inc is retrieved via numpy.get_include():

    # directory for numpy include files to parse
    inc = pycall(numpy."get_include", AbstractString)

So, apparently PyCall fails to find the header, which raises the exception through error(), but the message is gobbled up somewhere and never shown (grrr), causing the whole of the NumPy initialization to fail, which in turn causes Array's to get converted to lists.

Ouch.

Checking if that file is being read while it really does not exist:

melis@juggle 23:15:~/concepts/blender-julia-test/test$ PYTHONPATH=/tmp/numpy-1.19.1/build/lib.linux-x86_64-3.8 strace -o out -f python t_return_array.py
...
melis@juggle 23:17:~/concepts/blender-julia-test/test$ grep __multiarray_api.h out
107007 openat(AT_FDCWD, "/tmp/numpy-1.19.1/build/lib.linux-x86_64-3.8/numpy/core/include/numpy/__multiarray_api.h", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

Yup, we're getting somewhere.

melis@juggle 23:17:~/concepts/blender-julia-test/test$ PYTHONPATH=/tmp/numpy-1.19.1/build/lib.linux-x86_64-3.8 python
Python 3.8.5 (default, Jul 27 2020, 08:42:51) 
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.get_include()
'/tmp/numpy-1.19.1/build/lib.linux-x86_64-3.8/numpy/core/include'
>>> 
melis@juggle 23:19:~/concepts/blender-julia-test/test$ ls -l /tmp/numpy-1.19.1/build/lib.linux-x86_64-3.8/numpy/core/include
ls: cannot access '/tmp/numpy-1.19.1/build/lib.linux-x86_64-3.8/numpy/core/include': No such file or directory

Right, so we were not actually testing with a fully installed numpy as we're running from the build dir, hence the header is not where it should be. It is generated in the numpy build, just in a different location:

melis@juggle 23:20:/tmp/numpy-1.19.1$ find . -name __multiarray_api.h
./build/src.linux-x86_64-3.8/numpy/core/include/numpy/__multiarray_api.h

The normal location:

melis@juggle 23:21:/tmp/numpy-1.19.1$ pacman -Ql python-numpy | grep __multiarray_api.h
python-numpy /usr/lib/python3.8/site-packages/numpy/core/include/numpy/__multiarray_api.h

Is it in the Blender distribution?

melis@juggle 23:21:~/software$ rm -rf blender-2.90.0-linux64/
melis@juggle 23:21:~/software$ tar xvf ~/Downloads/blender-2.90.0-linux64.tar.xz 
melis@juggle 23:22:~/software$ cd blender-2.90.0-linux64/
melis@juggle 23:22:~/software/blender-2.90.0-linux64$ find . -name __multiarray_api.h
melis@juggle 23:22:~/software/blender-2.90.0-linux64$ 

Nope. And hence:

melis@juggle 23:23:~/software/blender-2.90.0-linux64$ ./blender -b --python-expr 'import numpy; print(numpy.get_include())'
Blender 2.90.0 (hash 0330d1af29c0 built 2020-08-31 11:54:54)
Read prefs: /home/melis/.config/blender/2.90/config/userpref.blend
found bundled python: /home/melis/software/blender-2.90.0-linux64/2.90/python
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/core/include

Blender quit
melis@juggle 23:23:~/software/blender-2.90.0-linux64$ ls -l /home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/core/include
ls: cannot access '/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/core/include': No such file or directory

Okay, so that also explains a lot. Final piece of the puzzle, why does a numpy installed from pip fix the issue?

Answer: it includes the headers...

melis@juggle 23:23:~/software/blender-2.90.0-linux64$ ./2.90/python/bin/python3.7m -m pip install -U numpy
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/50/8f/29d5688614f9bba59931683d5d353d738d4a3007833219ee19c455732753/numpy-1.19.1-cp37-cp37m-manylinux2010_x86_64.whl
Installing collected packages: numpy
Successfully installed numpy-1.19.1
melis@juggle 23:26:~/software/blender-2.90.0-linux64$ ./blender -b --python-expr 'import numpy; print(numpy.get_include())'
Blender 2.90.0 (hash 0330d1af29c0 built 2020-08-31 11:54:54)
Read prefs: /home/melis/.config/blender/2.90/config/userpref.blend
found bundled python: /home/melis/software/blender-2.90.0-linux64/2.90/python
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/core/include

Blender quit
melis@juggle 23:26:~/software/blender-2.90.0-linux64$ ls -l /home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/core/include
total 4
drwxr-xr-x 3 melis users 4096 Sep  4 23:26 numpy
melis@juggle 23:26:~/software/blender-2.90.0-linux64$ ls -l /home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/core/include/numpy/
total 396
-rw-r--r-- 1 melis users   164 Sep  4 23:26 arrayobject.h
-rw-r--r-- 1 melis users  3669 Sep  4 23:26 arrayscalars.h
-rw-r--r-- 1 melis users  1878 Sep  4 23:26 halffloat.h
-rw-r--r-- 1 melis users 61605 Sep  4 23:26 __multiarray_api.h
-rw-r--r-- 1 melis users 55448 Sep  4 23:26 multiarray_api.txt
-rw-r--r-- 1 melis users 10688 Sep  4 23:26 ndarrayobject.h
-rw-r--r-- 1 melis users 64578 Sep  4 23:26 ndarraytypes.h
-rw-r--r-- 1 melis users  1861 Sep  4 23:26 _neighborhood_iterator_imp.h
-rw-r--r-- 1 melis users  6786 Sep  4 23:26 noprefix.h
-rw-r--r-- 1 melis users  4351 Sep  4 23:26 npy_1_7_deprecated_api.h
-rw-r--r-- 1 melis users 14548 Sep  4 23:26 npy_3kcompat.h
-rw-r--r-- 1 melis users 37707 Sep  4 23:26 npy_common.h
-rw-r--r-- 1 melis users  4038 Sep  4 23:26 npy_cpu.h
-rw-r--r-- 1 melis users  2641 Sep  4 23:26 npy_endian.h
-rw-r--r-- 1 melis users  3439 Sep  4 23:26 npy_interrupt.h
-rw-r--r-- 1 melis users 21027 Sep  4 23:26 npy_math.h
-rw-r--r-- 1 melis users   567 Sep  4 23:26 npy_no_deprecated_api.h
-rw-r--r-- 1 melis users   817 Sep  4 23:26 npy_os.h
-rw-r--r-- 1 melis users  1010 Sep  4 23:26 _numpyconfig.h
-rw-r--r-- 1 melis users  1367 Sep  4 23:26 numpyconfig.h
-rw-r--r-- 1 melis users  6306 Sep  4 23:26 old_defines.h
-rw-r--r-- 1 melis users   708 Sep  4 23:26 oldnumeric.h
drwxr-xr-x 2 melis users  4096 Sep  4 23:26 random
-rw-r--r-- 1 melis users 12428 Sep  4 23:26 __ufunc_api.h
-rw-r--r-- 1 melis users  7064 Sep  4 23:26 ufunc_api.txt
-rw-r--r-- 1 melis users 12758 Sep  4 23:26 ufuncobject.h
-rw-r--r-- 1 melis users   729 Sep  4 23:26 utils.h

@paulmelis
Copy link
Owner Author

I can find only one reference in the PyCall.jl project page that NumPy headers are required. Specifically in this issue:

This would eliminate the NumPy dependency (and the ugly parsing of NumPy header files).

@paulmelis
Copy link
Owner Author

paulmelis commented Sep 4, 2020

Reported to PyCall.jl at JuliaPy/PyCall.jl#814

@Sov-trotter
Copy link

[Sorry I didn't create a new issue]
Came here via twitter. As a former blender enthusiast(pre 2.80 era) and present julia user, this all looks really cool!!
I am yet to understand the PyCall stuff. But out of curiosity, is there a bigger plan/vision in this side? Like offloading all python related computations to julia etc?

@paulmelis
Copy link
Owner Author

I am yet to understand the PyCall stuff. But out of curiosity, is there a bigger plan/vision in this side? Like offloading all python related computations to julia etc?

Nope, this is just a small test by me to see if any combination of Julia and Blender is feasible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants