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)
Related
Can I access the class inside the multiple folder of one script file in python I did that and when I start running the scripts it is working fine here(import like this from tosca_o.service.service_model.service_model_service import ServiceModelService) in eclipse, but when I start run in the ubuntu terminal I m facing some issues the issue is below.
Issue
ImportError while loading conftest '/home/naga/workarea/tosca-o/zyuvnag/tosca-o/core/rest/src/tosca_o/rest/tests/conftest.py'.
conftest.py:4: in
from tosca_o.service.service_model.service_model_service import ServiceModelService
E ModuleNotFoundError: No module named 'tosca_o'
Could please help me to resolve this issue.
Thanks for your support.
when I start running the scripts it is working fine here(import like this from tosca_o.service.service_model.service_model_service import ServiceModelService)in the eclipse.
but when I start run in the ubuntu terminal I m facing some issues the issue is below.
Issue
ImportError while loading conftest '/home/naga/workarea/tosca-o/zyuvnag/tosca-o/core/rest/src/tosca_o/rest/tests/conftest.py'.
conftest.py:4: in
from tosca_o.service.service_model.service_model_service import ServiceModelService
E ModuleNotFoundError: No module named 'tosca_o'
I'm in battle with one error sine yesterday. I checked similar topics on stackoverflow, but nothing worked.
That's my project structure:
When I type:
uvicorn main:app --reload
To start fastapi this error occure:
File ".\main.py", line 2, in
from scraper.scraper import Scraper
File ".\scraper\scraper.py", line 3, in
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
I have tried to add new PATH in windows, change structure of my project. Do you know hot to handle it?
Not pycharm problem,
when running in pycharm terminal your python runs in venv - which has seperate pip packages (thats the point of venv), but uvicorn probably passes the data to local python installation and not the venv.
so now after installing pandas in regular cmd, its installed system wide, and you can try running your command in pycharm too
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
I have a Python UDF which is connecting to HBase using Happybase. If I run the code from Python 2.7 it works perfectly.
However when I call the Python UDF from Pig 0.15.0 I am getting the following error:
ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1121: Python Error. Traceback (most recent call last): import happybase ImportError: No module named happybase
In my Pig script I am registering my Python script (pigtest.py) like this:
REGISTER 'pigtest.py' using jython as myfuncs;
I tried to set the Happybase path in my Python script as follows but that didn't make a difference:
import sys
sys.path.append('/usr/local/lib/python2.7/dist-packages/happybase')
import happybase
I also tried adding "/usr/local/lib/python2.7/dist-packages/happybase" to the JYTHON_PATH in the .bashrc file (I'm on Ubuntu) but same error comes up.
It seems to me like I need to set the Happybase path somewhere, but I can't figure out where.
I was able to solve this with the help of the Jython user mailing list. You need to specify the parent directory of the Happybase folder, not the path to the Happybase dir itself like I was doing, by doing one of the following:
Append the location to the sys.path in the Python script:
import sys
sys.path.append('/usr/local/lib/python2.7/dist-packages')
import happybase
OR
Add the location as an environment variable to JYTHONPATH (not JYTHON_PATH!):
export JYTHONPATH = $JYTHONPATH:/usr/local/lib/python2.7/dist-packages
Running on a windows machine python 2.7, whenever I try to run my script using the command line I receive the following error.
import winrandom
ImportError: DLL load failed: The specified module could not be found.
But this error does not happen when I run my script through a python IDE
Make sure your PATH correctly includes your python2.7 and python2.7\Scripts directories.
Snippet on settings environment variables (if needed):
http://msdn.microsoft.com/en-us/library/ms682653%28v=vs.85%29.aspx