Problem Description
I'm following the caffe to onnx tutorial at https://github.com/onnx/onnx-docker/blob/master/onnx-ecosystem/converter_scripts/caffe_coreml_onnx.ipynb and I encounter this error: ImportError: cannot import name 'libcaffeconverter' from 'coremltools'
On further investigation, I realized that there is no libcaffeconverter in the coremltools directory.
System information
OS Platform and Distribution: Windows 10 x64 ONNX version: 1.7.0 Python version: 3.7.7 Protobuf version: 3.13.0 Visual Studio version (if applicable): 2017 version 15.9.28307.1234
Reproduction instructions
Create a NEW environment and run "pip install coremltools==4.0b3"
Run the code at https://github.com/onnx/onnx-docker/blob/master/onnx-ecosystem/converter_scripts/caffe_coreml_onnx.ipynb
OR
Run:
import coremltools coremltools.converters.caffe.convert(None)
Expected behavior
I expected the code to create and save a an onnx file based on the caffe file specified in the code
TL;DR: switch to python 3.6
like the OP the problem was with import coremltools coremltools.converters.caffe.convert(None)
, producing `ImportError: cannot import name 'libcaffeconverter'
This can be avoided by using a virtual environment with python 3.6
Workaround:
Create a python 3.6 environment with your package manager of choice in the terminal:
conda create -n <your env name here> python=3.6 anaconda
OR
virtualenv --python=/usr/bin/python3.6
activate the virtual environment
conda activate <your env name here>
(or pip equivalent)
navigate to your project directory and run your file
python <your script here>.py
now it should work as planned