Python3 ModuleNotFoundError: No module named 'torch2trt.plugins' - python

Thanks in advance!
I've installed torch2trt as follows:
git clone https://github.com/NVIDIA-AI-IOT/trt_pose
cd trt_pose
sudo python3 setup.py install
Through a terminal opening python3,i can do the following - HOORAY!
import torch2trt
print(torch2trt.__file__)
/home/user/torch2trt/torch2trt/__init__.py
However when I run my script which imports torch2trt i get the following message:
import torch2trt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/torch2trt-0.1.0-py3.6.egg/torch2trt/__init__.py", line 14, in <module>
File "/usr/local/lib/python3.6/dist-packages/torch2trt-0.1.0-py3.6.egg/torch2trt/__init__.py", line 7, in load_plugins
ModuleNotFoundError: No module named 'torch2trt.plugins'
Please help my NOOBNESS!

Related

Failed to import dataclasses module

Today I installed python 3.7 from apt-get to try out the new dataclasses module. I installed it seperately because python3.6 wasn't upgradeable to 3.7.
When I type: python3.7 --version, it gives me: >>> Python 3.7.0a2 as my current version.
The problem is that I can't seem to import dataclasses.
my import statement is: from dataclasses import dataclass as instructed here
This is the error message it's giving me:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'dataclasses'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'dataclasses'
I even tried installing the dataclasses module with pip3: pip3 install dataclasses. Not sure if that's necessary though.
Any suggestion on what might be the problem?
[EDIT] Just tried it with a python3.6 console and it worked fine .. weird.
As suggested by #wim python3.7 -m venv venv_dir
This command will:
Use python3.7 to run the command
The -m flag tells the interpreter to run the next argument as a script
venv is a module, and because of the -m flag it will be run as a script
Finally, the venv_dir is given to the venv module as an argument which
this module will use to create a virtual environment directory at
Once this command is run now you'll have a nice sandbox for messing around/testing the dataclasses module.
To activate this virtual environment be sure to run source venv_dir/bin/activate before you begin. This command will run the script at venv_dir/bin/activate to set up the necessary environment variables and other things for you
To deactivate, simply run deactivate after activating

Mingus/lilypond on python

I can import mingus but sublibraries such as mingus.extra.lilypond give me an error:
import mingus.core.notes
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import mingus.core.notes
File "C:\Users\PharaohZz\AppData\Local\Programs\Python\Python36\lib\site-packages\mingus\core\notes.py", line 29, in <module>
from mt_exceptions import NoteFormatError, RangeError, FormatError
ModuleNotFoundError: No module named 'mt_exceptions'
or
import mingus.extra.lilypond
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import mingus.extra.lilypond
File "C:\Users\PharaohZz\AppData\Local\Programs\Python\Python36\lib\site-packages\mingus\extra\__init__.py", line 20, in <module>
import lilypond
ModuleNotFoundError: No module named 'lilypond'
You can fix this problem by first uninstalling mingus (pip uninstall mingus).
Then build the library from it's source. To do this:
Download the files from git hub using the command git clone https://github.com/bspaans/python-mingus .
Enter the directory using cd python-mingus.
Finally install it using the command python setup.py install.
This fixed the problem for me.

Raspberry Pi project - no module named error

Ok so im trying my first Raspberry Pi project https://www.youtube.com/watch?v=Y2QFu-tTvTI
i have followed the steps for installing open cv and the other dependencies but when i try to run it i get the following error
(cv) pi#raspberrypi:~/Smart-Security-Camera $ python main.py
Traceback (most recent call last):
File "main.py", line 3, in <module>
from mail import sendEmail
File "/home/pi/Smart-Security-Camera/mail.py", line 2, in <module>
from email.MIMEMultipart import MIMEMultipart
ImportError: No module named 'email.MIMEMultipart'
i then tried entering "sudo python main.py" and got a different messege but the same problem as shown below
(cv) pi#raspberrypi:~/Smart-Security-Camera $ sudo python main.py
Traceback (most recent call last):
File "main.py", line 5, in <module>
from camera import VideoCamera
File "/home/pi/Smart-Security-Camera/camera.py", line 2, in <module>
from imutils.video.pivideostream import PiVideoStream
ImportError: No module named imutils.video.pivideostream
finally i tried "sudo python3 main.py" and again different messege same issue.
(cv) pi#raspberrypi:~/Smart-Security-Camera $ sudo python3 main.py
Traceback (most recent call last):
File "main.py", line 1, in <module>
import cv2
ImportError: No module named 'cv2'
any help is appreciated

ImportError: No module named 'baseapi'

I can`t use the pyfcm module because of bellow error message.
How do I fix this error??
>>> from pyfcm import FCMNotification
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from pyfcm import FCMNotification
File "C:\Anaconda3\lib\site-packages\pyfcm\__init__.py", line 6, in <module>
from .fcm import FCMNotification
File "C:\Anaconda3\lib\site-packages\pyfcm\fcm.py", line 1, in <module>
from baseapi import BaseAPI
ImportError: No module named 'baseapi'
If you are running Linux, try running this command in the shell: pip install baseapi.
If you are using an IDE, look for a prompt asking if you want to install this package.

ImportError: No module named 'jsonconv'

I am running Python 3.4
Did pip install json2html with no errors.
However, when I execute "import json2html" I got:
>>> import json2html
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\site-packages\json2html-0.3-py3.4.egg\json2html\__init__.py", line 6, in <module>
ImportError: No module named 'jsonconv'
>>>
please help suggest..
It seems this library is not python3-compatible.
Error was caused by this line in the __init__.py file:
from jsonconv import *
While, instead, it should be:
from .jsonconv import *
Try this fork instead: https://github.com/YAmikep/json2html

Categories