[Solved] AttributeError: module ‘setuptools._distutils’ has no attribute ‘version’

Hello readers, Today In this article I am going to show you how to Solve – AttributeError: module ‘setuptools._distutils’ has no attribute ‘version’ error in Python. So here I will explain all the possible solutions.

Without wasting your time, Let’s start This Article to Solve This Error.

How AttributeError: module ‘setuptools._distutils’ has no attribute ‘version’ Error Occurs?

This is a common error in Python. When I am trying to train a model using tensorboard. but, Unfortunately I am facing following error. It looks as like below:

AttributeError: module 'setuptools._distutils' has no attribute 'version'

So here are all the possible solutions that I tried to fix this error.

How To Solve AttributeError: module ‘setuptools._distutils’ has no attribute ‘version’ Error?

  • How To Solve AttributeError: module ‘setuptools._distutils’ has no attribute ‘version’ Error?

To Solve AttributeError: module ‘setuptools._distutils’ has no attribute ‘version’ Error You Just need to downgrade setuptools to 59.5.0 version. And Now, Your error must be solved. First of all Just install setuptools with help of this command: pip uninstall setuptools Then run this command to install setuptools 59.5.0. For Python 3: python3 -m pip install setuptools==59.5.0 For Python 2 python2 -m pip install setuptools==59.5.0 Now, Your error must be solved.

  • AttributeError: module ‘setuptools._distutils’ has no attribute ‘version’

To Solve AttributeError: module ‘setuptools._distutils’ has no attribute ‘version’ Error If You are using pytorch and You are facing this error then You should try to use nightly-release of PyTorch. Now, Your error should be solved.

Solution 1: downgrade setuptools

You Just need to downgrade setuptools to 59.5.0 version. And Now, Your error must be solved. First of all Just install setuptools with help of this command.

pip uninstall setuptools

Then run this command to install setuptools 59.5.0.

For Python 3

python3 -m pip install setuptools==59.5.0

For Python 2

python2 -m pip install setuptools==59.5.0

Now, Your error will be solved.

Solution 2: Use nightly-release of PyTorch

If You are using pytorch and You are facing this error then You should try to use nightly-release of PyTorch. Now, Your error should be solved.

Conclusion

In this article, we have discussed what causes the error and we have discussed ways to fix the error.

we hope this article has been informative. Thank you for reading. Kindly comment and let us know if you found it helpful.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Categories