unable to use python module inside a brownie script: ModuleNotFoundError - python

Brownie framework community:
please help. I'm trying to use an external python module, PyGithub, in my python script in the scripts folder. I've pip installed it:
pip install PyGithub
In scripts/create.py, I try to import it:
from github import Github <----- error
from brownie import accounts, convert
def main(): ...
however, when I try running it:
brownie run create.py
I get the error:
ModuleNotFoundError: No module named 'github'
The import statement works perfectly fine in python. Any suggestions on how to resolve this? thanks

Related

No module named 'postal' python error on Apache2

I followed the instructions and successfully installed pypostal python package (package to help parse addresses) https://github.com/openvenues/pypostal.
I'm trying to set this up so the python script can be callable through an apache server on an ubuntu box. It works fine when executing the script from Terminal. However, it doesn't work when I make a call to apache to execute the script and I get the following error in the apache logs. I believe it might be some pathing issue but I haven't had much luck to resolve it. Any ideas will be appreciated.
Error:
File "/var/www/html/cgi-bin/get_parsedAddress.py", line 5, in
from postal.parser import parse_address
ModuleNotFoundError: No module named 'postal'
python script contents:
import sys
from postal.parser import parse_address
addressList = parse_address(sys.argv[1])
print(addressList)

ModuleNotFoundError: No module named 'firebase_admin'

Im currently having issues importing modules in my venv on vscode for google cloud firestore.
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
pip -V shows python 3.8.
python -V shows Python 3.8.1.
using pip freeze, the module appears here.
firebase-admin==5.0.3
however it returns
ModuleNotFoundError: No module named 'firebase_admin'
ive triedfrom google.cloud import firestore as well but it returns ModuleNotFoundError: No module named 'google.cloud'
any help here?
Fixed it by running in python terminal. Somehow using run code in python results in this error. Could possibly be due to interpeter configuration issues

Having trouble importing RLGlue: "No module named 'rlglue.rl_glue'"

I was going through an Reinforcement Learning Course and wanted to try running the code locally. I installed RLGlue with pip install rlglue from here
But then when trying to run the code:
from rlglue.rl_glue import RLGlue
import main_agent
import ten_arm_env
import test_env
Received this error message:
ModuleNotFoundError: No module named 'rlglue.rl_glue'
Any idea on how to fix that to import the module?
I use this as work-around, add this file to your project.
https://gist.github.com/niektuytel/eab1117070454042b11e5e5c026dd3fb

How to know the package or module name from import statement in Python?

I have a python file and the developer of that code has left the organization. When I run the code I get the following error.
import dataAnalysis as DV ModuleNotFoundError: No module named
'dataAnalysis'
I provide below the brief snippet of the python file "main.py" below.
import dataAnalysis as DV
def performCheck():
... other code
... other code
i = DV.addGraph( pathplus)
Here my question is , how to know the actual module or package name of "dataAnalysis" from the above import statement so that I can make "pip install ". However, I tried to install DataAnalysis module, still it does not work.
Is there any way to get the module or package name to install from the import statement in python ?
Go to console or terminal and run command pip install dataAnalysis. If permission denied, then make sure you have enough privilege to install a package.
Update:
In my opinion pip package DataAnalysis is a library that can be used for pre-processing a csv file. As per your given code, it looks like adding a graph so may be it could be a local package. Check dataAnalysis folder in your project with __init__.py file inside.

"ModuleNotFoundError : No module named 'apiclient ' "

I recently tried to view Google Calendar using python . To do that I referred Python Quickstart. I did the steps that were mentioned in the website.
I completed the second step and downloaded the secretclient.json file.
In the terminal I typed in :
pip install --upgrade google-api-python-client
as I was instructed in the website.
I ran the python that was on the website and when I compiled I got the error:
Blockquote
Traceback (most recent call last):
File "quickstart.py", line 2, in
from apiclient import discovery
ModuleNotFoundError: No module named 'apiclient'
The Lines which correspond to the error are :
from apiclient import discovery
Why is the apiclient module unavailable ?
Could it be that you're using a different python version than what the pip installed? For example, if you use python3 to execute the problematic import line, but pip is for python2. Or if you use conda or another python distribution that uses a different path to import the packages from.
You can verify it if you just open from the command line:
python
then
from apiclient import discovery
and check if you still get the error.
you can resolve this by going to Script folder of your Python installation directory and running from there
e.g.
cd D:\Python27\Scripts\
python
from apiclient import discovery
Mainly this issue arises when u have more than one python installation , as noob have suggested

Categories

Resources