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
Unable to load CoreML.framework. Cannot make predictions. #372
Comments
@pokidyshev - What version of Python are you using? Also are you using the |
@TobyRoseman |
I'm seeing a similar issue. I'm on macOS 10.14.6. I downloaded the MNIST classifier from the Core ML Model page. The following code works fine with coremltools version 2.1.0, for all version of Python support by 2.1.0 (i.e. 2.7, 3.5, 3.6): import coremltools
from PIL import Image
import numpy as np
data = np.empty((28,28), dtype=np.uint8)
input_image = Image.fromarray(data)
model = coremltools.models.MLModel('./Downloads/MNISTClassifier.mlmodel')
print(model.predict({'image': input_image})) Using the same code with coremltools version 3.0b1, it only works for Python 2.7. For Python 3.6, I get the following error when I try to load the model:
For Python 3.5 and 3.7 I get the following error when I try to call predict on the model:
If I modify the install code to remove this line from a try/except block, I get the following error:
|
On my setup it also happens on |
Also getting the Getting further using Python 2.7, although hitting a different error (maybe my fault): EDIT: |
Are you hitting the same issue with coremltools3.0b2? |
@Necross - this is still broken with the 3.0b2 wheel. The code I shared previously in this issues fails if you're using Anaconda Python. It does however work if you are using Python downloaded from python.org. |
Problem is missing libcoremlpython.so from
In my case PYTHON SITE PACKAGE PATH = /Users/bhushansonawane/miniconda3/envs/py36/lib/python3.6/site-packages/coremltools-3.0b2-py3.6.egg/coremltools Following worked for me-
build from source as follow
python setup.py install copies coremltools directly to the package directory and hence misses libcoremlpython library
which I am not sure of why yet I have tested this on python3.5, python3.6 works fine for me. @TobyRoseman could you please give it a try? |
@bhushan23 - that works for me too. Thank you so much for your help! I was trying something very similar but was missing the |
This has been fixed in the most recent release. Please install the fourth beta ( |
I have
|
@motasay - I just tried with Python 3.6 and Looks like we've had a regression. This issue is fixed in |
python 3.7.4 with coremltools 3.0b5 has the same issue :
python 3.7.4 with coremltools 3.0b3 works properly though. |
@josephsieh which operating system are you using? |
@Necross macOS Mojave 10.14.6 |
macOS 10.15 (19A558d), python3.7 , coremltools 3.0b5 |
@zhao15 3.0b6 wheels have been released as well, which should fix the issue. Can you try that as well? |
Now it's working again. Tested on python 2.7.16 and python 3.7.4 |
Can you verify with |
Thanks for verifying! |
I'm getting the same issue. Running 10.14.6, tried both python 3.6 and 3.7. Also tried coremltools 3.0, 3.1 and 3.2 and building from source as per bhushan23's instructions. Any ideas? |
You should try manually copy builded library 'libcoremlpython.so' to 'site-packages/..../coremltools' folder. I builded Coremltools from source as mentioned bhushan23 in folder: "/Users/admin/temp/coremltools/" and then copy library. |
I'm having the same issue, with coremltools==4.0b2 (also tried down to 3.3). the library file seems to be in the right place. /lib/python3.7/site-packages/coremltools/libcoremlpython.so with python=3.7.7 torchvision=0.6.1 and torch=1.5.1 I'm getting this error message: CoreML export failure: Unable to load CoreML.framework. Cannot make predictions. mac os version: 10.13.6 I can't even get it to work on the example from the coremltools documentation:
|
It still reproduces with 4.0b3 |
@Vozf @wmpauli could you please try installing coremltools from following wheels?(https://github.com/apple/coremltools/releases/tag/4.0b3) in following order?
|
Recreated the whole env and this error is gone for me. Although previous env was with python3.8, so this may have been an issue |
@bhushan23 , I was also able by downgrading the python version. I don't have my mac with me right now, but i think both 3.6 and 3.7 worked. |
Yes, this is broken again, at least in Python 3.8. It was working properly in |
It seems I spoke too soon when I said that it was working properly in
|
I have not checked all of the wheels for |
Receive this error with coremltools 4.0b3. and Python 3.8 in MacOS. Downgrading to a Python 3.7 environment solved the problem for me. |
I am facing the same issue with coremltools 4.0b3, even with Python 3.7 ... I am having MacOS 10.14.7. |
According to my tests this is now fixed in coremltools 4.0b4. |
This appears to be an issue with latest CoreML Tools with Miniconda / M1 Mac. I am using the following method to install CoreMLtools 4.0 on macOS 11 on an M1 Mac mini: |
I was having the same issue as well, but was able to fix it by compiling and installing coremltools from source (on M1 Macbook Air) |
LMAO: was googling to find a solution to a similar bug and stumbled upon this thread. 2 years passed since I've opened this issue and the bug is still present 😂
|
@pokidyshev - This issue should be fixed now. It looks like you're using Python 3.9. Coremltools doesn't support Python 3.9 yet. I think this is an installation issue. I think you must have installed coremltools using an egg rather than a wheel. Building I suggest just using Python 3.8 for now. |
coremltools5 beta is ok for python3.9+ |
I've got the latest coremltools installed from source.
I can't run
model.predict
because it gives exception:Here is my snippet:
The text was updated successfully, but these errors were encountered: