Why do I get "No module named Object detection" in Google colab? - python-3.x

I am trying to do object detection using tensor flow in google colab but everytime I run the following code
%run model_builder_test.py
I get this error
ModuleNotFoundError Traceback (most recent call last)
/content/drive2/My Drive/object_detection/builders/model_builder_test.py in <module>()
21
22 from google.protobuf import text_format
---> 23 from object_detection.builders import model_builder
24 from object_detection.meta_architectures import faster_rcnn_meta_arch
25 from object_detection.meta_architectures import rfcn_meta_arch
ModuleNotFoundError: No module named 'object_detection'
I have setup the python path as they said but still keep getting this error.I will give you link to my program below
https://colab.research.google.com/drive/1iko-bEUfxLimtbGqCmrypRyEzaWzE3vu?usp=sharing
Please help

%set_env PYTHONPATH=$PYTHONPATH:/content/models/research:/content/models/research/slim:/content/models

import os
os.environ['PYTHONPATH'] += ':/kaggle/working/models/research/:/kaggle/working/models/research/slim/'

Related

pytest does not finde third party lib but python does

I have an script that I want to test:
my script:
from jsonschema.exceptions import ValidationError
import traceback
from data_product.event_processor import DwhUnknownActionError
from data_product.gateway import DwhDataRankingError
...
my test file:
from iterator_processor import IteratorProcessor
calling: pytest will give this error message:
==================================================================================== ERRORS =====================================================================================
__________________________________________________________________ ERROR collecting iterator_processor_test.py __________________________________________________________________
ImportError while importing test module '/home/a05922/dwh-jobs/src/main/lib/python_lib/data_product/iterator_processor_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
iterator_processor_test.py:5: in <module>
from iterator_processor import IteratorProcessor
iterator_processor.py:4: in <module>
from jsonschema.exceptions import ValidationError
E ImportError: No module named 'jsonschema'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================ 1 error in 3.19 seconds ==========================================================================
calling python3 iterator_processor.py on the other hand gives me:
Traceback (most recent call last):
File "iterator_processor.py", line 7, in <module>
from data_product.event_processor import DwhUnknownActionError
ModuleNotFoundError: No module named 'data_product'
an error that I 100% expect because the file is in the data_product folder. (the script is meant to be called from outside)
what irritates me is that pytest can not find jsonschema while python3 findes the library without problems.
did anybody have a similar problem?
how do I fix this?
Is this a bug in the pytest library?
should I report this?
how do I report this?
how to I check if anybody has reported this already?

onnxruntime: cannot import name 'get_all_providers'

Trying to import onnxruntime in a Jupiter notebook with python 3.6.3 on macOS.
I get the following error on import:
import onnxruntime
ImportError
Traceback (most recent call last)
<ipython-input-4-df664b79ebd4> in <module>
----> 1 import onnxruntime
2
~/.virtualenvs/3.6nlp/lib/python3.6/site-packages/onnxruntime/__init__.py in <module>
11 __author__ = "Microsoft"
12
---> 13 from onnxruntime.capi._pybind_state import get_all_providers, get_available_providers, get_device, set_seed, \
14 RunOptions, SessionOptions, set_default_logger_severity, NodeArg, ModelMetadata, GraphOptimizationLevel, \
15 ExecutionMode, OrtDevice, SessionIOBinding
ImportError: cannot import name 'get_all_providers'
I have looked at similar questions such as this
but haven't found the answer that works for me.
Any suggestions? Thanks!!
It turns out the issue is with libomp not being installed. If you run into this problem you can solve it by running
brew install libomp
Hope this helps if you get stuck like me

Importing Open Data set giving attribute error

I am trying to import kaggle datasets using opendatasets module but after using pandas 1.1.2 with python 3.6v it is not working.
It's giving me this error during the import:
AttributeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/opendatasets/utils/network.py in <module>()
7 try:
----> 8 urlopen = urllib.request.urlopen
9 except Exception:
AttributeError: module 'urllib' has no attribute 'request'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last
PS. I'm working on virtual colab files and not on a local machine
Following is the command of what i am doing
import opendatasets as od
dataset_url='https://www.kaggle.com/rohanrao/air-quality-data-in-india'
od.download('https://www.kaggle.com/rohanrao/air-quality-data-in-india')
data_dir = './air-quality-data-in-india'
!pip install jovian opendatasets --upgrade --quiet
!pip install -q kaggle
import urllib.request
import opendatasets as od
and then entering your kaggle username as well as your kaggle key allows you to import the dataset (until and unless it's not opendata set)

OCC module ImportError: DLL load failed: The specified module could not be found

I'm importing OCC module but it shows error "DLL load failed". The code I tried is:
from OCC.Display.SimpleGui import *
The error it showing :
ImportError Traceback (most recent call last)
~\.conda\envs\myenv\lib\site-packages\OCC\Core\Aspect.py in <module>
16 # Import the low-level C/C++ module
17 if __package__ or "." in __name__:
---> 18 from . import _Aspect
19 else:
20 import _Aspect
ImportError: DLL load failed: The specified module could not be found.
I'm working in Jupyter notebook

import torch error in google Colaboratory

I get the following error on google colaboratory.
ImportErrorTraceback (most recent call last)
in ()
----> 1 import torch
/usr/local/lib/python3.6/site-packages/torch/init.py in ()
54 except ImportError:
55 pass
---> 56 from torch._C import *
57
58 all += [name for name in dir(_C)
ImportError: No module named _C
I tried importing from a different directory. But, still get the same error. Any help?
Try restarting runtime. Colab sometimes gives errors like this :P
Generally that suggests you are in a dir called torch. See this.

Resources