pundler
pundler copied to clipboard
problem with importing `pip._internal.main` as `pip_exec`
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.
Hi.
As you can see I made a pull request to make possible run pundle in situation when Python importing pip._internal.main as non callable pip_exec. Today I doubt and it is possible that my code does not make sense. Why? Because I tried to use pundle with pyenv. As ruby developer I expected that both tools compatible like bundle and rbenv in Ruby but they are not. I lost day with trying to run them together but now I belive this is not possible. I will be hapy if I am not right and you will tell me how to use them together. But if I realy right I hope that you will write about it in pundle's documentation with big and bold font.
P.S. pundle is a good idea as tool but bad name, especially for developers who knows Ruby.
Thank you!
BTW I'm working with pyenv and it works fine. Not sure what problem did you have. And what is bad about name?