I am trying to replicate the example mentioned at this address by tensorlayer:
https://github.com/tensorlayer/srgan/blob/master/train.py
It has below import statements:
import time, random
import numpy as np
import scipy, multiprocessing
import tensorflow as tf
import tensorlayer as tl
from model import get_G, get_D
from config import config
But this statement is throwing error: from model import get_G, get_D
ModuleNotFoundError: No module named 'model'
I am unable to find such package on 'pypi.org'
The model you imported is a custom module, it is placed in this repo srgan, you got to clone the dependency of train.py too.
Related
I cannot manage to import ARIMA model from statsmodels without encountering this error:
This is how the import is:
from statsmodels.tsa.arima.model import ARIMA
This is the error:
ImportError: cannot import name 'Literal' from 'statsmodels.compat.python' (C:\Users\HP\Anaconda3\lib\site-packages\statsmodels\compat\python.py)
I have already tried to uninstall, re-install and update it, but that does not change. Please help me solve the error.
I found the solution:
Importing ARIMA from arima_model instead of arima.model:
from statsmodels.tsa.arima_model import ARIMA
https://www.statsmodels.org/0.8.0/generated/statsmodels.tsa.arima_model.ARIMA.html
After freezing my program with PyInstaller, I encountered following error while trying to run the executable:
ModuleNotFoundError: No module named 'numpy.distutils'
After adding numpy.distutils to hidden imports, I am getting a new error:
ImportError: cannot import name 'ccompiler' from partially initialized module 'numpy.distutils' (most likely due to a circular import)
with which I don't know what to do.
Those are imports from my code :
import pyodbc
import numpy as np
import fiona
import pandas as pd
import geopandas as gpd
import rasterio
from rasterio import features
from rasterstats import zonal_stats
import PySimpleGUI as sg
Try to collect all submodules of Numpy
--collect-submodules numpy
then, you may get a new error or others
ModuleNotFoundError: No module named 'distutils.unixccompiler'
Adding them to hidden imports
--hidden-import distutils.unixccompiler
Just update to Pyinstaller 4.8. They fix this error in this release.
Trying to import my train model to TensorFlow Lite fails with this error:
ImportError: cannot import name 'export_tflite_ssd_graph_lib'
What is this happening?
By following this tutorial:
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_on_mobile_tensorflowlite.md
I was able to get around this issue.
Make sure you run it from
/models/research
I would like to use Dask to create a simple clustering model. I have tried the following import statements individually (in separate cells) in Jupyter Notebooks:
import dask_ml.cluster
from dask_ml.cluster import KMeans
from dask_ml.cluster import SpectralClustering
Each of them separately resulting in the following error:
ModuleNotFoundError: No module named 'sklearn.cluster._k_means'
This seems really strange. Has anyone experienced this?
I encourage you to update Dask-ML to the latest release
Can't import sklearn.qda and sklearn.lda with scikit-learn 0.19.1
I get:
ImportError: No module named 'sklearn.qda'
ImportError: No module named 'sklearn.lda'
Update:
import sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis
gives:
ImportError: No module named 'sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis'; 'sklearn.discriminant_analysis' is not a package
import sklearn.discriminant_analysis.LinearDiscriminantAnalysis
gives:
ImportError: No module named 'sklearn.discriminant_analysis.LinearDiscriminantAnalysis'; 'sklearn.discriminant_analysis' is not a package
They have been moved to a new package discriminant_analysis.
Try:
To import the module:
import sklearn.discriminant_analysis
To import the classes:
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
If you had earlier versions of sklearn (possibly 0.17 or 0.18), you would have gotten a deprecated warning for them. But they have been removed in 0.19.
Please see here to see the deprecation information:
http://scikit-learn.org/0.18/modules/generated/sklearn.lda.LDA.html
http://scikit-learn.org/0.18/modules/generated/sklearn.qda.QDA.html
I had some code that called 'LDA' and 'QDA' and got those errors. I changed the import statements as shown
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis as QDA
and the code now runs as originally intended.
Original code location:
SKLearn Classifier Comparison