Cannot import Pennylane - ImportError: cannot import name 'dataclass_transform' from 'typing_extensions'

I can’t seem to import pennylane. I tried all my IDE’s and they all give me the same long error. I consulted chatGPT about what it could be but just told me to make sure a bunch of stuff was up to date, which it was. I installed pennylane today using pip. Any help or insight would be immensely appreciated!

ImportError                               Traceback (most recent call last)
<ipython-input-20-45f1fb5914cd> in <module>
      1 import numpy as np
----> 2 import pennylane as qml

~\anaconda3\lib\site-packages\pennylane\ in <module>
    130 import pennylane.logging  # pylint:disable=wrong-import-order
--> 132 import
    134 # Look for an existing configuration file

~\anaconda3\lib\site-packages\pennylane\data\ in <module>
    195 """
--> 197 from .attributes import (
    198     DatasetArray,
    199     DatasetDict,

~\anaconda3\lib\site-packages\pennylane\data\attributes\ in <module>
     16 from .array import DatasetArray
---> 17 from .dictionary import DatasetDict
     18 from .json import DatasetJSON
     19 from .list import DatasetList

~\anaconda3\lib\site-packages\pennylane\data\attributes\ in <module>
     22 from import DatasetAttribute
     23 from import HDF5Any, HDF5Group
---> 24 from import MapperMixin
     25 from import T

~\anaconda3\lib\site-packages\pennylane\data\base\ in <module>
     17 from .attribute import AttributeInfo, DatasetAttribute
---> 18 from .dataset import Dataset, field
     19 from .mapper import DatasetNotWriteableError

~\anaconda3\lib\site-packages\pennylane\data\base\ in <module>
     38 # pylint doesn't think this exists
---> 39 from typing_extensions import dataclass_transform  # pylint: disable=no-name-in-module
     41 from import hdf5

ImportError: cannot import name 'dataclass_transform' from 'typing_extensions' (C:\Users\James\anaconda3\lib\site-packages\

Hey @PulsarDude! Welcome to the forum :smiley:

I recommend trying to install PennyLane on a fresh environment. I see that you’re using Conda, so you can create a virtual environment with conda with help from that link. Once you create a “blank-slate” environment, try installing PennyLane again.

Let me know if that helps!

1 Like

Works perfectly now! Thanks a million!

1 Like

Awesome! Glad I was able to help :slight_smile: