That's it. It installs, I can import statsmodels, but statsmodels.api doesn't import.
I've tried installing with pip and conda, both give me version 0.9.0 and everything is fine.
I've installed all the dependencies, statsmodels works, but statsmodels.api doesn't.
import statsmodels.api Traceback (most recent call last): File "", line 1, in File
"C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\statsmodels\api.py",
line 16, in
from .discrete.discrete_model import (Poisson, Logit, Probit, File
"C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\statsmodels\discrete\discrete_model.py",
line 45, in
from statsmodels.distributions import genpoisson_p File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\statsmodels\distributions__init__.py",
line 2, in
from .edgeworth import ExpandedNormal File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\statsmodels\distributions\edgeworth.py",
line 7, in
from scipy.misc import factorial ImportError: cannot import name 'factorial' from 'scipy.misc'
(C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\misc__init__.py)
From the error it looks as though there is not a function called factorial within the misc directory of the scipy package.
Have you tried opening up the __init__.py file specified in the error and looking through the misc directory to find the factorial function?
Related
I have a problem importing scipy.optimize, as well as other scipy's modules. Every time I run the code I get the following error:
File "C:/Users/project/test.py", line 4, in
from scipy.optimize import *
File "C:\Users\project\venv\lib\site-packages\scipy__init__.py", line 156, in
from . import fft
File "C:\Users\project\venv\lib\site-packages\scipy\fft__init__.py", line 76, in
from ._basic import (
File "C:\Users\project\venv\lib\site-packages\scipy\fft_basic.py", line 1, in
from scipy._lib.uarray import generate_multimethod, Dispatchable
File "C:\Users\project\venv\lib\site-packages\scipy_lib\uarray.py", line 27, in
from ._uarray import *
File "C:\Users\project\venv\lib\site-packages\scipy_lib_uarray__init__.py", line 114, in
from ._backend import *
File "C:\Users\project\venv\lib\site-packages\scipy_lib_uarray_backend.py", line 15, in
from . import _uarray # type: ignore
ImportError: DLL load failed: The specified module could not be found.
I tried reinstalling both numpy and scipy as well as installing scipy manually from here as some suggested, however nothing changed. I use Windows10 64b, Python 3.7.
I uninstalled SciPy 1.4.1 and installed SciPy 1.4.0. It resolved the problem.
pip uninstall scipy
pip install scipy==1.4.0
from sklearn import datasets
When running the above code, I got an error:
`Traceback` (most recent call last):
File "perceptron_ml.py", line 2, in <module>
from sklearn import datasets
File "/home/remember/.local/lib/python3.6/site-packages/sklearn/datasets/__init__.py", line 22, in <module>
from ._twenty_newsgroups import fetch_20newsgroups
File "/home/remember/.local/lib/python3.6/site-packages/sklearn/datasets/_twenty_newsgroups.py", line 45, in <module>
from ..feature_extraction.text import CountVectorizer
File "/home/remember/.local/lib/python3.6/site-packages/sklearn/feature_extraction/__init__.py", line 8, in <module>
from ._hashing import FeatureHasher
ImportError: cannot import name 'FeatureHasher'
Ubuntu: 18.04, Python: 3.6.9, Numpy: 1.17.4, scikit-learn: 0.22
The error is due to a glitch happening during the update due to pip. Related SO post is https://stackoverflow.com/a/59355676/6513708
But long story short, you need to remove the following files which were let by pip during the update:
~/.local/lib/python3.6/site-packages/sklearn/decomposition/_online_lda.cpython-36m-x86_64-linux-gnu.so
~/.local/lib/python3.6/site-packages/sklearn/feature_extraction/_hashing.cpython-36m-x86_64-linux-gnu.so
~/.local/lib/python3.6/site-packages/sklearn/datasets/_svmlight_format.cpython-36m-x86_64-linux-gnu.so
i have tried several times to import matplotlib and remove reinstall all of the possible combinations
i am using conda as package management system, and pip points to conda
trying to run following programm:
import matplotlib.pyplot as plt
or just:
import matplotlib
creates following result:
Traceback (most recent call last):
File "C:/Users/Name/IdeaProjects/zzArchiv/Robot project/RobotProject/DeepLearning/approaches/hvasstutorial/anothermain.py", line 22, in <module>
import matplotlib.pyplot as plt
File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py", line 127, in <module>
from . import cbook
File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\__init__.py", line 2640, in <module>
class _StringFuncParser(object):
File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\__init__.py", line 2652, in _StringFuncParser
_funcs['quadratic'] = _FuncInfo(np.square,
AttributeError: module 'numpy' has no attribute 'square'
i googled a lot and searched left and right, but couldn't get any working solutions (most tell to remove and reinstall numpy/matplotlib which i did several times) please help, if you have any clues
thanks
I'm trying to get OpenDroneMap to run on my linux mint machine. I've been working my way through a number of problems in the current release's dependency chain.
At the moment, I'm stumped on getting the OpenCV module, cv2 to import.
OpenCV is required by an OpenDroneMap dependency, OpenSfM and it's one of the OpenSfM py files that tries to import the module cv2.
Anyway, running OpenDroneMap generates the error:
Traceback (most recent call last):
File "~/OpenDroneMap/src/OpenSfM/bin/opensfm", line 10, in <module>
from opensfm import commands
File "~/OpenDroneMap/src/OpenSfM/opensfm/commands/__init__.py", line 3, in <module>
import extract_metadata
File "~/OpenDroneMap/src/OpenSfM/opensfm/commands/extract_metadata.py", line 5, in <module>
from opensfm import dataset
File "~/OpenDroneMap/src/OpenSfM/opensfm/dataset.py", line 12, in <module>
import cv2
ImportError: dynamic module does not define init function (PyInit_cv2)
b
quitting cause:
PYTHONPATH=~/OpenDroneMap/lib/python2.7/dist-packages "~/OpenDroneMap/src/OpenSfM/bin/run_all" opensfm
returned with code 256.
From what I can tell, the import error cause typically suggests that the cv2 module was not found. I've ensured that cv2.so does exist in the path specified, as well as the usr/lib/python27/dist-packages path, where it seems to me it should really be looking...
In any case, I was hoping someone might be able to give me some direction on what to try next.
I use windows 7 and installed python 3.5 32bit. I installed numpy 1.11 + mkl win32 whl version for python 3.5 from http://www.lfd.uci.edu/~gohlke/pythonlibs/
and installed scipy 0.17.0 from the same site same way. I use pip install. No problem import numpy and scipy, but see error when import scipy.stats or from scipy import stats, etc... Here is the error message:
if from scipy import stats:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from scipy import stats
File "C:\Programs\Python\Python35-32\lib\site-packages\scipy\stats\__init__.py", line 338, in <module>
from .stats import *
File "C:\Programs\Python\Python35-32\lib\site-packages\scipy\stats\stats.py", line 180, in <module>
import scipy.special as special
File "C:\Programs\Python\Python35-32\lib\site-packages\scipy\special\__init__.py", line 627, in <module>
from ._ufuncs import *
File "scipy\special\_ufuncs.pyx", line 1, in init scipy.special._ufuncs (scipy\special\_ufuncs.c:26242)
ImportError: DLL load failed: The specified module could not be found.
If use import scipy.stats see below error message:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import scipy.stats
File "C:\Programs\Python\Python35-32\lib\site-packages\scipy\stats\__init__.py", line 338, in <module>
from .stats import *
File "C:\Programs\Python\Python35-32\lib\site-packages\scipy\stats\stats.py", line 180, in <module>
import scipy.special as special
File "C:\Programs\Python\Python35-32\lib\site-packages\scipy\special\__init__.py", line 629, in <module>
from .basic import *
File "C:\Programs\Python\Python35-32\lib\site-packages\scipy\special\basic.py", line 14, in <module>
from ._ufuncs import (ellipkm1, mathieu_a, mathieu_b, iv, jv, gamma, psi, zeta,
ImportError: cannot import name 'ellipkm1'
I have searched for solution from websites but could not find an answer. Please help. This is really frustrating...
Thanks
Rocky
Ok, finally I solved this myself. At the beginning I knew I needed the 2015 visual C++ redistribution and had it installed, the problem is I installed the 64bit one while obviously I should have used 32 bit one since my python and numpy, scipy were all 32 bit.
Hope this helps for other people