ModuleNotFoundError: No module named 'app.model' - python

I just tried to import app.model.preprocessor and it gave me the following error:
ModuleNotFoundError: No module named 'app.model'
I am using code from a tutorial. Does anyone know why my computer doesn't want to import app.model? I did install app with pip3.

So I figured it out. App is a class written by Siraj. I didn't pull the entire git because I thought this was just using frameworks. Sorry!
So the git contains an app folder with a model folder inside. So it's not the 'app' that is publicly accessible as a framework.

Related

Question about Colab importing your own modules

I am relatively new to Colab & python, so I don't really know how to use it. I have git-cloned a GitHub repository onto my Colab notebook. There are some modules inside the GitHub folder that I have cloned that I need to import them into the notebook. For example, there is a utils and models module that I want to import. I ran the code:
from models import *
from utils import *
However, the Colab editor wrought the error ModuleNotFoundError: No module named 'models' and ModuleNotFoundError: No module named 'utils'. This led me to realize that I haven't imported the modules from the Git Hub clone in Colab Files into Colab. I couldn't find an answer on StackOverflow, w3schools, or the Colab official sites so I
wrought my question here. If any of you have a link to a guide or a solution, please help me. Thank you!
Yes, some of the Jupyter Notebook tricks worked. I used %cd pytorch_objectdetecttrack to get to the modules.
Not an expert in Colab, but for Python import only works for Python modules. So if there's a specific script you're trying to import, you will have to call it like import folder.someModule. The folder you're trying to access should go first, then the module name.
It's the same as saying ./folder/someModule.py.
tl:dr; You have to specify the path to the module if it's not in the current working directory.

I downloaded flask successfully but "ModuleNotFoundError: No module named 'app'"

I am making a program that displays the average number of machines built over a certain number of days. The company gave me some code to work with but it says
"ModuleNotFoundError: No module named 'app'"
and I am pretty sure I downloaded Flask correctly. I already tried uninstalling Flask and reinstalling it. Does anyone have any idea what this error is caused by and how to fix it?
Here's the directory:
The 'app' folder:
The stuff I imported:
i got what you are doing.. you do not need to write the folder name for importing files
you can write
import queries
not
from app import queries
no need to use import app from app too

I am working on getting google contacts using google contacts API . Here I am getting some problem

For running google contacts API, these libraries are used:
import atom.data
import gdata.data
import gdata.contacts.client
import gdata.contacts.data
The problem is these libraries are not installed correctly.
I am getting these type of errors.
1) AttributeError: module 'atom' has no attribute 'LinkFinder'
2) ImportError: No module named core
Any solution for doing this importing the libraries correctly?
How to install these library correctly to execute my code?
EDIT
I want to know how to remove these errors after installing atom and gdata.

python ImportError "module named termios" on GAE

I'm working to build a app to upload image to imgur on GAE with python27, I have downloaded some extra modules from github (pyimgur), which require some modules to be in the app directory which I have installed & placed it under LIB directory & I was able to eliminate each error one by one until till last one turned up, I'm not sure how to fix it, as I couldn't find any pip module for it. The error I am getting is
ImportError: No module named termios
So I do I install it? or Include it?
other module required {which I've them installed & placed it under my app directory are}
1.auth
2.decorator
3.httplib2
4.oauth2
5.pyimgur
6.requests
here's :gae error log it's on line 30
It looks like there are a number of pyimgur libraries available. I would make sure that you are using the correct one.
It looks like you are trying to use this library based on the other dependencies you have installed (decorator, oauth2, requests) https://github.com/Damgaard/PyImgur
However, there is no auth module in that library, so line 28 of your uploadimage.py file doesn't make any sense because there is no auth to import.
from pyimgur import auth
Try out the library I linked instead.

Import failed when the module is already in the sys.path

It's weird to me that the import fails even when it's in the sys.path.
today, I set up a google app engine django environment on ubuntu in my lab's pc. And it works fine when I checked out the code and ran it in windows(same pc in the lab).
But when I went to the dorm, and checked out the code and start to run, it failed weirdly.
I print the sys.path, like this:
['/home/tower/googlecode/mygae', '/home/tower/googlecode/mygae/.google_appengine', '/home/tower/googlecode/mygae/.google_appengine/lib/antlr3', ...]
and when I ran python complained
from google.appengine.api import apiproxy_stub_map
ImportError: No module named appengine.api
it's easy to know the google module is in the '/home/tower/googlecode/mygae/.google_appengine'
directory, and the__init__.py for each module is present.
So what can be the reason for this weird thing? Or what I messed up probably?
thanks.
Can you import google and google.appengine?
Are you sure interpreter has read and traverse access rights to the module tree?
I had the same problem on Ubuntu when I wanted to play with google.appengine in console. First I tried to fix it by removing the /usr/lib/python2.7/dist-packages/google package altogether but Ubuntu One complained. Finally I resolved it by merging the GAE SDK google package into the package that caused the collision.
The contents of the /usr/lib/python2.7/dist-packages/google dir now look like this:
/google
/appengine
/net
/protobuf
/pyglib
/storage
/__init__.py
/__init__.pyc
Looks like you're getting a module (or package) called 'google' from elsewhere -- perhaps /home/tower/googlecode/mygae -- and THAT google module has no appengine in it. To check, print google.__file__ and if possible google.__path__; that should be informative.
Sometimes you can get an import error for a module when the error is something different, like a syntax error. Try putting
import pdb;pdb.set_trace()
just before the import and then s(tep) into the import, and n(ext) thruogh the module in question to see of you get an error.

Categories