PYTORCH 1.0 , convert-caffe2-to-onnx: No module onnx

After installing pytorch1.0, I am trying convert a caffe2 model (in particular caffe2/python/models/seq2seq/ into ONNX.

I thought I would use the command line script convert-caffe2-to-onnx.

I get a fail saying "No module named ‘onnx’’ from line 13 of

I did not install ONNX explicitly.

If you need the whole ONNX library, you should install it via:

conda install -c conda-forge onnx
1 Like

Hmm. Am I to understand when I install pytorch1.0 the onnx support is not complete enough to convert a caffe2 model to ONNX?

Also, I asked about this in the ONNX forum. They said this conda-forge version is not being maintained and asked to install from source.
Thanks @ptrblck for the advice.

Hmm. getting unsatisfiable conflict. ONNX requires python2.7 and I have python3.7 in the pytorch1.0 conda environment.

I didn’t know that the conda-forge version is not being maintained, as it’s recommended to install it using this command in the PyTorch ONNX docs.
Could you post the link to the thread in the ONNX forum?

I guess if you build ONNX from source it should also work with Python 3.7.

This is the exchange in the ONNX/optimizer gitter:

@houseroad Should the docs be changed to the pip install command?
It seems the conda-forge onnx version wasn’t updated in 7 months, but is still in the official ONNX install guide.

Let me know, what you think about this and I can fix it quickly.

The pip version seems to have problem too.
Assertion Error: type is ConstantFill

While searching for this type of error, AFAI understand, it is alluded to be fixed in 'facebook archived" version.

Installing from source with the below command worked for me.

python develop

Notice the option develop instead of install

Here is the link where I figured it out.

it worked, thank you ^^