Skip to content Skip to sidebar Skip to footer

Name '_C' Is Not Defined Pytorch+jupyter Notebook

I have some code that uses pytorch, that runs fine from my IDE (pycharm). For research, I tried to run it from a jupyter notebook. The code in the notebook: from algorithms import

Solution 1:

You need Cython for pytorch to work:

pip3 install Cython

See this comment on the issue on github.

My understanding is that there is a library called _C.cpython-37m-x86_64-linux-gnu.so in site-packages/torch which provides the shared object _C and requires Cython. PyCharm provides Cython support whereas the Jupyter environment doesn't.


Solution 2:

Restarting the kernel will solve the problem.


Solution 3:

I was not using a notebook, so maybe this is a different issue, but I recently got the same error after upgrading my system libffi. I was able to fix this by installing libffi7.

I went ahead and made a separate question on the assumption this is a different issue, but figured I'd post here in case.


Post a Comment for "Name '_C' Is Not Defined Pytorch+jupyter Notebook"