20

I am trying to remove accents from a Python list of strings by converting it from UTF-8 to ASCII. I have read answers to multiple questions here in StackOverflow that suggest using the unidecode function from the unidecode package. I have installed it using conda but if I write

import unidecode

I get

ModuleNotFoundError: No module named 'unidecode'

I have tried excluding unidecode and reinstalling it (using both conda and pip) and I checking if the PATH was pointing to all Anaconda locations, as advised in Alexander McFarlane's answer to this question.

Felipe Ito
  • 237
  • 1
  • 2
  • 5

3 Answers3

29

I had the same problem, capitalizing Unidecode in the pip command worked for me.

pip install Unidecode

https://pypi.org/project/Unidecode/

Natalie Olivo
  • 439
  • 4
  • 11
  • Worked for me with the lowercase version: pip install unidecode – ling Mar 31 '23 at 08:37
  • Didn't work for me with either case. ........................ I even have it working fine in another environment. ........................ 45 minutes down the tube, I give up. Neither conda nor pip can install it correctly using either upper or lower case, on a brand new environment. There's a point where blame should be placed on the package creator. – ClioCJS May 28 '23 at 18:42
2

follow steps

1.open cmd

2.give full path to the script folder e.g.

C:\Python37-32\Scripts

3.then try pip commands

pip install Unidecode

C:\Python37-32\Scripts>pip install unicode

done!

Mayur Satav
  • 985
  • 2
  • 12
  • 32
1

Make sure you are using the same version of Python when you install the package and when you run it. You are probably installing the library in one version and running using a different version.

You can check the python version in terminal this way:

python3 --version

Also try to create and work on an environment, install your packages in the environment then try to run.

Read more about package managment in Conda since you use it https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

David Sidarous
  • 1,202
  • 1
  • 10
  • 25