Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: type object 'Distribution' has no attribute '_finalize_feature_opts' #2029

Closed
Pierre-Sassoulas opened this issue Mar 17, 2020 · 1 comment

Comments

@Pierre-Sassoulas
Copy link

Pierre-Sassoulas commented Mar 17, 2020

Hello,

I encounter the following problem after using the command: pip3 install -e ".[test]" -vvv. with setuptools 46.0.0. It seems very new because I did not have the problem on the same code 15 days ago, and also because there is nothing containing this error message when doing a web search. Reverting to an older version of setuptools (like 42.0.0, or 45.3.0) make the problem disapear.

Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-ephem-wheel-cache-j18ms5xi
Created temporary directory: /tmp/pip-req-tracker-ii4rcxhn
Initialized build tracking at /tmp/pip-req-tracker-ii4rcxhn
Created build tracker: /tmp/pip-req-tracker-ii4rcxhn
Entered build tracker: /tmp/pip-req-tracker-ii4rcxhn
Created temporary directory: /tmp/pip-install-nw20_kz_
Obtaining file:///home/pierre/PycharmProjects/project-name
  Added file:///home/pierre/PycharmProjects/project-name to build tracker '/tmp/pip-req-tracker-ii4rcxhn'
    Running setup.py (path:/home/pierre/PycharmProjects/project-name/setup.py) egg_info for package from file:///home/pierre/PycharmProjects/project-name
    Running command python setup.py egg_info
    Traceback (most recent call last):
      File "/home/pierre/PycharmProjects/project-name/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2454, in resolve
        return functools.reduce(getattr, self.attrs, module)
    AttributeError: type object 'Distribution' has no attribute '_finalize_feature_opts'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/pierre/PycharmProjects/project-name/setup.py", line 56, in <module>
        zip_safe=True,
      File "/home/pierre/PycharmProjects/project-name/venv/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.6/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/pierre/PycharmProjects/project-name/venv/lib/python3.6/site-packages/setuptools/dist.py", line 425, in __init__
        k: v for k, v in attrs.items()
      File "/usr/lib/python3.6/distutils/dist.py", line 281, in __init__
        self.finalize_options()
      File "/home/pierre/PycharmProjects/project-name/venv/lib/python3.6/site-packages/setuptools/dist.py", line 706, in finalize_options
        ep.load()(self)
      File "/home/pierre/PycharmProjects/project-name/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2446, in load
        return self.resolve()
      File "/home/pierre/PycharmProjects/project-name/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2456, in resolve
        raise ImportError(str(exc))
    ImportError: type object 'Distribution' has no attribute '_finalize_feature_opts'
Cleaning up...
Removed file:///home/pierre/PycharmProjects/project-name from build tracker '/tmp/pip-req-tracker-ii4rcxhn'
Removed build tracker: '/tmp/pip-req-tracker-ii4rcxhn'
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Here is part of my setup.py:

TEST_REQUIRES = ["pytest-cov"]
SETUPTOOLS = "setuptools~=42.2.0"

setuptools.setup(
    entry_points={
        "console_scripts": [
            "scriptname=namespace.file:run",
        ]
    },
    packages=setuptools.find_namespace_packages(),
    package_dir={},
    install_requires=[
        "beautifulsoup4",
        "fluidtopics>=0.2.0",
        "mammoth~=1.4.10",
        "lxml",
        "pypandoc==1.4",
    ],
    setup_requires=[SETUPTOOLS],
    tests_require=TEST_REQUIRES,
    extras_require={"test": TEST_REQUIRES, "setup": [SETUPTOOLS]},
    zip_safe=True,
)
@Pierre-Sassoulas
Copy link
Author

The problem came from the setup_requires=["setuptools~=42.2.0"], when using "setuptools~=46.0.0" locally. You can replace setup_requires=["setuptools~=42.2.0"], by setup_requires=["setuptools~=46.0.0"],.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant