Running this:
import torchvision
import tensorflow
Produces the error:
SystemError: google/protobuf/pyext/descriptor.cc:354: bad argument to internal function
However, swapping the order of the imports does not cause the error:
import tensorflow
import torchvision
Why is this happening?
Version info:
tensorflow-gpu=1.15.0
torchvision==0.5.0
Try reinstalling torchvision
.
I have opened a ticket on tensorflow
. My guess is that the order in which you install torchvision
matters:
The fix is either to reinstall
torchvision
or to always importtensorflow
first, as shown above. The issue is difficult to reproduce since fresh install fixes things. Perhaps it is related to the order in which packages are installed -- perhapstorchvision
is somehow targeting oldertensorflow
-related libraries... and updating it again fixes this.
This fix:
import tensorflow # BEFORE all other imports
import torchvision
It works for me.
Source: https://github.com/tensorflow/tensorflow/issues/48797
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.