pylint errors when using liclipse - pydev

PyLint: Executing command line: /usr/local/bin/pylint --rcfile=/Users/amansehgal/.rcfile --include-ids=y /Users/amansehgal/Documents/cis519/hw3_skeleton/boostedDT.py
PyLint: The stdout of the command line is:
PyLint: The stderr of the command line is: Traceback (most recent call last):
File "/usr/local/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/Library/Python/2.7/site-packages/pylint/__init__.py", line 12, in run_pylint
from pylint.lint import Run
File "/Library/Python/2.7/site-packages/pylint/lint.py", line 34, in <module>
import astroid
File "/Library/Python/2.7/site-packages/astroid/__init__.py", line 54, in <module>
from astroid.nodes import *
File "/Library/Python/2.7/site-packages/astroid/nodes.py", line 54, in <module>
from astroid.scoped_nodes import (
File "/Library/Python/2.7/site-packages/astroid/scoped_nodes.py", line 25, in <module>
import io
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
PyLint: Executing command line: /usr/local/bin/pylint --rcfile=/Users/amansehgal/.rcfile --include-ids=y /Users/amansehgal/Documents/cis519/hw3_skeleton/boostedDT.py
PyLint: The stdout of the command line is:
PyLint: The stderr of the command line is: Traceback (most recent call last):
File "/usr/local/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/Library/Python/2.7/site-packages/pylint/__init__.py", line 12, in run_pylint
from pylint.lint import Run
File "/Library/Python/2.7/site-packages/pylint/lint.py", line 34, in <module>
import astroid
File "/Library/Python/2.7/site-packages/astroid/__init__.py", line 54, in <module>
from astroid.nodes import *
File "/Library/Python/2.7/site-packages/astroid/nodes.py", line 54, in <module>
from astroid.scoped_nodes import (
File "/Library/Python/2.7/site-packages/astroid/scoped_nodes.py", line 25, in <module>
import io
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
I get this error when trying to run pyLint in LiClipse and using the option redirect messages to console. I ran the line on a command prompt without any errors. So the issue is with LiClipse no redirecting output properly. Any ideas ?
/usr/local/bin/pylint --rcfile=/Users/amansehgal/.rcfile --include-ids=y /Users/amansehgal/Documents/cis519/hw3_skeleton/boostedDT.py

This usually means that the console env is different from the LiClipse env.
To fix it, print the environment variables from inside LiClipse and from the shell.
You can do that by creating a python script such as:
for key, val in sorted(os.environ.items()):
print('%s:\n %s' % (key, '\n '.join(sorted(val.split(os.pathsep)))))
And then comparing the values you have in either case.
The most common issue would be in the PATH, PYTHONPATH, DYLD_LIBRARY_PATH (on mac) or LD_LIBRARY_PATH (on linux) env variables.
You can also try to start LiClipse from the same shell where you started your command so that it inherits the env variables you have from the shell.

Related

Docker-compose ps error

I am new to docker-compose and getting the following error when I type in docker-compose ps.
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 7, in <module>
from compose.cli.main import main
File "/Library/Python/2.7/site-packages/compose/cli/main.py", line 20, in <module>
from ..bundle import get_image_digests
File "/Library/Python/2.7/site-packages/compose/bundle.py", line 14, in <module>
from .service import format_environment
File "/Library/Python/2.7/site-packages/compose/service.py", line 37, in <module>
from .parallel import parallel_execute
File "/Library/Python/2.7/site-packages/compose/parallel.py", line 10, in <module>
from six.moves import _thread as thread
ImportError: cannot import name _thread
Docker-compose is written by python. It seems that you miss some python packages. You can refer to the following page of how to fix the python lib issue.
Matplotlib issue on OS X ("ImportError: cannot import name _thread")
Alternatively, you can try to install docker-compose as a container, the docker container contains appropriate environment for docker-compose.
https://docs.docker.com/compose/install/#install-as-a-container

google-cloud-storage library from nosetests using testbed

I have google-cloud-storage pip installed into a lib directory and vendored in. It's running just fine locally during development of my python appengine app. However, when trying to run unit tests via nose and testbed I'm getting "The 'google-cloud-core' distribution was not found and is required by the application". Here is the stack:
Traceback (most recent call last):
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/Users/jason/dev/gain-data/data/storage/__init__.py", line 4, in <module>
from google.cloud.storage import Blob, Client
File "/Users/jason/dev/gain-data/lib/google/cloud/storage/__init__.py", line 42, in <module>
from google.cloud.storage.batch import Batch
File "/Users/jason/dev/gain-data/lib/google/cloud/storage/batch.py", line 30, in <module>
from google.cloud.storage.connection import Connection
File "/Users/jason/dev/gain-data/lib/google/cloud/storage/connection.py", line 17, in <module>
from google.cloud import connection as base_connection
File "/Users/jason/dev/gain-data/lib/google/cloud/connection.py", line 31, in <module>
get_distribution('google-cloud-core').version)
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 557, in get_distribution
dist = get_provider(dist)
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 431, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 968, in require
needed = self.resolve(parse_requirements(requirements))
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 854, in resolve
raise DistributionNotFound(req, requirers)
DistributionNotFound: The 'google-cloud-core' distribution was not found and is required by the application
Any thoughts?
I had the same issue with google-cloud-translate, I was forced to also install the package "globally", i.e. pip install google-cloud-translate.
After struggling a lot with this same issue I found out that the error was because the vendor pip lib wasn't in the PYTHONPATH before calling the nosetests.
Try adding the vendor lib to the PYTHONPATH and then run the tests.
export PYTHONPATH="$(HOME)/Projects/myproject/pip_lib:$$PYTHONPATH"; \
nosetests .

No handlers could be found for logger "mongo_connector.util"

I always got the error below when I try to run mongo-connector with neo4j doc manager. I also tried with a config file as in https://github.com/mongodb-labs/mongo-connector/blob/master/config.json
Where is the problem?
mongo-connector -m localhost:27017 -t http://localhost:7474/db/data -d neo4j_doc_manager
No handlers could be found for logger "mongo_connector.util"
Traceback (most recent call last):
File "/usr/bin/mongo-connector", line 11, in <module>
sys.exit(main())
File "/usr/lib/python2.6/site-packages/mongo_connector/util.py", line 85, in wrapped
func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/mongo_connector/connector.py", line 1041, in main
conf.parse_args()
File "/usr/lib/python2.6/site-packages/mongo_connector/config.py", line 118, in parse_args
option, dict((k, values.get(k)) for k in option.cli_names))
File "/usr/lib/python2.6/site-packages/mongo_connector/connector.py", line 824, in apply_doc_managers
module = import_dm_by_name(dm['docManager'])
File "/usr/lib/python2.6/site-packages/mongo_connector/connector.py", line 803, in import_dm_by_name
module = __import__(full_name, fromlist=(name,))
File "/usr/lib/python2.6/site-packages/mongo_connector/doc_managers/neo4j_doc_manager.py", line 16, in <module>
from py2neo import Graph, authenticate
File "/usr/lib/python2.6/site-packages/py2neo/__init__.py", line 28, in <module>
from py2neo.database import *
File "/usr/lib/python2.6/site-packages/py2neo/database/__init__.py", line 65
parameters = {k: v for k, v in parameters.items() if k not in presub_parameters}
It looks like you are using Python 2.6. I'm not sure if that version is officially supported for this project. I would suggest upgrading to Python 2.7 or preferably 3.4 and trying to reproduce.

How to call OCRopus software, or any conflicting software, from Matlab?

When calling the OCR software OCRopus directly from Matlab prompt, there is a series of errors that would not appear when the software is called directly from the shell prompt:
>> ! gnome-terminal -x bash ./sampleBash.sh
Traceback (most recent call last):
File "/usr/local/bin/ocropus-gpageseg", line 15, in <module>
from pylab import *
File "/usr/lib/pymodules/python2.7/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 156, in <module>
from matplotlib.cbook import is_string_like
File "/usr/lib/pymodules/python2.7/matplotlib/cbook.py", line 28, in <module>
import numpy as np
File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 153, in <module>
from . import add_newdocs
File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 18, in <module>
from .polynomial import *
File "/usr/lib/python2.7/dist-packages/numpy/lib/polynomial.py", line 19, in <module>
from numpy.linalg import eigvals, lstsq, inv
File "/usr/lib/python2.7/dist-packages/numpy/linalg/__init__.py", line 50, in <module>
from .linalg import *
File "/usr/lib/python2.7/dist-packages/numpy/linalg/linalg.py", line 29, in <module>
from numpy.linalg import lapack_lite, _umath_linalg
ImportError: /opt/MATLAB/R2012b/sys/os/glnxa64/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3)
where sampleBash.sh is:
#!/bin/bash -e
FILENAME='testfile.png'
ocropus-gpageseg --usefilename "$FILENAME"
$SHELL
It seems that there is a clash between Matlab's environment variables and those of the system bash shell. Any idea on how to send a 'clean' shell environment to the OCRopus software (or any other similar software)?
This is not limited to the OCRopus calls, and any software that would conflict with the Matlab environment variables set during the shell call from within Matlab would face the same problem.
Thanks.
A not-so-clean solution could be to remove the clashing variables before calling the OCRopus software:
>> ! gnome-terminal -x bash unset OSG_LD_LIBRARY_PATH; unset XAPPLRESDIR; unset XKEYSYMDB; unset LD_LIBRARY_PATH; unset TOOLBOX; unset XFILESEARCHPATH; unset BASEMATLABPATH; ./sampleBash.sh
In this way, variables such as OSG_LD_LIBRARY_PATH are removed from the environment before calling the OCR software.

how to properly resolve gsutil error

I just installed gsutil on OS X, exactly following Google's instruction, and am seeing errors of the following format when running any gsutil command:
Traceback (most recent call last):
File "/Users//gsutil/gsutil", line 22, in <module>
gsutil.RunMain()
File "/Users//gsutil/gsutil.py", line 101, in RunMain
sys.exit(gslib.__main__.main())
File "/Users//gsutil/gslib/__main__.py", line 175, in main
command_runner = CommandRunner()
File "/Users//gsutil/gslib/command_runner.py", line 107, in __init__
self.command_map = self._LoadCommandMap()
File "/Users//gsutil/gslib/command_runner.py", line 113, in _LoadCommandMap
__import__('gslib.commands.%s' % module_name)
File "/Users//gsutil/gslib/commands/disablelogging.py", line 16, in <module>
from gslib.command import COMMAND_NAME
ImportError: cannot import name COMMAND_NAME
This error occurs on several modules in the commands directory. The only thing I could do to get rid of these errors is to remove the following modules from the directory which reference COMMAND_NAME: disablelogging, enablelogging, getacl, getcors, getdefacl, getlogging, setacl, setcors, setdefacl.
Did I do the right thing here? Is this a bug in gsutil?