I have a class named neuron
in Cython syntax which works perfectly fine with Jupyter inline using magic (%%cython)
:
cdef class neuron: pass
and I am trying to cythonize this so that I can import it on a cluster and run larger scale experiments using Jupyter on a conda environment. My setup.py
file looks like this:
from setuptools import setup, Extension
from Cython.Build import cythonize
extensions = [
Extension("Neuronal_Cascades_cython_Base1", ["Neuronal_Cascades_cython_Base1.pyx"]),
]
setup(
name="Neuronal_Cascades_cython_Base",
ext_modules=cythonize(extensions),
)
Cythonize works fine and .so
and .c
files created fine without any errors. But when I'm importing these two modules in Jupyter notebook, I get the import error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-639e2d302e82> in <module>
1 import matplotlib.pyplot as plt
2 import numpy as np
----> 3 from Neuronal_Cascades_cython_Base1 import neuron
4 import os
5 import pickle
ImportError: cannot import name 'neuron' from 'Neuronal_Cascades_cython_Base1' (/Users/bengieru/Neuronal_Cascades/Cython/Neuronal_Cascades_cython_Base1.cpython-37m-darwin.so)
Can anyone tell what I am doing wrong? I feel like it may be related with the setup.py
importing dependencies but I'm not sure how to fix it.