TypeError: dist must be a Distribution instance

半世苍凉 提交于 2019-12-04 02:42:31

This error has to do with a discrepancy between the versions of distutils and setuptools installed on your machine. Upgrading setuptools to the current version is likely to resolve the issue.

EDIT: This solution no longer works for me (and apparently never worked for Jens -- see comment below). What now works for me is to import setuptools before anything else in whatever script I'm calling that leads to this error.

This error is discussed in many issues on GitHub, in many packages, but I find this discussion to be the most informative.

install dnspython. pip install dnspython. Or check if u have older version of dnspython and upgrade

The only way I was able to solve it was to follow the https://bugs.python.org/file37554/distutils_accomodate_distribution_ducktypes.patch So - I removed /usr/lib/python2.7/distutils/cmd.py and /usr/lib/python2.7/distutils/cmd.pyc ( ran a python setup.py develop - just to make sure it fails and is not using the pyc from somewhere else ) and then recreated /usr/lib/python2.7/distutils/cmd.py - only this time with the changes as shown in the patch. Then when I used python setup.py again - it worked..

Try using pip for installing your package

$ pip install -e path/to/your/Project

See http://pip.readthedocs.org/en/latest/reference/pip_install.html#editable-installs for more information.

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