Errors while installing python packages

▼魔方 西西 提交于 2019-12-11 01:19:33

问题


I 'm not able to install python packages from both pip and easy_install. There's some absurd kind of error that keeps popping up. Kindly help to rectify it.

I get the same errors while using python setup.py install.

Error while installing django-memcached

C:\Users\Praful\Desktop\django-redis-master>easy_install django-memcached
Traceback (most recent call last):
  File "C:\Python27\Scripts\easy_install-script.py", line 9, in <module>
    load_entry_point('distribute==0.6.27', 'console_scripts', 'easy_install')()
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\com
mand\easy_install.py", line 1915, in main
    with_ei_usage(lambda:
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\com
mand\easy_install.py", line 1896, in with_ei_usage
    return f()
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\com
mand\easy_install.py", line 1919, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "C:\Python27\lib\distutils\core.py", line 112, in setup
    _setup_distribution = dist = klass(attrs)
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\dis
t.py", line 222, in __init__
    for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 486, in iter_entry_points
    entries = dist.get_entry_map(group)
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2315, in get_entry_map
    self._get_metadata('entry_points.txt'), self
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2101, in parse_map
    raise ValueError("Entry points must be listed in groups")
ValueError: Entry points must be listed in groups

Error while installing python-memcache

C:\Users\Praful\Desktop\mem>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 24, in <module>
    "Topic :: Software Development :: Libraries :: Python Modules",
  File "C:\Python27\lib\distutils\core.py", line 112, in setup
    _setup_distribution = dist = klass(attrs)
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\dis
t.py", line 222, in __init__
    for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 486, in iter_entry_points
    entries = dist.get_entry_map(group)
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2315, in get_entry_map
    self._get_metadata('entry_points.txt'), self
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2101, in parse_map
    raise ValueError("Entry points must be listed in groups")
ValueError: Entry points must be listed in groups

回答1:


  1. Find get_entry_map(self, group=None): into python\Lib\sitepackages\pkg_resources\__init__.py. Insert after print self.egg_info
  2. Run python setup.py and look to the last printed - broken package. Remember it, later to install again. Delete the folder of broken package and folder broken_package-version.dist-info. Run again paragraph 2, until the error disappears.
  3. Remove changes from paragraph 1.
  4. python setup.py install 'broken_package'



回答2:


Could be a problem with distribute. I'd recommend re-installing Python.




回答3:


I found the same problem to be caused by a misfometted entry_points.txt file in one instelled egg of mine.

It can be quite hard to track down which one is if there are many.

I managed to find that little ba#@!"d by creating and run setup.py for a dummy package:

setup.py

from setuptools import setup, find_packages
setup(
    name = "IWillFindYou",
    version = "0.1",
    packages = find_packages()
)

run this in debug mode would point to this line in pkg_resources.py

    def parse_map(cls, data, dist=None):
        [...]
            raise ValueError("Entry points must be listed in groups")

if you go back to the stack trace, you will see that parse_map is called here:

def get_entry_map(self, group=None):
    [...]
        ep_map = self._ep_map = EntryPoint.parse_map(
            self._get_metadata('entry_points.txt'), self
        )

evaluating self.egg_info will point up your evil egg so you can give a look to the entry_points.txt file.

If you are not handy with debugger, you may try to place print self.egg_info in get_entry_map and look to the last guy printed.



来源:https://stackoverflow.com/questions/17985110/errors-while-installing-python-packages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!