ImportError: No module named parse python/node js - python

I am calling .py file from node.js using npm i cmd-node on windows it is working well and executing my .py file from .js file, but when I am deploying it on the server giving following error:
Note: I am not importing parse anywhere, it may be part if any dependency.
python script cmd error: Error: Command failed: python covert_to_csv.py
Traceback (most recent call last):
File "covert_to_csv.py", line 1, in <module>
import tabula
File "/home/ubuntu/.local/lib/python2.7/site-packages/tabula/__init__.py", line 3, in <module>
from .wrapper import (
File "/home/ubuntu/.local/lib/python2.7/site-packages/tabula/wrapper.py", line 20, in <module>
from .file_util import localize_file
File "/home/ubuntu/.local/lib/python2.7/site-packages/tabula/file_util.py", line 3, in <module>
from urllib.parse import urlparse as parse_url
ImportError: No module named parse

You are probably using different versions of python on your local machine compared to the server. Make sure it is the same version as your local machine and it'll work.

Related

Python with Protobuf in Docker "TypeError: Couldn't build proto file into descriptor pool!"

I have a python app that uses protocol buffers. I am trying to get it running in Docker, but it is throwing an error when I execute docker run:
Here are the Dockerfile contents:
FROM python:3.5-onbuild
CMD [ "python", "./main.py" ]
Here is the error:
bash-3.2$ docker run gcr.io/skroot-com/geo-boundary-refiner:0.1
Traceback (most recent call last):
File "./main.py", line 14, in <module>
from skroot.schema.pipeline.event import geo_boundary_marked_pb2
File "/usr/src/app/skroot/schema/pipeline/event/geo_boundary_marked_pb2.py", line 18, in <module>
from skroot.schema.pipeline import image_info_pb2 as skroot_dot_schema_dot_pipeline_dot_image__info__pb2
File "/usr/src/app/skroot/schema/pipeline/image_info_pb2.py", line 26, in <module>
dependencies=[skroot_dot_schema_dot_pipeline_dot_cloud__storage__location__pb2.DESCRIPTOR,skroot_dot_schema_dot_pipeline_dot___matrix__pb2.DESCRIPTOR,])
File "/usr/local/lib/python3.5/site-packages/google/protobuf/descriptor.py", line 829, in __new__
return _message.default_pool.AddSerializedFile(serialized_pb)
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "image_info.proto":
image_info.proto: Import "skroot/schema/pipeline/cloud_storage_location.proto" has not been loaded.
image_info.proto: Import "skroot/schema/pipeline/matrix.proto" has not been loaded.
skroot.schema.pipeline.ImageInfo.Image.location: "skroot.schema.pipeline.CloudStorageLocation" seems to be defined in "cloud_storage_location.proto", which is not imported by "image_info.proto". To use it here, please add the necessary import.
skroot.schema.pipeline.ImageInfo.TranscodedImage.matrix: "skroot.schema.pipeline.Matrix" seems to be defined in "matrix.proto", which is not imported by "image_info.proto". To use it here, please add the necessary import.
In the image_info.proto file, the .proto files it is complaining about are imported:
import "skroot/schema/pipeline/cloud_storage_location.proto";
import "skroot/schema/pipeline/matrix.proto";
The generated protobuf files are in the skroot/schema/pipeline/ directory.
I'm perplexed because this runs locally. It is only when I try to run it in Docker that I get these errors.

How to add python library to Spyder

I am trying to add an external python library from a third party software into Spyder so I can work with it. I have already tried the following:
Adding library path containing .py files to Tools>PYTHONPATH manager
Synchronizing the path
Updating module names list through Tools>Update Module names list
However, when I try to import modules from this library I get two types of errors:
import easy
Traceback (most recent call last):
File "<ipython-input-2-685519d35f15>", line 1, in <module>
import easy
File "C:\Program Files (x86)\Plaxis\PLAXIS 2D\plxscripting\easy.py", line 24, in <module>
from .server import Server, InputProcessor
ValueError: Attempted relative import in non-package
The second type of error as follows:
from plxscripting.easy import *
Traceback (most recent call last):
File "<ipython-input-1-a40c101d3bb0>", line 1, in <module>
from plxscripting.easy import *
ImportError: No module named plxscripting.easy
I don't understand why Spyder is not recognizing these libraries. The path has been added and shows up on the manager. What constitutes a python module? Is it not just the .py file with module name prefix? Is not the path sufficient to work with the library through the IDE?

Python SDK Install Guide on raspberry pi 3

I follow this page to install python SDK on raspberry pi 3. When i run "import naoqi" for Checking the installation of the Python SDK, I see this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "naoqi.py", line 7, in <module>
import qi
File "qi/__init__.py", line 72, in <module>
from _qi import Application as _Application
ImportError: ./_qi.so: cannot open shared object file: No such file or directory
I think i maybe set wronge path in this code:
export PYTHONPATH=${PYTHONPATH}:/path/to/python-sdk
My question is, what is /path/to/python-sdk ?
I set once this path:export PYTHONPATH=${PYTHONPATH}:/usr/include/python2.7 , and once set this path: export PYTHONPATH=${PYTHONPATH}:/home/nao/Downloads/Python-2.7.12
but i see that error again.
How must i do?
/path/to/python-sdk would be the absolute path to where you extracted pynaoqi-python-2.7-naoqi-x.x-linux32.tar.gz that you have to download.

Python can't load libc when importing xfsm module

I'm trying to write Python code to manipulate Xerox FST files, and I've installed the Python bindings for libxfsm and the XFSM library available through http://fsmbook.com. I'm running 64-bit Ubuntu. The installation goes fine, but when I try to import the xfsm module, I get this error:
>>> import xfsm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/xfsm/__init__.py", line
30, in <module>
import xfsm.errors # So error handler gets installed
File "/usr/local/lib/python2.7/dist-packages/xfsm/errors.py", line
8, in <module>
from xfsm.utils import *
File "/usr/local/lib/python2.7/dist-packages/xfsm/utils.py", line
39, in <module>
libc = cfsm.load_library("c")
File "/usr/local/lib/python2.7/dist-packages/xfsm/cfsm_api.py", line
366, in l oad_library
raise ImportError("%s not found." % libname)
ImportError: c not found.
Inspecting the source code for the Python interface, it looks like it is trying and failing to find libc, and failing, but I am at a loss on how to fix that.
Has anybody else gotten the Python-XFST interface working, or have any idea what's going wrong and how to fix it?
I had same problem on 64-bit Ubuntu 14.04. The problem is it can't find libc. In my case libc on my OS is name libc.so.6(I don't know why, I am new on Ubuntu). But the Python-XFST doesn't recognize it (Detail your can refer to source file)
My solution is simple, just modify xfsm/utils.py file in
**Line 39** : libc = cfsm.load_library("c")
to
**Line 39** : libc = cfsm.load_library("libc.so.6")
Remember to add the path to libc.so.6 in env.

Python error: No module named RuntimeError

Im trying to figured out this problem. Yesterday I installed PyScripter and since then, scripts doesnt work. When I run any script (in PyScripter or IDLE) and trying to "import arcpy", it gets this error:
import arcpy
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import arcpy
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 17, in <module>
from geoprocessing import gp
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\__init__.py", line 14, in <module>
from _base import *
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 14, in <module>
import arcgisscripting
File "C:\Python26\ArcGIS10.0\lib\arcgisscripting.py", line 81, in <module>
from RuntimeError import RuntimeError
ImportError: No module named RuntimeError
Have somebody any suggestion how to fix it?
Thanks to all very much!
Sounds like the module is not installed properly (or at all). To verify, do the following:
open a shell and start the python shell by typing python
(If this doesn't display an error, check that python is added to your system path or if it is even installed at all. But if you've used Python on said machine maybe system path issue)
enter the commmand help('modules')
review the list of modules that's returned to see whether arcpy is included
if not, then you may have to reinstall the module

Categories