ImportError: cannot import name 'pipeline' from 'transformers' (unknown location)
Hi, I created an env with conda, installed TF, then installed PyTorch, then "pip install git+https://github.com/huggingface/transformers", but when I ran 'python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I hate you'))"', it gave me the ImportError. How can I resolve this?
I'm on MacOS btw.<|||||>Possibly duplicate of https://github.com/huggingface/transformers/issues/9939<|||||>> Possibly duplicate of https://github.com/huggingface/transformers/issues/9939

I have installed TF 2.0 right at the start. Is there a version to update to resolve this error?<|||||>So after install TF 2.0 with conda, I performed pip install --upgrade tensorflow to v2.4.1 and it works now.<|||||>The issue happens again with latest version of tensorflow and transformers.

`>>> import transformers`
`>>> from transformers import pipeline`
`Traceback (most recent call last):`
 ` File "<stdin>", line 1, in <module>`
`ImportError: cannot import name 'pipeline' from 'transformers' (unknown location)`
`>>> tensorflow.__version__`
`'2.5.0'`
`>>> transformers.__version__`
`'4.7.0'`<|||||>I had the same problem but used the false transformer:
**Initial**
`conda update -c conda-forge transformers`

**Before**
> tensorflow.__version__      # '2.3.0'
> transformers.__version__  # '2.1.1'

**Solution**
`conda install -c huggingface transformers `

**After**
> tensorflow.__version__      # '2.3.0'
> transformers.__version__  # '4.11.3'
> torch.__version__              # '1.10.0'

<|||||>It is related to the solution. I have to solve it by explicit stating the version. Otherwise, it keep installing the conda-forge version.

`conda install -c huggingface transformers =4.11.3`<|||||>What is your python files name? Mine was _tokenizers_ and when I changed it to _use_tokenizers_ it works. Maybe using names like "tokenizers", "pipeline" for files not the best idea.<|||||>> What is your python files name? Mine was _tokenizers_ and when I changed it to _use_tokenizers_ it works. Maybe using names like "tokenizers", "pipeline" for files not the best idea.

I made the mistake of calling mine tokenize.py - once changed the code worked. 