blenderpy icon indicating copy to clipboard operation
blenderpy copied to clipboard

import bpy error: Library not loaded image not found

Open ConstantinosM opened this issue 4 years ago • 25 comments

I have installed successfully blenderpy via wheel on MAC 10.12.6 in a virtual environment with python 3.7.4:

$ pip3 install bpy-2.82-cp37-cp37m-macosx_10_11_x86_64.whl && bpy_post_install
Processing ./bpy-2.82-cp37-cp37m-macosx_10_11_x86_64.whl
Installing collected packages: bpy
Successfully installed bpy-2.82
WARNING: You are using pip version 19.3.1; however, version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Found Blender scripts directory at /Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/bin/2.82
Moving /Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/bin/2.82 to /Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/Resources
Configuration complete, enjoy using Blender as a Python module!

Describe the bug I import bpy and I get the following error:

  File "/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-9-3b0a44bbcc0a>", line 1, in <module>
    import bpy
  File "/Applications/PyCharm 2.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 19, in do_import
    module = self._system_import(name, *args, **kwargs)
ImportError: dlopen(/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so, 2): Library not loaded: /Library/Frameworks/Python.framework/Versions/3.7/Python
  Referenced from: /Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so
  Reason: image not found

In the virtual environment's folder, in python lib/sitepackages I have blenderpy and bpy-2.82.dist.info folders. In the lib/Resources I have the foldrer 2.82. Even my IDE (PyCharm) has a warning: no module named bpy. With a pip list I can see that bpy is installed. Any help would be great!

ConstantinosM avatar Jul 31 '20 04:07 ConstantinosM

Could you look at the below and see if it matches the description of your issue?

https://stackoverflow.com/questions/55898903/library-not-loaded-error-after-upgrade-python-with-homebrew

It seems as though the Python library itself is having trouble being found.

On Fri, Jul 31, 2020, 12:04 AM Constantinos [email protected] wrote:

I have installed successfully blenderpy via wheel on MAC 10.12.6 in a virtual environment with python 3.7.4:

$ pip3 install bpy-2.82-cp37-cp37m-macosx_10_11_x86_64.whl && bpy_post_install Processing ./bpy-2.82-cp37-cp37m-macosx_10_11_x86_64.whl Installing collected packages: bpy Successfully installed bpy-2.82 WARNING: You are using pip version 19.3.1; however, version 20.1.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. Found Blender scripts directory at /Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/bin/2.82 Moving /Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/bin/2.82 to /Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/Resources Configuration complete, enjoy using Blender as a Python module!

Describe the bug I import bpy and I get the following error:

File "/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in import bpy File "/Applications/PyCharm 2.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 19, in do_import module = self._system_import(name, *args, **kwargs) ImportError: dlopen(/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so, 2): Library not loaded: /Library/Frameworks/Python.framework/Versions/3.7/Python Referenced from: /Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so Reason: image not found

In the virtual environment's folder, in python lib/sitepackages I have blenderpy and bpy-2.82.dist.info folders. In the lib/Resources I have the foldrer 2.82. Even my IDE (PyCharm) has a warning: no module named bpy. With a pip list I can see that bpy is installed. Any help would be great!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/TylerGubala/blenderpy/issues/43, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLEYR35ANPV2JK224EVQE3R6I7GLANCNFSM4PPKSZ2Q .

TylerGubala avatar Jul 31 '20 12:07 TylerGubala

Thanks a lot for the prompt response! I tried to test as much as I can the Python library of that virtualenv and it is working fine. For example I could install another module via pip. I can run python commands from command line or Pycharm, ipython, import modules etc. No issue at all. The other thing that I noticed is that my virtualenv points here:

.Python@ -> /usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/Python

Also I get:

$ ls -l /usr/local/Cellar/python
total 0
drwxr-xr-x    3 constantinos  staff   102 Oct 18  2019 ./
drwxrwxr-x  118 constantinos  admin  4012 Nov  8  2019 ../
drwxr-xr-x   13 constantinos  staff   442 Oct 18  2019 3.7.4_1/

which is the correct version used by my virtualenv. I am not sure why it searches for /Library/Frameworks/Python.framework/Versions/3.7/Python. The folder /Library/Frameworks doesn't exist in the system.

ConstantinosM avatar Jul 31 '20 15:07 ConstantinosM

Probably it is searching for the library frameworks version of Python because that's where I had my Python installed at build time. I have to wonder if that gets embedded in the Blender bpy.so file.

I wonder if installing from a Python download via Python.org would alleviate it. I did not install Python via Brew, but it looks like you may have? I just downloaded and installed from Python.org.

On Fri, Jul 31, 2020, 11:35 AM Constantinos [email protected] wrote:

Thanks a lot for the prompt response! I tried to test as much as I can the Python library of that virtualenv and it is working fine. For example I could install another module via pip. I can run python commands from command line or Pycharm, ipython, import modules etc. No issue at all. The other thing that I noticed is that my virtualenv points here:

.Python@ -> /usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/Python

Also I get:

$ ls -l /usr/local/Cellar/python total 0 drwxr-xr-x 3 constantinos staff 102 Oct 18 2019 ./ drwxrwxr-x 118 constantinos admin 4012 Nov 8 2019 ../ drwxr-xr-x 13 constantinos staff 442 Oct 18 2019 3.7.4_1/

which is the correct version used by my virtualenv. I am not sure why it searches for /Library/Frameworks/Python.framework/Versions/3.7/Python. The folder /Library/Frameworks doesn't exist in the system.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/TylerGubala/blenderpy/issues/43#issuecomment-667184869, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLEYR5DBXOZCX7TLVNIGHTR6LQEDANCNFSM4PPKSZ2Q .

TylerGubala avatar Jul 31 '20 16:07 TylerGubala

Interesting. Yes, indeed. So as it is I doubt there is an easy fix for that. Even if I create a new virtualenv I will need to have a python installation on my system from python.org in order for the virualenv to create the environment with that specific python.

ConstantinosM avatar Jul 31 '20 16:07 ConstantinosM

Maybe I am wrong. I will check on the blender dev talk this weekend when I am off work and post a link unless you want to do that yourself.

On Fri, Jul 31, 2020, 12:59 PM Constantinos [email protected] wrote:

Interesting. Yes, indeed. So as it is I doubt there is an easy fix for that. Even if I create a new virtualenv I will need to have a python installation on my system from python.org in order for the virualenv to create the environment with that specific python.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/TylerGubala/blenderpy/issues/43#issuecomment-667228835, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLEYR7S7OMSTF2FUHL5Y2LR6LZ5VANCNFSM4PPKSZ2Q .

TylerGubala avatar Jul 31 '20 17:07 TylerGubala

I can help if I can but I am not sure what to do...?

ConstantinosM avatar Jul 31 '20 17:07 ConstantinosM

Ah don't worry about it. I'll look into it over the weekend and try to recreate your setup and see if I can reproduce the error.

On Fri, Jul 31, 2020, 1:05 PM Constantinos [email protected] wrote:

I can help if I can but I am not sure what to do...?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/TylerGubala/blenderpy/issues/43#issuecomment-667231842, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLEYR6BMZ44CWGLGKCN3WTR6L2UFANCNFSM4PPKSZ2Q .

TylerGubala avatar Jul 31 '20 17:07 TylerGubala

So I looked at this but I don't get as verbose of an error as you are getting.

Click to expand log
tylergubala@Tylers-Mac-mini Python % brew install [email protected]
tylergubala@Tylers-Mac-mini Python % mkdir blenderpy_test
tylergubala@Tylers-Mac-mini Python % cd blenderpy_test
tylergubala@Tylers-Mac-mini blenderpy_test % /usr/local/opt/[email protected]/bin/python3 -m pip install -U pip
Collecting pip
  Using cached pip-20.2-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.0.2
    Uninstalling pip-20.0.2:
      Successfully uninstalled pip-20.0.2
Successfully installed pip-20.2
tylergubala@Tylers-Mac-mini blenderpy_test % /usr/local/opt/[email protected]/bin/python3 -m venv venv
tylergubala@Tylers-Mac-mini blenderpy_test % source venv/bin/activate
(venv) tylergubala@Tylers-Mac-mini blenderpy_test % python3
Python 3.7.8 (default, Jul  8 2020, 14:18:28)
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'/Users/tylergubala/Code/Python/blenderpy_test/venv/bin/python3'
>>> quit()
(venv) tylergubala@Tylers-Mac-mini blenderpy_test % python3 -m pip install bpy
Processing /Users/tylergubala/Library/Caches/pip/wheels/76/82/dd/d2d0bd21d5c8628954fb0e71d1b2932c5ddefba434ad091cf2/bpy-2.82.1-cp37-cp37m-macosx_10_11_x86_64.whl
Installing collected packages: bpy
Successfully installed bpy-2.82.1
WARNING: You are using pip version 20.1.1; however, version 20.2 is available.
You should consider upgrading via the '/Users/tylergubala/Code/Python/blenderpy_test/venv/bin/python3 -m pip install --upgrade pip' command.
(venv) tylergubala@Tylers-Mac-mini blenderpy_test % which bpy_post_install
/Users/tylergubala/Code/Python/blenderpy_test/venv/bin/bpy_post_install
(venv) tylergubala@Tylers-Mac-mini blenderpy_test % bpy_post_install
Found Blender scripts directory at /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/Resources/2.82
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/Resources/2.82 already direct child of /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/Resources
Configuration complete, enjoy using Blender as a Python module!
(venv) tylergubala@Tylers-Mac-mini blenderpy_test % python3
Python 3.7.8 (default, Jul  8 2020, 14:18:28)
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bpy
zsh: segmentation fault  python3

Do you get the output straight out of python or are you running through a debugger?

What is your exact setup anyways? Do you have a script I could run to get the same environment as you?

Any help would be appreciated. Thanks in advance!

TylerGubala avatar Aug 04 '20 01:08 TylerGubala

Thanks so much for coming back to me! Yes I can provide all the information you need just let me know. I did not install via python3 -m pip install bpy. That type of installation wasn't working on my Mac. I searched a bit in the issues section of your github repo and it seems that you suggest to install via the whl on Mac, if I am not mistaken. So I downloaded the mac ones and I install the bpy module with the command you have (along with the post installation command)

I run to the same error even if I run it with python in my terminal:

(venv37tf1)
constantinos@psycomps-MBP-2 : ~/Documents/Projects/virtualenvs/venv37tf1
$ python3
Python 3.7.4 (default, Oct 18 2019, 01:18:04)
[Clang 9.0.0 (clang-900.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so, 2): Library not loaded: /Library/Frameworks/Python.framework/Versions/3.7/Python
  Referenced from: /Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so
  Reason: image not found
>>>

I am so sorry I do not have a script that installs all the packages I have installed in my env. It's a virtualenv environmet and I can provide you if you want with my pip3 list or any information you would like to know.

I continue the "investigation": I uninstalled bpy and tried to install it with the commands you are using (pip without using whl). I get the future_strings error.

Let me know what other information you would need. Thanks again!

ConstantinosM avatar Aug 05 '20 01:08 ConstantinosM

Sorry, I think I need to know a little bit more about your Python environment.

  • Did you install CPython via brew? I am assuming yes since it's in the Cellar folder but I guess I'm looking for confirmation.
  • You look like you are in a virtual environment. Is this via python3 -m venv, virtualenv, or some other virtual environment mechanism?
  • Why was the python3 -m pip install bpy not working? Did you get some kind of error? Could you post the error you got?

Thanks in advance for any information that you can provide.

In the meantime I can confirm that installing on a CPython version that was downloaded from Python.org is working fine for me. Is there some reason you can't install via Python.org? I'm just trying to get a better understanding of that is all.

Thanks.

TylerGubala avatar Aug 06 '20 21:08 TylerGubala

Thank you Tyler. I will try to provide as much information as I remember.

  • My python was updated by itself when i was installing another brew package. If I remember correctly my whole python was updated via brew. And yes my initial python installation was installed via brew. I do not remember specifically for cpython but i guess was installed along with python (?).

  • Its virtualenv.

  • The error when installing with pip without wheels:

$ pip3 install bpy
Collecting bpy
  Using cached https://files.pythonhosted.org/packages/4b/ed/ba6092b691acc5b157891421d9fde4a9dd5dcc8a8b93a4e8119fec261391/bpy-2.82.1.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5q/0x8b8tqn2gs8nczpjng1f9s40000gp/T/pip-install-q65qajdm/bpy/setup.py'"'"'; __file__='"'"'/private/var/folders/5q/0x8b8tqn2gs8nczpjng1f9s40000gp/T/pip-install-q65qajdm/bpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/5q/0x8b8tqn2gs8nczpjng1f9s40000gp/T/pip-install-q65qajdm/bpy/pip-egg-info
         cwd: /private/var/folders/5q/0x8b8tqn2gs8nczpjng1f9s40000gp/T/pip-install-q65qajdm/bpy/
    Complete output (16 lines):
    Traceback (most recent call last):
      File "/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/tokenize.py", line 397, in find_cookie
        codec = lookup(encoding)
    LookupError: unknown encoding: future_fstrings

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/tokenize.py", line 449, in open
        encoding, lines = detect_encoding(buffer.readline)
      File "/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/tokenize.py", line 436, in detect_encoding
        encoding = find_cookie(second)
      File "/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/tokenize.py", line 405, in find_cookie
        raise SyntaxError(msg)
    SyntaxError: unknown encoding for '/private/var/folders/5q/0x8b8tqn2gs8nczpjng1f9s40000gp/T/pip-install-q65qajdm/bpy/setup.py': future_fstrings
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

What do you exactly mean by 'installing via Python.org'? Create a new virtual environment and install python from python.org there or completely change my system's python? Correct me if I am wrong, but from what I read online, for mac users, it is recommended to install via brew (at least the system's python). So I believe I followed that path few years back when I got my laptop. Also, I do not wish at the moment to mess up with my system's python in any case as it will break all my virtual environments 😅.

Happy to help with any additional information.

ConstantinosM avatar Aug 07 '20 02:08 ConstantinosM

@ConstantinosM My apologies as I have come up almost entirely empty-handed with several hours of work looking into this.

Have you been able to look into this yourself at all? By installing from pip, you will actually need to install future-fstrings first, so I think that error is legitimate.

I'm not sure there is an "easy" solution to this but I will continue looking at it, but I can't make it a priority since I'm not even getting the same errors as you when I attempt to make the same system configuration, and I am not terribly familiar with MacOSX.

Maybe try building from sources...?

TylerGubala avatar Aug 23 '20 23:08 TylerGubala

Tyler thanks so much for the time and hard work putting in this! Please, feel free to not prioritize it. I will do a fresh install with future-fstrings. If i get any good news I will report here so possibly someone that might have the same problem finds a solution. I have a Linux machine as well so possibly I will try installation there as well.

ConstantinosM avatar Sep 10 '20 08:09 ConstantinosM

So I looked at this but I don't get as verbose of an error as you are getting.

Hi, I am also getting this seg fault error after installing Python via python.org on macOS 10.15.7 with python=3.7.1. Is there any update on the issue? Thanks!

brianc5 avatar Oct 17 '20 09:10 brianc5

@brianc5 Did you install Python through brew? If so, you may be able to fix it by doing something as simple as removing the brew Python installation and installing Python3.7.X for MacOS from Python.org. Let me know if you need anything else!

TylerGubala avatar Oct 17 '20 18:10 TylerGubala

@TylerGubala I'm having exactly the same errors reported in this thread. on MacOS 10.15.6.

I tried both python3.7.9 from brew and from Python.org,


pip install <PATH_TO_WHEEL_FILE> && bpy_post_install

Here I downloaded the wheel file you provided at the Release page

If I use python3.7 installed from brew,
I got the error that bpy.cpython-37m-darwin.so cannot be found, even though it's there. same error as @ConstantinosM reported on the top of this thread.

If I use python3.7 from Python.org, via the download link you provided.

I got the segmentation fault 11. same as @brianc5 reported (Click to expand):

bpy-error


pip install bpy

this method hasn't worked for me either. it's extremely slow compared to installing wheels directly from the files your provided.

for both pythons, I'm getting the same error shown below (Click to expand):

pip-install-bpy

Any thoughts or suggestions are highly appreciated. Thanks!

lakex24 avatar Nov 09 '20 20:11 lakex24

@lakex24 I'm moving this to a new issue because I'm not sure what's causing the seg fault even though Blender seemingly works fine anyways.

TylerGubala avatar Nov 11 '20 00:11 TylerGubala

@TylerGubala Thanks for your response. I will try building it from source on Mac when I get a chance. Currently, I can confirm that the wheel file for Linux works for me. ( Ubuntu 16.04, Conda Python 3.7.8 ) Really appreciate your help!

lakex24 avatar Nov 11 '20 03:11 lakex24

@lakex24 My pleasure. If you want to add any details, you can see also https://devtalk.blender.org/t/bpy-obscure-error-during-python-exit-on-macos/16102

Honestly I am not sure about this error, so maybe someone on the Blender Dev talk can answer it for you.

Are you able to view the render output, though? Does it create an output for you? In my simple test, it appears to create an output.

Here's an example script I ran:
import bpy
import bmesh
import mathutils

mesh = bpy.data.meshes.new('cube')
ob = bpy.data.objects.new('cube', mesh)

bpy.context.collection.objects.link(ob)

bm = bmesh.new()
bmesh.ops.create_cube(bm, size=1.0)
bm.to_mesh(mesh)
bm.free()

light_data = bpy.data.lights.new('light', type='POINT')
light = bpy.data.objects.new('light', light_data)
bpy.context.collection.objects.link(light)
light.location = mathutils.Vector((3, -4.2, 5))

cam_data = bpy.data.cameras.new('camera')
cam = bpy.data.objects.new('camera', cam_data)
bpy.context.collection.objects.link(cam)
bpy.context.scene.camera = cam

cam.location = mathutils.Vector((6, -3, 5))
cam.rotation_euler = mathutils.Euler((0.9, 0.0, 1.1))

render_location = r"/Users/tylergubala/Code/Python/blenderpy-test/render.png" #replace this with your output path
print(f"Rendering to {render_location}")
bpy.context.scene.render.image_settings.file_format = 'PNG'
bpy.context.scene.render.filepath = render_location
bpy.context.scene.render.engine = 'CYCLES'
bpy.ops.render.render(write_still=True)
print(f"Completed: Rendering to {render_location}")
Here's the example output:

macosrender

So while the error is definitely annoying, and I would want to get rid of it to make this cleaner, I think that it may just be annoying and something that occurs when Python is being cleaned up, and maybe not something to worry about as much as I first thought.

TylerGubala avatar Nov 11 '20 03:11 TylerGubala

@lakex24 My pleasure. If you want to add any details, you can see also https://devtalk.blender.org/t/bpy-obscure-error-during-python-exit-on-macos/16102

Honestly I am not sure about this error, so maybe someone on the Blender Dev talk can answer it for you.

Are you able to view the render output, though? Does it create an output for you? In my simple test, it appears to create an output.

Here's an example script I ran: Here's the example output: So while the error is definitely annoying, and I would want to get rid of it to make this cleaner, I think that it may just be annoying and something that occurs when Python is being cleaned up, and maybe not something to worry about as much as I first thought.

Surprisingly... yes, I can render the example output on Mac! I guess I didn't bother to check the output once I saw the segmentation fault error... Yeah, it's annoying that Python crashes every time you run the script ... But at least I get the result I want on Mac! so, Thanks!!!

lakex24 avatar Nov 11 '20 04:11 lakex24

I'm having the same error. I got a mac 11.1 Big Sur, and I installed python3.7, python3.8, python3.9 via brew, and of course, there's a python2 inside mac by default. Then, when creating a python virtual environment, I used python3.7 as the interpreter.

virtualenv -p /usr/local/opt/[email protected]/bin/python3.7 blender_dev

After installation and under the virtual environment, I installed future-fstings as well as bpy.

pip3 install future-fstings
pip3 install bpy && bpy_post_install

the installation was successful. But when import bpy in python, it failed with an error

ImportError: dlopen(/Users/me/Envs/blender_dev/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so, 2): Library not loaded: /Library/Frameworks/Python.framework/Versions/3.7/Python
  Referenced from: /Users/me/Envs/blender_dev/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so
  Reason: image not found

I looked at my '/Library/Frameworks/' and there's no Python folder under it. After reading all the posts above, I guess this error might be something with python brew installation? should I just try to build python from source?

pessimo avatar Mar 25 '21 02:03 pessimo

Brew is simply not supported at this time. Please install Python 3.7 from python.org.

On Wed, Mar 24, 2021, 10:14 PM pessimo @.***> wrote:

I'm having the same error. I got a mac 11.1 Big Sur, and I installed python3.7, python3.8, python3.9 via brew, and of course, there's a python2 inside mac by default. Then, when creating a python virtual environment, I used python3.7 as the interpreter.

virtualenv -p @.***/bin/python3.7 blender_dev

After installation and under the virtual environment, I installed future-fstings as well as bpy.

pip3 install future-fstings pip3 install bpy && bpy_post_install

the installation was successful. But when import bpy in python, it failed with an error

ImportError: dlopen(/Users/me/Envs/blender_dev/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so, 2): Library not loaded: /Library/Frameworks/Python.framework/Versions/3.7/Python Referenced from: /Users/me/Envs/blender_dev/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so Reason: image not found

I looked at my '/Library/Frameworks/' and there's no Python folder under it. After reading all the posts above, I guess this error might be something with python brew installation? should I just try to build python from source?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TylerGubala/blenderpy/issues/43#issuecomment-806309308, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLEYRZIXL7CDQ25Q7QPOCDTFKL7LANCNFSM4PPKSZ2Q .

TylerGubala avatar Mar 25 '21 14:03 TylerGubala

我已经在使用Python 3.7.4的虚拟环境中blenderpy通过wheelMAC 10.12.6成功安装了:

$ pip3安装bpy-2.82-cp37-cp37m-macosx_10_11_x86_64.whl && bpy_post_install
正在处理./bpy-2.82-cp37-cp37m-macosx_10_11_x86_64.whl
安装收集的软件包:bpy
成功安装了bpy-2.82
警告:您正在使用pip版本19.3.1 ;但是,版本20.1.1可用。
您应该考虑通过“ pip install --upgrade pip ”命令进行升级。
在/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/bin/2.82中找到Blender脚本目录
将/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/bin/2.82移至/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/Resources
配置完成,喜欢将Blender用作Python模块!

描述import bpy和我遇到以下错误的错误:

  File "/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-9-3b0a44bbcc0a>", line 1, in <module>
    import bpy
  File "/Applications/PyCharm 2.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 19, in do_import
    module = self._system_import(name, *args, **kwargs)
ImportError: dlopen(/Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so, 2): Library not loaded: /Library/Frameworks/Python.framework/Versions/3.7/Python
  Referenced from: /Users/constantinos/Documents/Projects/virtualenvs/venv37tf1/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so
  Reason: image not found

在虚拟环境的文件夹中,在python lib / sitepackages中,我有blenderpy和bpy-2.82.dist.info文件夹。在lib / Resources中,我具有文件夹2.82。甚至我的IDE(PyCharm)也警告:没有名为bpy的模块。用一个pip list我可以看到bpy已经安装了。任何帮助将是巨大的!

hi have you solved this problem?i have the same,and i don't konw how to solve it, thanks for your reply!

liuhaorandezhanghao avatar Apr 27 '21 06:04 liuhaorandezhanghao

I have the same problem.Anyone could help me??thanks import bpy Traceback (most recent call last): File "", line 1, in ImportError: dlopen(/Users/guozhihao/opt/anaconda3/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so, 2): Library not loaded: /Library/Frameworks/Python.framework/Versions/3.7/Python Referenced from: /Users/guozhihao/opt/anaconda3/lib/python3.7/site-packages/bpy.cpython-37m-darwin.so Reason: image not found

liuhaorandezhanghao avatar Apr 27 '21 06:04 liuhaorandezhanghao

When the error “Reason: image not found” occur,I install python 3.7.2 from python.org。it solve! But another error occurred when i use "import bpy".

[1]    95801 segmentation fault  

Platform: Mac OS 11.5 Python: python 3.7.2

Tasfa avatar Mar 24 '22 14:03 Tasfa