In Google colab I am to trying import BucketIterator using:
from allennlp.data.iterators import BucketIterator
But it is raising the same error again and again-
ModuleNotFoundError: No module named 'allennlp.data.iterators
After installing allennlp with the imports:
from allennlp.data.token_indexers import TokenIndexer, SingleIdTokenIndexer
from allennlp.data.tokenizers.character_tokenizer import CharacterTokenizer
from allennlp.data.vocabulary import Vocabulary
from allennlp.modules.seq2vec_encoders import PytorchSeq2VecWrapper
are working fine. Is there a way to solve this issue?
I was facing the same issue.
It won't work, since Iterators are removed from allennlp.
Install a legacy version of allennlp. allennlp is depended upon the PyTorch(torchtext) library. And since torchtext removed iterators form their newer versions allennlp did it too.
You can directly use torchtext.data.BucketIterator(). Use:
pip install torchtext==0.5.0 --user
Related
Greeetings,
per instructions for IPython, I am supposed to be able to run this import when coding:
from IPython.lib.security import passwd_check
I have IPython 8.8.0 installed as part of a jupyter install.
however, when I attempt to run this library, it reports:
ModuleNotFoundError: No module named 'IPython.lib.security'
what am I missing?
THanks
It looks to me that the IPython.lib.security is not present anymore in version 8.x.
If you are using version 7x you should be able to import it with.
I was able to import successfully:
from IPython.lib.security import passwd_check
on my 7.x version
IPython.__version__
'7.25.0'
if you want to lower version you can try:
%pip install IPython==7.25.0
I am working at blender script, where I want to use YAML. So I try to import it:
from pydantic import BaseModel
from pydantic_yaml import YamlModel
But when I run my script, this error will occure:
ImportError: cannot import name 'YamlModel' from 'pydantic_yaml' (C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages\pydantic_yaml\__init__.py)
I have installed pydantic and pydantic_yaml on both Pythons (Blender one and the common one), if they wouldn't be installed, there would be different error. I tried googling, but google had very few results for this problem. Also, when I open that __init__.py file, there is clearly YamlModel. Thank you for any kind of help.
I found the same error and it is related how pydantic-yaml got installed.
There is a bug in the package. you need to install optional dependencies as well (so called extras).
pip install pedantic-yaml[pyyaml,ruamel]
or manually install pyyaml ruamel please make sure that that Taumel version is <=0.18
I am installing the package for data-cleaning purpose,
!pip install tweet-preprocessor
from preprocessor import TwitterPreprocessor
I am using both Jupyter and Colab, there is no issue using in Jupyter. But still, receiving this issue in colab:
ImportError: cannot import name 'TwitterPreprocessor' from 'preprocessor' (/usr/local/lib/python3.7/dist-packages/preprocessor/init.py)
Please help me with this problem to correct.
Thank you
The library tweet-preprocessor simply doesn't have the TwitterPreprocessor you're trying to import. Take a look at the GitHub repo - no TwitterPreprocessor in sight.
It's suggested to import it via: import preprocessor as p (or import one of the said names from the GitHub repo). You can look at the __init__.py what names you're able to import.
ImportError: cannot import name 'TwitterPreprocessor' from 'preprocessor' ([...]\preprocessor\_init_.py)
I have the following versions of mxnet==1.4.0 and gluonnlp==0.9.1 installed using pip.
However when I run the following codeimport gluonnlp as nlp it yields the following error
ModuleNotFoundError: No module named 'mxnet.contrib.amp'
So I try to manually import the missing module using
from mxnet.contrib import amp
import gluonnlp as nlp
which also yields an error
ImportError: cannot import name 'amp' from 'mxnet.contrib' (/usr/local/lib/python3.7/dist-packages/mxnet/contrib/__init__.py)
I've been running the code on Colab. Is there a possible workaround for this issue?
Please Advise.
I have not used these libraries but in this github issue they say:
AMP was introduced in MXNet 1.5. Could you try that version (or newer)?
So I think that the problem is there.
Cheers!
In python3.6, when executing the following command:
from sklearn.model_selection import GridSearchCV
Reported Error:
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
However, issue is that I don't have root access to machine to use the solutions posted on the same issue on stackoverflow.
On trying to locate libbz2.so, I received following:
/usr/lib64/libbz2.so.1
/usr/lib64/libbz2.so.1.0.6
To be noted: in my bash_profile the LIBRARY_PATH did not have '/usr/lib64' explicitly specified when I compiled python3.6 from source.
bz2 is an optional dependency of python, but sklearn assumes your python installation has this module.
There are at least two possible ways to fix this:
update your version of joblib to make its dependence on bz2 optional. (Thanks to sascha for pointing this out.)
or, install libbz2 and then re-build python3.6.