No module named 'vis_utils' - python

import torch
import torch.nn as nn
import torchvision.datasets as dsets
from skimage import transform
import torchvision.transforms as transforms
from torch.autograd import Variable
import pandas as pd
import numpy as np
from torch.utils.data import Dataset, DataLoader
from vis_utils import *
import random
import math
I am getting the error below:
ModuleNotFoundError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_10608/4005546520.py in <module>
8 import numpy as np
9 from torch.utils.data import Dataset, DataLoader
---> 10 from vis_utils import *
11 import random
12 import math
ModuleNotFoundError: No module named 'vis_utils'

You probably have to install the vis_utils module https://www.npmjs.com/package/vis-utils

Related

No module named 'sklearn.neighbors.base' still existed after all the suggestions what I can take

I learned a lot of solutions from this website, but still cannot solve the problem. My code is as follows for your review:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import missingno as msno
import altair as alt
from statsmodels.graphics.mosaicplot import mosaic
from scipy.stats import chi2_contingency
import plotly.express as px
from pandas.plotting import parallel_coordinates
from wordcloud import WordCloud
import networkx as nx
from networkx.drawing.nx_agraph import graphviz_layout
from scipy.spatial import distance
!pip install sklearn
from sklearn.experimental import enable_iterative_imputer
from sklearn.impute import IterativeImputer
from sklearn.impute import KNNImputer
from missingpy import MissForest
import sklearn.neighbors._base
sys.modules['sklearn.neighbors.base'] = sklearn.neighbors._base
import warnings
warnings.filterwarnings("ignore")
And still shows the error: ModuleNotFoundError: No module named 'sklearn.neighbors.base' I've tried to do the follows:
pip install -U imbalanced-learn ;
pip install -U scikit-learn
ans there was still of no use
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_11280/2643854484.py in <module>
26 from sklearn.impute import IterativeImputer
27 from sklearn.impute import KNNImputer
---> 28 from missingpy import MissForest
29 import sklearn.neighbors._base
30 sys.modules['sklearn.neighbors.base'] = sklearn.neighbors._base
C:\ProgramData\Anaconda3\lib\site-packages\missingpy\__init__.py in <module>
----> 1 from .knnimpute import KNNImputer
2 from .missforest import MissForest
3
4 __all__ = ['KNNImputer', 'MissForest']
C:\ProgramData\Anaconda3\lib\site-packages\missingpy\knnimpute.py in <module>
11 from sklearn.utils.validation import check_is_fitted
12 from sklearn.utils.validation import FLOAT_DTYPES
---> 13 from sklearn.neighbors.base import _check_weights
14 from sklearn.neighbors.base import _get_weights
15
ModuleNotFoundError: No module named 'sklearn.neighbors.base'
Finally, I solved the problem!!
I should write this before import missingpy, not behind it.
import sklearn.neighbors._base
import sys
sys.modules['sklearn.neighbors.base'] = sklearn.neighbors._base
from missingpy import MissForest
done.

Scipy cannot import median_abs_deviation

I'm using a program called galpro which uses may packages, including scipy. When I use the command
import galpro as gp
I am then given the error:
ImportError Traceback (most recent call last)
<ipython-input-7-6eb7571a326c> in <module>
----> 1 import galpro as gp
~/galpro/galpro/__init__.py in <module>
----> 1 from .model import Model
~/galpro/galpro/model.py in <module>
8 import joblib
9 import h5py
---> 10 from .validation import Validation
11 from .plot import Plot
12 from .utils import convert_1d_arrays, create_directories
~/galpro/galpro/validation.py in <module>
2 import numpy as np
3 import h5py
----> 4 from .plot import Plot
5 from .utils import load_posteriors, create_templates
6 from .conf import set_plot_params
~/galpro/galpro/plot.py in <module>
4 import seaborn as sns
5 import statsmodels.api as sm
----> 6 from .utils import *
7 from .conf import set_plot_params
8
~/galpro/galpro/utils.py in <module>
3 import h5py
4 import numpy as np
----> 5 from scipy.stats import entropy, kstest, median_abs_deviation, cramervonmises
6
7
ImportError: cannot import name 'median_abs_deviation' ---------------------------------------------------------------------------
I have tried reinstalling scipy and this didn't help. According to documentation, the median_abs_deviation module should work with scipy 1.3.0 onwards, and I'm using 1.5.4. I have also tried reinstalling different versions of scipy and this has not helped either.

cannot import name 'asanyarray'

I'm currently having trouble importing some simple packages.
I'm working on pycharm professional in a virtual environment.
just trying to load;
import pandas as pd
import numpy as np
from sklearn.ensemble import IsolationForest
from sklearn.ensemble._iforest import _average_path_length
import shap
importError Traceback (most recent call last)
<ipython-input-1-5b7f1bf909af> in <module>
----> 1 import pandas as pd
2 import numpy as np
3 from sklearn.ensemble import IsolationForest
4 from sklearn.ensemble._iforest import _average_path_length
5 import shap
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pandas\__init__.py in <module>
14
15 if missing_dependencies:
---> 16 raise ImportError(
17 "Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
18 )
ImportError: Unable to import required dependencies:
numpy: cannot import name 'asanyarray' from 'numpy.core.multiarray' (C:\Users\James\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numpy\core\multiarray.py
I've never come across this error before so don't know how to fix.

NLP / ModuleNotFoundError

import numpy as np
%matplotlib notebook
import matplotlib.pyplot as plt
plt.style.use ('ggplot')
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA
from gensim.test.utils import datapath, get_tmpfile
from gensim.models import KeyedVectors
from gensim.scripts.glove2word2vec import glove2word2vec
Hello everyone, I hope you all are doing well. I am new in DL and NLP. As I am learning I came across this error. Can anyone help me solve this issue? thank you all.
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-13-8db7eebe6f3e> in <module>
7 from sklearn.decomposition import PCA
8
----> 9 from gensim.test.utils import datapath, get_tmpfile
10 from gensim.models import KeyedVectors
11 from gensim.scripts.glove2word2vec import glove2word2vec
ModuleNotFoundError: No module named 'gensim'

How to solve a below error to import merge from keras?

import re
from collections import Counter
from itertools import chain
import numpy as np
import pandas as pd
from nltk.corpus import stopwords
from sklearn.metrics import mean_absolute_error as mse
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression,huber
from sklearn.svm import SVR
from sklearn.ensemble import RandomForestRegressor
from sklearn.neighbors import KNeighborsRegressor
from sklearn.ensemble import AdaBoostRegressor, GradientBoostingRegressor
from util import shortWord_Dictionary, load_glove
These are the libraries i am trying to import but i am getting this error.
i have tried few other solutions such as importing subclasses like add and concentrate but still it is not working, Help me out here
Error is:
ImportError Traceback (most recent call last)
<ipython-input-9-acc83d608c96> in <module>
15 import tensorflow.contrib.keras as keras
16
---> 17 from util import shortWord_Dictionary, load_glove
~\Downloads\thesis-final\thesis-final\Microsoft\util.py in <module>
6 from keras import initializers
7 from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
----> 8 from keras.layers import Dropout, Embedding, Convolution1D, Dense, Merge
9 from keras.layers.recurrent import LSTM
10 from keras.models import Sequential
ImportError: cannot import name 'Merge' from 'keras.layers' (C:\Users\DARSHIT\Anaconda3\Anaconda\lib\site-packages\keras\layers\__init__.py)
keras doesn't have Merge layers, see the docs. Merge is just the name that they gave to a subset of the layers, namely Add, Multiply, or Average.

Categories