ModuleNotFoundError only on system but not on Colab - python-3.x

The following error is not occurring when I run my code on Colab. And I am facing this error when I try to run on my system
Traceback (most recent call last):
File "program.py", line 224, in <module>
import infun
ModuleNotFoundError: No module named 'infun'
I changed to the directory in which my infun present i.e., infunner at the start of my program program.py
import os
os.chdir('infunner')
And I find no difference in paths of files provided for program execution in both Colab and on my system.
What is the reason for this error?
The file structure is as follows
├───program.py
├───infunner
│ ├───infun
│ ...
...

Related

ModuleNotFoundError: No module named 'torch.backends'

I would like to run the yolov5 source code for object detection on visual studio, but every time I run it, I get the following error. I tried to post the full code here but it kept giving me an error. Anyone who can help?
PS C:\Users\ALLO CEDRIC BOLAMBA\Desktop\Project> & "C:/Users/ALLO CEDRIC BOLAMBA/AppData/Local/Microsoft/WindowsApps/python3.10.exe" "c:/Users/ALLO CEDRIC BOLAMBA/Desktop/Project/detect.py"
Traceback (most recent call last):
File "c:\Users\ALLO CEDRIC BOLAMBA\Desktop\Project\detect.py", line 8, in <module>
import torch.backends.cudnn as cudnn
ModuleNotFoundError: No module named 'torch.backends'
PS C:\Users\ALLO CEDRIC BOLAMBA\Desktop\Project>

ModuleNotFoundError: No module named 'scripts.trio_ircproxy'

I just started getting this error:
ImportError: attempted relative import with no known parent package
My directory structure us:
~/Documents/trio_ircproxy/scripts/trio_ircproxy/system_data.py
and I am running the interpreter from ~/Documents/trio_ircproxy/
(base) ashburry#ashburry-ThinkCentre-M92P:~/Documents/trio_ircproxy$ python3 trio_ircproxy.py
Traceback (most recent call last):
File "trio_ircproxy.py", line 35, in <module>
from scripts.trio_ircproxy.system_data import SystemData as system_data
ModuleNotFoundError: No module named 'scripts.trio_ircproxy'
SystemData is a class I am trying to import.
I was not getting this error before so I do not know what the problem is. Any Help?
I fixed this by putting an __init__.py file in the /scripts/ and /scripts/trio_ircproxy/ directories. The file is blank as I am not sure what to put in the __init__.py file.

subprocess.Popen ModuleNotFoundError

I am trying to run a python script through another python script, with subprocess.Popen. I have:
import subprocess
p = subprocess.Popen(['/Library/Frameworks/Python.framework/Versions/3.8/bin/python3',
'myscript.py'])
p.poll() is None
Sometimes I get:
Out[21]: <subprocess.Popen at 0x11b5823a0>
But nothing happens and the script is not executed.
Some other times I get the following error:
Traceback (most recent call last):
File "myscript.py", line 11, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
I am pretty sure that the requests module have been properly imported in the script I am trying to run. Any help welcome ;)

ModuleNotFoundError: No module named 'nets' for object detection api

I am trying to train TF object detection model on colab and I have added 'slim' to $PYTHONPATH
['/env/python',
'/content/gdrive/My\\ Drive/Real_Traffic_Vehicle_Detector/models/research',
'/content/gdrive/My\\ Drive/Real_Traffic_Vehicle_Detector/models/research/slim',
'/content/gdrive/My\\Drive/Real_Traffic_Vehicle_Detector/models/research/object_detection',
but even then when I try to run train.py file it shows error that no module named 'nets'. can anyone help me out?
WARNING:tensorflow: The TensorFlow contrib module will not be included
in TensorFlow 2.0. For more information, please see: *
https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
* https://github.com/tensorflow/addons * https://github.com/tensorflow/io (for I/O related ops) If you depend
on functionality not listed there, please file an issue.
Traceback (most recent call last): File "train.py", line 52, in
from object_detection.builders import model_builder File "/usr/local/lib/python3.6/dist-packages/object_detection/builders/model_builder.py",
line 35, in
from object_detection.models import faster_rcnn_inception_resnet_v2_feature_extractor as frcnn_inc_res
File
"/usr/local/lib/python3.6/dist-packages/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.py",
line 28, in
from nets import inception_resnet_v2 ModuleNotFoundError: No module named 'nets'
You should change from
My\\ Drive
To just
My Drive
Because it is already in string quote.

ImportError: No module named darkflow.cli

I just want to do live object recognition from web-came using YOLO and while testing it, I am facing some issues. I am using Ubuntu os. Here is the error I get in terminal.
rajan#RGR:~/yolo setup/YOLO_Object_Detection-master$ ./flow --model cfg/yolo-new.cfg --load bin/yolo-new.weights --demo videofile.avi
Traceback (most recent call last):
File "./flow", line 4, in <module>
from darkflow.cli import cliHandler
ImportError: No module named darkflow.cli
Here is the link of the git repository which I am using as refenrece:
https://github.com/llSourcell/YOLO_Object_Detection

Resources