No module named 'gluonts.trainer' - python

!pip install gluonts
!pip install atspy
!pip install gluonts
from gluonts.mx.trainer import Trainer
from mxnet import gluon
from gluonts.trainer import Trainer
from atspy import AutomatedModel
However, it gives me an error:
ModuleNotFoundError Traceback (most recent call
last) in
4 from gluonts.mx.trainer import Trainer
5 from mxnet import gluon
----> 6 from gluonts.trainer import Trainer
7 from atspy import AutomatedModel
ModuleNotFoundError: No module named 'gluonts.trainer'
I have no ideas how to solve this. If anyone has any ideas

In the source code, I couldn't find gluonts.trainer either. Are you sure that you need line 6?
In my case, from gluonts.mx.trainer import Trainer was sufficient. (though I only needed to use gluonts once).

Related

No module named 'torcheval'

I am trying this on Kaggle:
from torcheval.metrics.functional import binary_f1_score
metric = binary_f1_score
And i get an Error:
ModuleNotFoundError Traceback (most recent call last)
/tmp/ipykernel_28/3857382439.py in <module>
----> 1 from torcheval.metrics.functional import binary_f1_score
2 metric = binary_f1_score
3 model_no_CV = unet_1D().to(device)
4 optimizer = torch.optim.Adam(unet_1D.parameters(), lr=0.001)
5 epochs_num = 30
ModuleNotFoundError: No module named 'torcheval'
I tried to install the latest version of torch, didn't help
Other torch modules seem to work correctly
You have to install torcheval library in Kaggle. First of all make sure your internet option is enable to use the kernel then you can try this command:
!pip install torcheval

ImportError: cannot import name 'RasaNLUConfig' from 'rasa_nlu.config' in Google Colaboratory

I'm trying to make a NLU model. When I run
from rasa_nlu.config import RasaNLUConfig
I get an error:
ImportError Traceback (most recent call last)
<ipython-input-1-c2bca1b53b6f> in <module>
----> 1 from rasa_nlu.config import RasaNLUConfig
2 from rasa_nlu.model import Trainer
ImportError: cannot import name 'RasaNLUConfig' from 'rasa_nlu.config' (/usr/local/lib/python3.7/dist-packages/rasa_nlu/config.py)
I thought, "Meh,not a big issue, Colaboratory just hasn't got Rasa installed by default, I'll just install it".
So when I installed it with !pip install rasa_nlu, it did everything, and then it told me to restart the runtime and gave me a button to do that. I did that, then I ran from rasa_nlu.config import RasaNLUConfig and I still get the same error:
ImportError: cannot import name 'RasaNLUConfig' from 'rasa_nlu.config'
I am not familiar with !apt so I don't know how I'm supposed to install Rasa with that. Will the problem be solved with that? Or is it something else?
Looks like I was using a newer version of rasa_nlu (0.15.1). The tutorial I was following used 0.11.3. In 0.11.3, RasaNLUConfig was located at from rasa_nlu.config. But in 0.15.1, it was someplace else.
So... that's solved!

sonnet import fails on: 'from graphs import Sonnet'

Trying to run some github code which imports 'sonnet' which seems to import other packages from 'graphs'. I get:
----> 9 import sonnet as snt
~\Anaconda3\lib\site-packages\sonnet\__init__.py in <module>()
1 __version__ = '0.1.6'
----> 2 from graphs import Sonnet, D3Graph, MatplotGraph
ImportError: cannot import name 'Sonnet'
I've explicitly installed and imported 'graphs', but failed with the same error when explicitly tried to:
----> 1 from graphs import Sonnet
ImportError: cannot import name 'Sonnet'
Any advice?
Environment: Jupyter Notebook, python 3.6.5, Anaconda, windows
Try this.
pip uninstall sonnet;
pip install dm-sonnet

Import skflow on a Windows machine

I am trying to import skflow on my Windows PC. I have already install and used Anaconda on Python (3.5). I have no trouble to use tensorflow but when I want to use skflow I get the error:
ImportError Traceback (most recent call last)
<ipython-input-1-04faecc7c0de> in <module>()
8 import tensorflow as tf
9 from tensorflow.contrib import learn
---> 10 from tensorflow.contrib import skflow
ImportError: cannot import name 'skflow'
Does anyone know how to fix this?
Thanks in advance!
Please try this:
>>> import tensorflow as tf
>>> from tensorflow.contrib import learn as skflow
FYI, skflow is not any special package/module/... It's an alias for tensorflow.contrib.learn which is in 'sklearn' style.

ImportError: cannot import name murmurhash3_32

I am trying to use the sklearn.qda package in python. I have installed it successfully but when Itry to import it I get the error message below. Can anybody tell me what should I do to fix this?
In [3]: from sklearn.qda import QDA
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-7d7abf937d66> in <module>()
----> 1 from sklearn.qda import QDA
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/qda.py in <module>()
12
13 from .base import BaseEstimator, ClassifierMixin
---> 14 from .utils.fixes import unique
15 from .utils import check_arrays, array2d
16
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/utils/__init__.py in <module>()
7 import warnings
8
----> 9 from .murmurhash import murmurhash3_32
10 from .validation import (as_float_array, check_arrays, safe_asarray,
11 assert_all_finite, array2d, atleast2d_or_csc,
ImportError: cannot import name murmurhash3_32
I had the same problem, I run:
sudo pip install -U scikit-learn
and now everything is working fine
I started a new shell and this problem went away
I faced the similar situation of getting mumurhash error while installing sklearn.preprocessing library.
I upgraded numpy version from 1.13 to 1.15
using
pip install --upgrade numpy
After this, I was able to import the sklearn library.
I fixed this by upgrading murmurhash to 1.0.5.
I faced a similar problem, so there are mainly two solutions
Either run it in administrator mode and install all the libraries and run in admin mode. Something that I would not recommend
Use virtualenv to install the libraries again and run your command in the virtualenv. This worked for me.
Hope this helps

Categories

Resources