dataclass_transform() got an unexpected keyword argument 'field_specifiers'

Question:

I am trying to work with this G2P package. But I am getting dataclass_transform() got an unexpected keyword argument 'field_specifiers' this error. I am trying to run their sample code that they have provided there after running !pip install g2p_en in my jupyter notebook. The sample code for which I am getting the error is attached below. Can someone please help me with the issue?

from g2p_en import G2p

texts = ["I have $250 in my pocket.", # number -> spell-out
         "popular pets, e.g. cats and dogs", # e.g. -> for example
         "I refuse to collect the refuse around here.", # homograph
         "I'm an activationist."] # newly coined word
g2p = G2p()
for text in texts:
    out = g2p(text)
    print(out)
Asked By: Turing101

||

Answers:

Install the package from the anaconda base location (assuming you are using anaconda for jupyter notebook) with this command

conda install -c conda-forge g2p-en

Then simply import from g2p_en import G2p and run the example code. For me it did the job. There are various dependencies on anaconda base level which are not fully satisfied when you install the package from the jupyter lab only. You need to install from anaconda base location sometimes to make it work.

Answered By: Turing101

If you get this error for other libraries, you can look for the listed import headers in the error messages, and then:

pip uninstall somelibrary

And then

conda install somelibrary

If it fails, a reinstall might work, hopefully by now with other dependencies:

pip install somelibrary

Answered By: dagelf
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.