'import nengo_dl' in Google Colab throws Error

I am trying to import nengo_dl in Google Colab.

!pip install nengo
!pip install nengo-dl

import nengo_dl

Error:

ModuleNotFoundError Traceback (most recent call last)

in <cell line: 1>() ----> 1 import nengo_dl

ModuleNotFoundError: No module named ‘nengo_dl’

How can I fix this?

Try to install a pip package in the current kernel:

import sys
!{sys.executable} -m pip install nengo
!{sys.executable} -m pip install nengo-dl

import nengo
import nengo_dl

Thank you!

I am sorry, it doesn’t

we should downgrande tensorflo to 2.8.0
!pip install tensorflow==2.8.0 to solve the issue

Whenever you have “module” problems, it’s probably because you need to install a library via “pip install” as I suggested. Try installing the keras module as well. Here is a suggestion of libraries that I generally use in my projects.

import collections
import warnings
import pandas as pd
import numpy as np
from datetime import datetime
import time
import matplotlib.pyplot as plt
import datetime

Install a pip package in the current Jupyter kernel

import sys
!{sys.executable} -m pip install seaborn
!{sys.executable} -m pip install imblear
!{sys.executable} -m pip install tensorflow_addons

import seaborn as sns
import imblearn
import tensorflow_addons as tfa
from imblearn.over_sampling import SMOTE
from imblearn.over_sampling import ADASYN

#--------------------------------------------------------------#
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.metrics import accuracy_score
from sklearn.tree import DecisionTreeClassifier
from sklearn.dummy import DummyClassifier
from sklearn.tree import export_graphviz
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import RandomizedSearchCV
from sklearn.model_selection import cross_validate
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import cross_val_predict
from sklearn.naive_bayes import MultinomialNB
from sklearn.ensemble import AdaBoostClassifier
from sklearn.svm import SVC
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from sklearn.utils.class_weight import compute_class_weight
from sklearn.metrics import f1_score

#--------------------------------------------------------------#
import tensorflow as tf
from tensorflow import keras
from keras.models import Sequential
from keras.layers import Dense
from scikeras.wrappers import KerasClassifier, KerasRegressor
#from tensorflow.keras.models import Sequential
from tensorflow.keras.optimizers import Adam
#from tensorflow.keras.layers import Dropout
from keras.constraints import maxnorm
from tensorboard.plugins.hparams import api as hp
import tensorflow_addons as tfa
#--------------------------------------------------------------#
import nengo
import nengo_dl
import keras_spiking
import nengo_loihi

warnings.simplefilter(“ignore”)
tf.get_logger().addFilter(lambda rec: “Tracing is expensive” not in rec.msg)