from simpletransformers.language_modeling import LanguageModelingModel NOT WORKING - python

I have installed simpletransformers with success. Why is it not working? A big thank you in advance.
from simpletransformers.language_modeling import LanguageModelingModel
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-9-eb4f4fd6459f> in <module>
----> 1 from simpletransformers.language_modeling import LanguageModelingModel
~\anaconda3\lib\site-packages\simpletransformers\language_modeling\__init__.py in <module>
----> 1 from simpletransformers.config.model_args import LanguageModelingArgs
2 from simpletransformers.language_modeling.language_modeling_model import LanguageModelingModel
~\anaconda3\lib\site-packages\simpletransformers\config\model_args.py in <module>
6 import warnings
7
----> 8 from torch.utils.data import Dataset
9
10
ModuleNotFoundError: No module named 'torch'

I answered my own question with "pip install torch" and updated the Microsoft C++ reading software. :)))

Related

ImportError loading spacy in jupyter notebook(ubuntu)

I got a problem I can't seem to figure out. The first time I imported Spacy into a Jupyter notebook I had no problems. It just imported it as I expected.
import spacy
nlp = spacy.load('en_core_web_sm')
i tried
import sys
print(sys.executable)
and i got this error
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-21-e4c801bd61f2> in <module>
----> 1 import spacy
2 nlp = spacy.load('en_core_web_sm')
~/Downloads/PREFIX=/home/khbe0387/anaconda3/lib/python3.8/site-packages/spacy/__init__.py in <module>
9
10 # These are imported as part of the API
---> 11 from thinc.api import prefer_gpu, require_gpu, require_cpu # noqa: F401
12 from thinc.api import Config
13
ImportError: cannot import name 'prefer_gpu' from 'thinc.api' (/home/khbe0387/Downloads/PREFIX=/home/khbe0387/anaconda3/lib/python3.8/site-packages/thinc/api.py)

import fancyimpute Runtime and ImportError

I tried
pip install tensorflow
it says it is incompatible with my numpy version(1.20.0)
Then I tried unistall numpy to required version numpy~=1.19.2
Then
pip install fancyimpute
It installed without any errors in AnacondaPromt
But it still not working in Jupyter Notebook
The Error is
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-34-e68ac4972d28> in <module>
16 import tensorflow as tf
17 import numpy.core.multiarray
---> 18 from fancyimpute import KNN
~\anaconda3\lib\site-packages\fancyimpute\__init__.py in <module>
2
3 from .solver import Solver
----> 4 from .nuclear_norm_minimization import NuclearNormMinimization
5 from .matrix_factorization import MatrixFactorization
6 from .iterative_svd import IterativeSVD
~\anaconda3\lib\site-packages\fancyimpute\nuclear_norm_minimization.py in <module>
11 # limitations under the License.
12
---> 13 import cvxpy
14
15 from .solver import Solver
~\anaconda3\lib\site-packages\cvxpy\__init__.py in <module>
16
17 __version__ = "1.1.10"
---> 18 from cvxpy.atoms import *
19 from cvxpy.constraints import NonPos, Zero, SOC, PSD
20 from cvxpy.expressions.expression import Expression
~\anaconda3\lib\site-packages\cvxpy\cvxcore\python\__init__.py in <module>
1 # TODO(akshayka): This is a hack; the swig-auto-generated cvxcore.py
2 # tries to import cvxcore as `from . import _cvxcore`
----> 3 import _cvxcore
ImportError: numpy.core.multiarray failed to import
I had the same issue and I upgraded NumPy by running pip install numpy --upgrade. It worked around for me.
I found a solution right here
Opencv/numpy issue: "module compiled against API version X but this version of numpy is Y"
Here is the table and since my version is 1.19.5(0xd) now,
I uninstalled this version and installed 0xe version of numpy which is 1.20.0.

Python "Import missingno" results in "ImportError: attempted relative import with no known parent package"

I am using jupyter nb running python 3.9.1 using pip to install modules etc.
All imports work smoothly except missingno.
All the modules being imported are located in the same location Python39\lib\site-packages but missingno results in Import Error.
The missingno module had been imported and it has run smoothly before but after a kernel restart, the Import Error cropped up.
ImportError Traceback (most recent call last)
<ipython-input-16-fad26a6fb4fe> in <module>
6 #Visualization
7 import matplotlib.pyplot as plt
----> 8 import missingno
9 import seaborn as sns
10 plt.style.use('seaborn-whitegrid')
~\AppData\Local\Programs\Python\Python39\Lib\site-packages\missingno\missingno.py in <module>
6 import seaborn as sns
7 import pandas as pd
----> 8 from .utils import nullity_filter, nullity_sort
9 import warnings
10
ImportError: attempted relative import with no known parent package
How to fix it?
I have tried to delete the missingno files and reinstalling it using pip install missingno but nothing works.
Running Python in shell and importing missingno, I still get the same error. There is nothing fancy in my code, a simple, generic import which showed no signs of error before kernel restart.
>>> import missingno
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\OK\AppData\Local\Programs\Python\Python39\Lib\site-packages\missingno\missingno.py", line 8, in <module>
from .utils import nullity_filter, nullity_sort
ImportError: attempted relative import with no known parent package
Try opening the missingno.py file in site-packages.
Change
from .utils import nullity_filter, nullity_sort
to
from utils import nullity_filter, nullity_sort

Folium Problem: "No module named 'folium.map'; 'folium' is not a package"

A few days ago Folium was working perfectly, but now it's not working. The problem:
import folium
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-10-173c1173bf1c> in <module>
----> 1 import folium
~\folium.py in <module>
13 from branca.element import CssLink, Element, Figure, JavascriptLink, MacroElement
14
---> 15 from folium.map import FitBounds
16 from folium.raster_layers import TileLayer
17 from folium.utilities import _parse_size, _tmp_html, _validate_location
ModuleNotFoundError: No module named 'folium.map'; 'folium' is not a package
Even installing by pip and conda doesn't matter library.

How to import TimeSeriesNet() from nnet-ts in mac ox?

I have installed nnet-ts in mac using
pip install nnet-ts
All the dependency libraries are already installed. But while importing module nnet_ts
from nnet_ts import *
following error is generated
ModuleNotFoundError Traceback (most recent
call last)
<ipython-input-7-ad5e84de7763> in <module>
----> 1 from nnet_ts import *
2 count=0
3 ahead=12
4 pred=[]
~/anaconda3/lib/python3.6/site-packages/nnet_ts/__init__.py in <module>
5 from keras.layers.core import Dense, Activation, Dropout
6 from sklearn.preprocessing import StandardScaler
----> 7 from TimeSeriesNnet import TimeSeriesNnet
ModuleNotFoundError: No module named 'TimeSeriesNnet'
I try to figure out from this thread Using the TimeSeriesNnet() method from the nnet_ts module throws NameError
but does not work for MAC. How can we solve this problem in MAC OX?

Categories

Resources