opsgenie-sdk modeule import error - python

I am trying write a python program to use the Opsgenie API's to pull some reports.
I installed the https://github.com/opsgenie/opsgenie-python-sdk
When i run my program i get the error message
"from opsgenie.alert.requests import ListAlertsRequest
ImportError: No module named requests"
The module is present in the site packages folder and I also added the path to the folder to PYTHONPATH.
It happened for multople module I am not sure if the dependencies work on the opsgenie-sdk.
Has anyone had this issue?
Help appreciated.

Related

Jupyter Notebook : ModuleNotFoundError: No module named 'sqlalchemy'

I have installed sqlalchemy and its getting imported in python in powershell
But when I am trying to import in jupyter notebook, its showing module not found error.
I tried installing it in the notebook and then importing it but no success
I am really stuck. Any help will be appreciated.
Thanks in advance.
A bit of a guess but maybe you need to reopen the notebook after installing - python does not reload its installations before you do it.
I got the solution from this post
"ImportError: No module named" when trying to run Python script
I had to add the path of the module folder to sys.
import sys
sys.path.append('my/path/to/module/folder')
import sqlalchemy

No module named "panel. pane'; 'panel' is not a package

Panel and other holoviz package was working fine. But since yesterday, it is not working and gives following error. I checked the site packages, tried creating cond and venv based virtual environments, but dint help me. Has anyone faced similar issue?
Code:
from panel.pane import PaneBase
Error message:
ModuleNotFoundError: No module named "panel.pane"
'panel' is not a package
This error:
ModuleNotFoundError: No module named 'panel.pane'; 'panel' is not a package
may also occur if you have named the main program file you created as panel.py and try to run it as python panel.py or another file has the name panel.py in the same folder from which you run your program. Python will consider your program file as a module and try to find something in it that is naturally not in it. About where Python is looking for modules, see sys.path.
In this case, rename your program file so that its name does not equal with the name of the imported module.

Why is python unable to detect notification module in plyer?

I can't get this simple statement to work:
from plyer import notification
getting:
ImportError: cannot import name 'notification'
the import statement is correct and is used the same way in examples.
I couldn't find any special instructions to use this library so I'm assuming there aren't any.
I installed plyer using pip and it installed successfully. verified the files are in place. I tried using python 3.5 and 3.6, same result.
It seems the package is recognized but just the module isnt found?
Would appreciate some insight :)
A common cause for this kind of problem is having a script or module by the same name in a location that comes before the expected module or package's location in sys.path so it gets imported instead of the expected module or package.
The simple way to sort this out is to add this simple line before:
import plyer; print(plyer);
and check the result which will diplay the path of whatever named plyer was first found. Chances are it's a script in your current working directory...

ImportError: No module named 'bs4' in django only

The same question has been asked a number of times but I couldn't find the solution.
After I install a package using pip, I am able to import it in python console or python file and it works as expected.
The same package when I try to include in django, it gives import error.
Do I need to modify settings.py file or any requirement that I need to add? I am driving django with the help of virtual env.
Eg:
I am using BeautifulSoup and I am trying to import from bs4 import BeautifulSoup and I am getting error ImportError: No module named 'bs4'
This error only comes in django. I am not able to figure out why this is happening.
Screenshot attached for reference.
1. python console - shows no error
2. django console- import error
I am sorry as it is difficult to read the console but any other thing that I can include which will help me make myself more clear will be appreciated.
You don't show either the code of your site or the command you ran (and the URL you entered, if any) to trigger this issue. There's almost certainly some difference between the Python environment on the command line and that operating in Django.
Are you using virtual environments? If so, dependencies should be separately added to each environment. Were you operating from a different working directory? Python usually has the current directory somewhere in sys.path, so if you changed directories it's possible you made bs4 unavailable that way.
At the interactive Python prompt, try
import bs4
bs4.__file__
That will tell you where bs4 is being imported from, and might therefore give you a clue as to why it's not available to Django.

Python GData Import

I'm trying to use gdata python but unfortunately when I execute my script it keeps on saying me "ImportError: No module named docs".
I have tried importing it by running python directly in shell and everything seems fine.
Can someone help me out with this problem?
edit:
import gdata.docs
import gdata.docs.service
import gdata.docs.client
import gdata.spreadsheet.service
I had this problem when I started. My guess is that your Gdata library is not on your Python path. For example, my gdata and atom modules are located in the Python27/Lib/site-packages folder.
Another option is to update your PATH environmental variable to point to the current location of the Gdata files.

Categories

Resources