Getting a weird import error when running the following code.
! pip install --user --upgrade git+https://github.com/broadinstitute/keras-resnet
import keras
import keras_resnet
Basically, I'm trying to install keras_resnet for keras_retinanet on Google colab however I'm getting a not found error. Output is below. The installation completes but then the import fails. Tested it locally and it works only fails on Google Colaboratory.
Running setup.py install for keras-resnet ... - \ done
Successfully installed keras-resnet-0.0.8
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-25-4521fd3221d7> in <module>()
2 #os.chdir('keras-retinanet')
3 import keras
----> 4 import keras_resnet
5 #from keras-retinanet.keras_retinanet.models.resnet import custom_objects
6 #model = keras.models.load_model('/path/to/model.h5', custom_objects=custom_objects)
ModuleNotFoundError: No module named 'keras_resnet'
Try dropping the --user? This worked for me:
!pip install --upgrade git+https://github.com/broadinstitute/keras-resnet
import keras
import keras_resnet
Related
I try to import the deep_srort module in my colab. But it shows me the following:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-9-b784ee656306> in <module>()
----> 1 from deep_sort import preprocessing
2 from deep_sort import nn_matching
3 from deep_sort.detection import Detection
4 from deep_sort.tracker import Tracker
5 from tools import generate_detections as gdet
ModuleNotFoundError: No module named 'deep_sort'
Cloning the repo and installing the requirements solved the problem for me:
!git clone https://github.com/theAIGuysCode/yolov4-deepsort
%cd yolov4-deepsort/
!pip install -r requirements-gpu.txt
I am using Google Colab and trying to use transformers. first, I installed trasnformers using pip, and it installed successfully but I was still unable to import the following functions
from transformers.trainer_utils import get_last_checkpoint,is_main_process
Next I tried to install Transformers from source in a virtual environment. I installed it successfully, but was still getting the same error as shown below.
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-53-d42272f1d6ac> in <module>()
----> 1 from transformers.trainer_utils import get_last_checkpoint,is_main_process
ModuleNotFoundError: No module named 'transformers.trainer_utils'
From comments
The issue fixed after installing "master" version from source as shown
below
pip install git+github.com/huggingface/transformers
I installed pandas via pip in my virtualenv venv.
When I run import pandas as pd, I get the following error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-588656c123e4> in <module>
3 import tarfile #2
4 from six.moves import urllib #3
----> 5 import pandas as pd #4
ModuleNotFoundError: No module named 'pandas'
I am running Jupiter notebook in the virtual environment. To make sure it installed properly, I opened the python in the virtualenv and ran the import, and it worked fine, what could be the issue? Could it be that though I ran Jupiter Notebook in my venv its not looking at the packages in the virtual environment?
Edit 1: I installed pandas on my machine, not in the virtual machine, and that resolved my issue. However, I want the notebook to look at the packages in my virtual environment, how do I do that?
Try running this in a Jupyter cell
!pip install pandas
I cannot use edward package on google cola.
I have the below error:
ModuleNotFoundError Traceback (most recent call last)
in ()
----> 1 import edward
4 frames
/usr/local/lib/python3.6/dist-packages/edward/models/dirichlet_process.py in ()
6
7 from edward.models.random_variable import RandomVariable
----> 8 from tensorflow.contrib.distributions import Distribution
9
10 try:
ModuleNotFoundError: No module named 'tensorflow.contrib'
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
Uninstalling current/latest version of tensorflow and installing version 1.14 resolved it for me. Looks like they removed tensorflow.contrib from tensorflow version >1.14.
!pip uninstall tensorflow
!pip install tensorflow==1.14
After having installed tensorflow on Ubuntu 16.0 on AWS,
by using :
conda install -c conda-forge tensorflow=1.2.1
When typing on terminal SSH :
ipython
import tensorflow as tf
tf.__version__
It returns 1.2.1 and everything is fine.
But, when this code is run on Jupyter Ipython notebook
launched from same python install (anaconda),
I got this error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-b6f7b46cc0dd> in <module>()
1 import tensorflow as tf
----> 2 tf.__version__
AttributeError: module 'tensorflow' has no attribute '__version__'
Don't understand how this error can come over since the python distribution
is the same.
Is there a way to check the install of Tensorflow ?
EDIT:
This post https://github.com/tensorflow/tensorflow/issues/3369
shows it might be related to sudo access to some folders.... when installed.
TBD