You are not logged in.

#1 2016-02-27 06:48:43

johnnynyquist
Member
Registered: 2016-01-25
Posts: 27

SOLVED pip install progressbar-ipython fails - what to do?

I'm installing a python package that lists progressbar-ipython as a dependency. When I try to install it using pip, I get an import error:

  Using cached progressbar-ipython-2.3.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-hgduilu_/progressbar-ipython/setup.py", line 5, in <module>
        import progressbar
      File "/tmp/pip-build-hgduilu_/progressbar-ipython/progressbar/__init__.py", line 49, in <module>
        from compat import *
    ImportError: No module named 'compat'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-hgduilu_/progressbar-ipython

The error is caused because the package author uses implicit relative imports in __init__.py:

from compat import *

should read (for more modern python):

from .compat import *

or even better:

from progressbar.compat import *

The error stems out of the author's inexplicable decision to preferentially support python 2.4 over python 3.3 (and later), as discussed on this thread:

https://github.com/niltonvolpato/python … /issues/28

It baffles me that this error was flagged three years ago and still hasn't been fixed, and that a language version that has been deprecated for seven years is prioritized over current code, but more to the point: what is the workaround? How do I install the package and get on with my life? I've only ever learned how to install packages with pip, and it doesn't seem to work here, so what do I do?

Thanks for any help.

Last edited by johnnynyquist (2016-02-27 07:22:48)

Offline

#2 2016-02-27 07:22:10

johnnynyquist
Member
Registered: 2016-01-25
Posts: 27

Re: SOLVED pip install progressbar-ipython fails - what to do?

I solved this problem- manually installed the package and made the edits noted in the linked thread:

this is because the imports aren't relative to the current package. Changing
the imports in __init__.py to

     from .compat import *

and so on works, as would `from progressbar.compat`.

I also needed to change `import widgets` to `from . import widgets` in
`progressbar.py`. Then everything worked.

Then running

python setup.py install

and that took care of it.

Offline

Board footer

Powered by FluxBB