---
title: "How to Fix Python Error ‘Can’t Instantiate Abstract Class’"
description: "Here are the reasons and resolution to fix the error Can't Instantiate Abstract Class in Python."
url: https://srinimf.com/2022/08/08/how-to-fix-python-error-cant-instantiate-abstract-class/
date: 2022-08-08
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2022/08/pexels-photo-5691630.jpeg?fit=1880%2C1256&ssl=1
categories: ["Python"]
tags: ["Python Abstract Class Error"]
type: post
lang: en
---

# How to Fix Python Error ‘Can’t Instantiate Abstract Class’

Here’s the fix for **can’t instantiate abstract class** error. Also explained the reason for it. A class that derives from the ABC class belonging to the ABC module is called an abstract class. ABC class a.k.a metaclass. Precisely, it is a class that defines the behavior of other classes. So a class that defines from ABC is called metatclass.

Related[How a MetaClass Works in Python and Real Usage](https://srinimf.com/2021/02/07/metaclasess-python2-vs-python3/)

[Jaw dropping deals from Zebronics](https://www.amazon.in/deal/22e73ee5?_encoding=UTF8&linkCode=r02&tag=srinimf-21&linkId=3ba80b0a1067c9ffc90ced585947d23c&ref_=ihub_rc_td_c_deals-promotions_22e73ee5)

## **Abstract Class**

There are two conditions to becoming an abstract class. One is to pass ‘ABC’ to a class, and it should have an ‘abstract method.’ An abstract method is a template, and concrete is a definition.

### Rules for Abstract class

- The objects of an abstract class cannot be created by PVM (python virtual machine).
- It is not mandatory to declare all the methods as abstract in an abstract class.
- The class must be abstract if there is any abstract method in a class.
- Defining the abstract methods of an abstract class must be in its child class/subclass.
- If any abstract class is inherited which have an abstract method, then either implementation of the method or making this class abstract must be provided.
- An abstract class can have an abstract method and a concrete method.

Related[How to Access Child-class Methods from Parent-class in Python](https://srinimf.com/2022/09/06/how-to-access-child-class-methods-from-parent-class-in-python/)

Advertisements

### Abstract class that threw error

```
from abc import ABC,abstractmethod

class one(ABC):
    @abstractmethod
    def move(self):
        pass
obj_one=one()
```

When you run this code, it throws an error – “TypeError: Can’t instantiate abstract class **one** with abstract methods **move**“

![TypeError: Can't instantiate abstract class one with abstract methods move
](https://i0.wp.com/srinimf.com/wp-content/uploads/2022/08/image.png?resize=1027%2C723&ssl=1)

## **The reasons for error**

The reason is abstract-method not implemented in the child class. So we got the error. Here’s the revised code, which fixes the error.

![Implementing the abstract method](https://i0.wp.com/srinimf.com/wp-content/uploads/2022/08/image-1.png?resize=1016%2C711&ssl=1)

The error ‘Can’t Instantiate Abstract Class’ is fixed and not displayed now.

Recommended books

- CFI’s all-access subscription (self-study and full-immersion)
- Object Oriented Programming with Python-3

Related posts

- [Exploring Python’s OOP Principles with Examples](https://srinimf.com/2022/01/30/how-to-say-about-python-oops-concepts/)DateJanuary 30, 2022
- [How to Access Child-class Methods from Parent-class in Python](https://srinimf.com/2022/09/06/how-to-access-child-class-methods-from-parent-class-in-python/)DateSeptember 6, 2022
- [Python Interview Questions: TechM & Synecron](https://srinimf.com/2024/09/12/python-interview-questions-techm-synecron/)DateSeptember 12, 2024

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2022%2F08%2F08%2Fhow-to-fix-python-error-cant-instantiate-abstract-class%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2022%2F08%2Fpexels-photo-5691630.jpeg%3Ffit%3D1200%252C802%26ssl%3D1&description=How%20to%20Fix%20Python%20Error%20%27Can%27t%20Instantiate%20Abstract%20Class%27)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2022/08/08/how-to-fix-python-error-cant-instantiate-abstract-class/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2022/08/08/how-to-fix-python-error-cant-instantiate-abstract-class/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2022/08/08/how-to-fix-python-error-cant-instantiate-abstract-class/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2022/08/08/how-to-fix-python-error-cant-instantiate-abstract-class/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20How%20to%20Fix%20Python%20Error%20%27Can%27t%20Instantiate%20Abstract%20Class%27&body=https%3A%2F%2Fsrinimf.com%2F2022%2F08%2F08%2Fhow-to-fix-python-error-cant-instantiate-abstract-class%2F&share=email)
-

### Like this:

Like Loading…
