Code Monkey home page Code Monkey logo

Comments (21)

carlio avatar carlio commented on July 21, 2024

I haven't been able to reproduce that yet - could you tell me what version of you have installed?

from prospector.

obeleh avatar obeleh commented on July 21, 2024

Master on Linux_x64_3.2.0-4-amd64 debian wheezy. Python 2.7 btw

from prospector.

carlio avatar carlio commented on July 21, 2024

I created a virtual machine, installed Debian, and managed to git clone and python setup.py install just fine. Odd.

What happens if you run python -c 'import pylint_common' ?

from prospector.

obeleh avatar obeleh commented on July 21, 2024

works fine

from prospector.

obeleh avatar obeleh commented on July 21, 2024

Btw when I read my first comment it appears that I'm saying that the installation fails. What I meant to say is that this fails:

sjuul@development01:~/workspace/oversight$ python -c 'import pylint_common'
sjuul@development01:~/workspace/oversight$ prospector
Traceback (most recent call last):
  File "/usr/local/bin/prospector", line 9, in <module>
    load_entry_point('prospector==0.5.1', 'console_scripts', 'prospector')()
  File "/usr/local/lib/python2.7/dist-packages/prospector-0.5.1-py2.7.egg/prospector/run.py", line 186, in main
    summary, messages = prospector.execute()
  File "/usr/local/lib/python2.7/dist-packages/prospector-0.5.1-py2.7.egg/prospector/run.py", line 131, in execute
    tool.prepare(self.path, self.ignores, self.config, self.adaptors)
  File "/usr/local/lib/python2.7/dist-packages/prospector-0.5.1-py2.7.egg/prospector/tools/pylint/__init__.py", line 83, in prepare
    adaptor.adapt_pylint(linter)
  File "/usr/local/lib/python2.7/dist-packages/prospector-0.5.1-py2.7.egg/prospector/adaptor/common.py", line 8, in adapt_pylint
    linter.load_plugin_modules(['pylint_common'])
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.1.0-py2.7.egg/pylint/lint.py", line 357, in load_plugin_modules
    module = load_module_from_name(modname)
  File "/usr/local/lib/python2.7/dist-packages/logilab_common-0.61.0-py2.7.egg/logilab/common/modutils.py", line 125, in load_module_from_name
    return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
  File "/usr/local/lib/python2.7/dist-packages/logilab_common-0.61.0-py2.7.egg/logilab/common/modutils.py", line 167, in load_module_from_modpath
    mp_file, mp_filename, mp_desc = find_module(part, path)
ImportError: No module named pylint_common

from prospector.

carlio avatar carlio commented on July 21, 2024

Ah, ok, that makes a bit more sense! It seems to run okay for me - does it only fail in your oversight directory? What if you clone something like https://github.com/carlio/django-flows somewhere else and run prospector? (That's the repo I used to test and everything worked fine)

from prospector.

carlio avatar carlio commented on July 21, 2024

What I suspect is that you have a slightly different $PYTHONPATH or something to me - the sys.path gets fiddled with a bit by pylint

from prospector.

obeleh avatar obeleh commented on July 21, 2024
juul@development01:~/workspace/django-flows$ prospector
Traceback (most recent call last):
  File "/usr/local/bin/prospector", line 9, in <module>
    load_entry_point('prospector==0.5.1', 'console_scripts', 'prospector')()
  File "/usr/local/lib/python2.7/dist-packages/prospector-0.5.1-py2.7.egg/prospector/run.py", line 186, in main
    summary, messages = prospector.execute()
  File "/usr/local/lib/python2.7/dist-packages/prospector-0.5.1-py2.7.egg/prospector/run.py", line 131, in execute
    tool.prepare(self.path, self.ignores, self.config, self.adaptors)
  File "/usr/local/lib/python2.7/dist-packages/prospector-0.5.1-py2.7.egg/prospector/tools/pylint/__init__.py", line 83, in prepare
    adaptor.adapt_pylint(linter)
  File "/usr/local/lib/python2.7/dist-packages/prospector-0.5.1-py2.7.egg/prospector/adaptor/common.py", line 8, in adapt_pylint
    linter.load_plugin_modules(['pylint_common'])
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.1.0-py2.7.egg/pylint/lint.py", line 357, in load_plugin_modules
    module = load_module_from_name(modname)
  File "/usr/local/lib/python2.7/dist-packages/logilab_common-0.61.0-py2.7.egg/logilab/common/modutils.py", line 125, in load_module_from_name
    return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
  File "/usr/local/lib/python2.7/dist-packages/logilab_common-0.61.0-py2.7.egg/logilab/common/modutils.py", line 167, in load_module_from_modpath
    mp_file, mp_filename, mp_desc = find_module(part, path)
ImportError: No module named pylint_common
sjuul@development01:~/workspace/django-flows$ echo $PYTHONPATH
--nothing--

I'm running on a Google compute engine instance. That might be the reason. I'm going to try on a local machine for a sec

from prospector.

obeleh avatar obeleh commented on July 21, 2024

Yep prospector seems to be working on a normal machine.

from prospector.

carlio avatar carlio commented on July 21, 2024

Hmm. I really can't think of what it could be, except some unusual interaction with sys.path.

from prospector.

obeleh avatar obeleh commented on July 21, 2024
>>> import sys
>>> print sys.path
['', '/usr/local/lib/python2.7/dist-packages/prospector-0.5.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/pep8_naming-0.2.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/pep8-1.4.6-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/pyflakes-0.7.3-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/mccabe-0.2.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/PyYAML-3.10-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/dodgy-0.1.5-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/setoptconf-0.1.0-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/requirements_detector-0.1.3-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/pylint_common-0.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/pylint_plugin_utils-0.1.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/pylint_django-0.3-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/pylint_celery-0.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/pylint-1.1.0-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/astroid-1.0.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/logilab_common-0.61.0-py2.7.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7']

from prospector.

techdragon avatar techdragon commented on July 21, 2024

I installed a copy of the code to try and develop a formatter, and after working a few times, the code suddenly throws this error for me as well.

from prospector.

carlio avatar carlio commented on July 21, 2024

I have a new theory, which is because it tries to import __pkginfo__.py in the setup.py. I believe this is a Stupid Thing™ in retrospect, so replacing that would probably help. I'll try to get onto it soon, but if you're interested in the formatter stuff, perhaps try removing the import from setup.py to get it working?

from prospector.

techdragon avatar techdragon commented on July 21, 2024

it seems to be more than the pkginfo line, i can remove that and still get the error, just slightly differently.

techdragon  🐍  2.7  ⓔ  prospector  ⋯  github.com  techdragon  prospector  python prospector/run.py -o jenkins                                                   master 
Traceback (most recent call last):
  File "prospector/run.py", line 202, in <module>
    main()
  File "prospector/run.py", line 187, in main
    summary, messages = prospector.execute()
  File "prospector/run.py", line 132, in execute
    tool.prepare(self.path, self.ignores, self.config, self.adaptors)
  File "/Users/techdragon/.virtualenvs/prospector/lib/python2.7/site-packages/prospector-0.0.1-py2.7.egg/prospector/tools/pylint/__init__.py", line 100, in prepare
    adaptor.adapt_pylint(linter)
  File "/Users/techdragon/.virtualenvs/prospector/lib/python2.7/site-packages/prospector-0.0.1-py2.7.egg/prospector/adaptor/common.py", line 8, in adapt_pylint
    linter.load_plugin_modules(['pylint_common'])
  File "/Users/techdragon/.virtualenvs/prospector/lib/python2.7/site-packages/pylint-1.2.1-py2.7.egg/pylint/lint.py", line 359, in load_plugin_modules
    module = load_module_from_name(modname)
  File "/Users/techdragon/.virtualenvs/prospector/lib/python2.7/site-packages/logilab_common-0.62.0-py2.7.egg/logilab/common/modutils.py", line 125, in load_module_from_name
    return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
  File "/Users/techdragon/.virtualenvs/prospector/lib/python2.7/site-packages/logilab_common-0.62.0-py2.7.egg/logilab/common/modutils.py", line 167, in load_module_from_modpath
    mp_file, mp_filename, mp_desc = find_module(part, path)
ImportError: No module named pylint_common

from prospector.

techdragon avatar techdragon commented on July 21, 2024

Also, since it may be relevant ... when i try to run from the source code after removing the built package from the virtualenv but leaving all the dependencies in place... I get a different alltogether more disturbing error.

techdragon  🐍  2.7  ⓔ  prospector  ⋯  github.com  techdragon  prospector  python prospector/run.py -o jenkins                                                   master 
Traceback (most recent call last):
  File "prospector/run.py", line 8, in <module>
    from prospector import config as cfg, tools, blender
ImportError: No module named prospector

after purging all the prospector based imports in order to ensure that it was running entirely from the current state of my py files in my git repo fork of this, it comes right back, to the same error pretty much

 techdragon  🐍  2.7  ⓔ  prospector  ⋯  github.com  techdragon  prospector  python prospector/run.py -o jenkins                                              1   master 
Traceback (most recent call last):
  File "prospector/run.py", line 210, in <module>
    main()
  File "prospector/run.py", line 195, in main
    summary, messages = prospector.execute()
  File "prospector/run.py", line 140, in execute
    tool.prepare(self.path, self.ignores, self.config, self.adaptors)
  File "/Users/techdragon/dev/github.com/techdragon/prospector/prospector/tools/pylint/__init__.py", line 100, in prepare
    adaptor.adapt_pylint(linter)
  File "/Users/techdragon/dev/github.com/techdragon/prospector/prospector/adaptor/common.py", line 8, in adapt_pylint
    linter.load_plugin_modules(['pylint_common'])
  File "/Users/techdragon/.virtualenvs/prospector/lib/python2.7/site-packages/pylint-1.2.1-py2.7.egg/pylint/lint.py", line 359, in load_plugin_modules
    module = load_module_from_name(modname)
  File "/Users/techdragon/.virtualenvs/prospector/lib/python2.7/site-packages/logilab_common-0.62.0-py2.7.egg/logilab/common/modutils.py", line 125, in load_module_from_name
    return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
  File "/Users/techdragon/.virtualenvs/prospector/lib/python2.7/site-packages/logilab_common-0.62.0-py2.7.egg/logilab/common/modutils.py", line 167, in load_module_from_modpath
    mp_file, mp_filename, mp_desc = find_module(part, path)
ImportError: No module named pylint_common

from prospector.

ustun avatar ustun commented on July 21, 2024

This is because import and find_module do not work the same way. find_module will choke on egg's which are files and not directories.

Do the following:

import pylint_common # this will work
print pylint_common # verify that the output of this is an egg file, not an egg dir
imp.find_module('pylint_common')  # this will fail

The workaround is to force setup.py to install all reqs as dir instead of zip using:

sudo python setup.py easy_install -Z .

For further info, see:

https://mail.python.org/pipermail/distutils-sig/2010-December/017147.html
https://pythonhosted.org/setuptools/setuptools.html (always-unzip option)
http://stackoverflow.com/questions/7403738/importerror-no-module-named-suds
http://stackoverflow.com/questions/2604600/why-does-easy-install-extract-some-python-eggs-and-not-others
http://stackoverflow.com/questions/2798451/python-why-do-some-packages-get-installed-as-eggs-and-some-as-egg-folders

You may need to go into the site-packages directory and manually delete or uninstall things which have been installed an zip eggs.

from prospector.

carlio avatar carlio commented on July 21, 2024

Thanks for this information, that's really helpful. It sounds like I could fix this by making the landscapeio/pylint_common library specify zip_safe=False in its setup.py. I will probably raise this on pylint too, as it would suggest that any plugin installed as a zip'd egg would fail.

from prospector.

carlio avatar carlio commented on July 21, 2024

This fix to pylint-common should improve things: landscapeio/pylint-common@e43c88f

New virtualenvs should pull in the most up-to-date version of pylint-common (0.2.1) and hopefully fix this problem. Thanks again @ustun!

from prospector.

ustun avatar ustun commented on July 21, 2024

Not sure, but other packages like pylint-celery might need the same fix:

https://github.com/landscapeio/pylint-celery/blob/master/setup.py

from prospector.

carlio avatar carlio commented on July 21, 2024

Oh good point. I tried it with pylint-django, which seemed okay without the fix. I'll test it with pylint-celery now.

from prospector.

carlio avatar carlio commented on July 21, 2024

Done in this commit: pylint-dev/pylint-celery@2c17188

from prospector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.