nidhaloff / deep-translator

A flexible free and unlimited python tool to translate between different languages in a simple way using multiple translators.
https://deep-translator.readthedocs.io/en/latest/?badge=latest
Apache License 2.0
1.58k stars 180 forks source link

Help! I cannot install the AI attachment for deep translator in pip3 #223

Closed xuckless closed 1 year ago

xuckless commented 1 year ago

Description

I cannot install the ai support for deep-translator as displayed in the documentation. I am new to coding, so I might have messed the process up somewhere, please help.

What I Did

I ran the command with pip3 instead of the normal pip in the documentation on my Mac terminal.

The command I ran in Terminal:

$ pip3 install deep-translator[ai]

Output:

zsh: no matches found: deep-translator[ai]

I am also adding python traceback from the python code that I ran:

Traceback (most recent call last):
  File "/Users/a/personal-projects/mtl/translate.py", line 26, in <module>
    translate = ChatGptTranslator(api_key='key-hidden', target='english').translate(content)
  File "/Users/a/Library/Python/3.9/lib/python/site-packages/deep_translator/chatgpt.py", line 43, in translate
    import openai
ModuleNotFoundError: No module named 'openai'
xuckless commented 1 year ago

Update:

Not only AI, I cannot install any attachments (docx, pdf) in pip3. All the commands are returning the same aforementioned output.

Inputs:

$ pip3 install deep-translator[docx]
$ pip3 install deep-translator[pdf]

Outputs:

zsh: no matches found: deep-translator[docx]
zsh: no matches found: deep-translator[pdf]
nidhaloff commented 1 year ago

@xuckless I think this is related to the type of shell you are using (which is zsh in this case), Just try to add quotes pip3 install 'deep-translator[ai]'

If you want a permanent solution without using the quotes, probably adding alias pip='noglob pip' to your .zshrc should work

xuckless commented 1 year ago

Thankyou for your help! It works now.