Skip to content

problem with importing pip._internal.main as pip_exec #34

@ksimmi

Description

@ksimmi

Hello!
Today I started new project with pyenv and python-3.8.0 and I had problems with installation packages via pundle. For example I putted one line pyramid into requirements.txt and then I had an error:

pundle install
Install some packages
try <pip._vendor.distlib.locators.SimpleScrapingLocator object at 0x7fb64044cc10> for pyramid
try <pip._vendor.distlib.locators.JSONLocator object at 0x7fb6404af970> for pyramid
Use temp dir /tmp/tmpdizbrgtx
pip install --no-deps -t /tmp/tmpdizbrgtx https://pypi.python.org/packages/12/e5/8cffc593b70ee6392ea08e8562843166895b96cf33ace892229bcfca410e/pyramid-1.8.3.tar.gz
Traceback (most recent call last):
  File "/home/ksimmi/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pundle.py", line 242, in locate_and_install
    pip_exec([
TypeError: 'module' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ksimmi/.pyenv/versions/3.8.0/bin/pundle", line 10, in <module>
    sys.exit(CmdRegister.main())
  File "/home/ksimmi/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pundle.py", line 1027, in main
    cls.commands[alias]()
  File "/home/ksimmi/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pundle.py", line 1033, in cmd_install
    install_all(**create_parser_or_exit())
  File "/home/ksimmi/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pundle.py", line 922, in install_all
    suite.install()
  File "/home/ksimmi/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pundle.py", line 477, in install
    state.reveal_requirements(self, install=install)
  File "/home/ksimmi/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pundle.py", line 334, in reveal_requirements
    dist = self.check_installed_version(suite, install=install)
  File "/home/ksimmi/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pundle.py", line 302, in check_installed_version
    dist = self.requirement.locate_and_install(suite, installed=self.get_installed())
  File "/home/ksimmi/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pundle.py", line 252, in locate_and_install
    raise PundleException('%s was not installed due error %s' % (self.egg or loc_dist.name, exc))
pundle.PundleException: pyramid was not installed due error 'module' object is not callable

When I replaced pyramid line in requirements.txt with django I had the same error. I repeated it with lots of packages with the same result.

I don't know why but It behaves because of how Python imports the main method from pip._internal. The imported method is not a method! The method's type is a module. I fixed this behavior by simple check of type of the imported method's type and if it module I fetching method from it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions