Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error on "from trankit import Pipeline " #3

Closed
mzolfaghari opened this issue Jan 18, 2021 · 6 comments
Closed

error on "from trankit import Pipeline " #3

mzolfaghari opened this issue Jan 18, 2021 · 6 comments
Labels
good first issue Good for newcomers

Comments

@mzolfaghari
Copy link

Thanks for providing this great toolkit. But, I cannot import Pipeline and get the following error:
ImportError: cannot import name '_BaseLazyModule' from 'transformers.file_utils'

It could be because of the conflict in versions. When I did "pip install trankit", I got this error at the end:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
transformers 4.2.1 requires tokenizers==0.9.4, but you have tokenizers 0.9.3 which is incompatible.
Successfully installed tokenizers-0.9.3

I really appreciate your help on this.

@minhhdvn
Copy link
Collaborator

Hi @mzolfaghari,
Have you tried solving the conflict by installing the expected version for tokenizers?
To do it, you can use the command pip install tokenizers==0.9.4.
Please let us know if you can solve the problem.
Thanks

@mzolfaghari
Copy link
Author

Yes I tried that also. Then I get the following error:

Collecting tokenizers==0.9.4 Using cached tokenizers-0.9.4-cp38-cp38-manylinux2010_x86_64.whl (2.9 MB) Installing collected packages: tokenizers Attempting uninstall: tokenizers Found existing installation: tokenizers 0.9.3 Uninstalling tokenizers-0.9.3: Successfully uninstalled tokenizers-0.9.3 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. adapter-transformers 1.1.1 requires tokenizers==0.9.3, but you have tokenizers 0.9.4 which is incompatible.

@mzolfaghari
Copy link
Author

Ok. Problem solved. I've created a new environment and just installed python, torch and trankit. Now it's working. In previous environment, I had installed transformers too, which cause incompatibility.

@minhhdvn
Copy link
Collaborator

Hi @mzolfaghari,
Thanks for sharing it. We think this would be really useful for other users as well.

@jbrry
Copy link

jbrry commented May 18, 2021

Hi, I think there is currently some blocking issue with some of the current packages. I am getting an ImportError in a freshly installed environment. To reproduce:

conda create -n trankit python=3.7
conda activate trankit
pip install trankit==1.0.1

and then running my script which uses

import trankit
from trankit import Pipeline

# initialize a trainer for the task
trainer = trankit.TPipeline(
    training_config={
    'category': args.category,
    'task': args.task,
    'save_dir': args.save_dir,
    'train_txt_fpath': args.train_txt,
    'train_conllu_fpath': args.train_conllu,
    'dev_txt_fpath': args.dev_text,
    'dev_conllu_fpath': args.dev_conllu
    }
)

results in the error:

Traceback (most recent call last):
  File "scripts/trankit.py", line 2, in <module>
    import trankit
  File "/home/jbarry/IWPT-2021-shared-task/scripts/trankit.py", line 3, in <module>
    from trankit import Pipeline
ImportError: cannot import name 'Pipeline' from 'trankit' (/home/jbarry/IWPT-2021-shared-task/scripts/trankit.py)

EDIT: I'd be happy to work with an existing environment from a pip freeze if anyone has a working environment.

@Ramyavs1291
Copy link

Ok. Problem solved. I've created a new environment and just installed python, torch and trankit. Now it's working. In previous environment, I had installed transformers too, which cause incompatibility.

Can you provide details on new environmen setup . i am a beginner and i face same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants