5

I'm currently creating a python library and need to use the 'find_namespace_packages' from the 'setuptools' package. However python throwing out the following ImportError message whenever it runs:

ImportError: cannot import name 'find_namespace_packages' from 'setuptools'

However it has no trouble importing the other functions from 'setuptools' like 'setup' and 'find_packages'.

How do I troubleshoot it?

I have uninstalled and reinstalled 'setuptools' multiple times already and updated Spyder and Anaconda.

Also here is a sample of my code:

from setuptools import setup, find_namespace_packages

setup(

      name="sample",

      version="0.0.1",

      packages=find_namespace_packages()

      )

I am currently using Python 3.7.5 and setuptools is on version 49.6.0

2
  • 2
    Something wrong with package, try to run pip install -U setuptools. Commented Aug 28, 2020 at 6:53
  • Maybe you are using another python interpreter accidentally ? find_namespace_packages() was introduced with version v40.1.0 of setuptools Commented Aug 28, 2020 at 7:00

1 Answer 1

5

As mentioned in the question's comments, the solution is to run

pip install -U setuptools

And afterwards retry installing all the packages, e.g.

pip install -e .

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.