When I tried to run
from pycaret.classification import *
I received this error:
ImportError
Traceback (most recent call last)
<ipython-input-83-a8cb12878b37> in <module>()
----> 1 from pycaret.classification import *
8 frames
/usr/local/lib/python3.7/dist-packages/sklearn/metrics/pairwise.py in <module>()
30 from ..utils._mask import _get_mask
31 from ..utils.validation import _deprecate_positional_args
---> 32 from ..utils.fixes import sp_version, parse_version
33
34 from ._pairwise_fast import _chi2_kernel_fast, _sparse_manhattan
ImportError: cannot import name 'parse_version' from 'sklearn.utils.fixes'
(/usr/local/lib/python3.7/dist-packages/sklearn/utils/fixes.py)
I uninstalled Python and re-installed it and now it works but I don't know why
Try running this code !pip install markupsafe==2.0.1. Let me know if this helps.
Please try:
import pycaret.classification
Let me know if this works
A possible resolution is to create a fresh environment. Sometimes conflicting packages cause issues so working with a fresh environment can help you determine whether this is the issue.
Let me know if this helps.
I also ran into the same issue and found this solution helpful when working on google colab, although on Jupiter it didn't, so I created a virtual environment to work in, and it worked out smoothly.
Related
I am trying to move my code from my local machine which uses python 3.6 under an anaconda environment to Google Colab,in order to make use of GPU.
However,some commands are running localy,the same commands don't run in Colab,despite the fact that I have installed all missing modules(everytime I face such an error)
The problem comes at command from dataloader import get_loader,where it throws an error.
It seems that dataloader has problem,because the same error occurs when I just do import dataloader
I have installed with pip dataloader=2.0.0
I have searched a lot but I can't figure out a solution.
Error Message:
ImportError:Traceback (most recent call last)
<ipython-input-57-1c19174cb2f4> in <module>()
----> 1 import dataloader.get_loader
/usr/local/lib/python3.6/dist-packages/dataloader/__init__.py in <module>()
----> 1 from dataloader import read_data_sets
ImportError: cannot import name 'read_data_sets'
I have tried to get the Alexa ranking for a given website. I used PyPI's seolib library and installed it in my environment using !pip install seolib --user command. After executing alexa_rank = seolib.get_alexa('http://google.com') code line, I got the following error.
ModuleNotFoundError: No module named 'api'
Then I installed api module using !pip install api --user command. Then after I got this import error and I don't have an idea of how to solve this error. Please somebody help on this.
import seolib
alexa_rank = seolib.get_alexa('http://google.com')
print(alexa_rank)
ImportError Traceback (most recent call last)
<ipython-input-21-b46efa0fce9a> in <module>
----> 1 import seolib
2
3 alexa_rank = seolib.get_alexa('http://google.com')
4 print(alexa_rank)
~/.local/lib/python3.7/site-packages/seolib/__init__.py in <module>
4
5
----> 6 from api import get_seomoz_data
7 from api import get_alexa
8 from api import get_semrush
ImportError: cannot import name 'get_seomoz_data' from 'api' (/home/mylap/.local/lib/python3.7/site-packages/api/__init__.py)
I'm using Python 3.7.3 version on my environment.
seolib version 0.1.3, last release was in 2013 year. Homepage returns error 404. Doesn't look good. Old, outdated, abandoned.
The code from api import was relative import in Python 2.7, changed to absolute import in Python 3. Overall the code seems to be Python2-only.
While trying to import scipy, I'm getting the following error :
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-7-4dc45f4c0083> in <module>()
----> 1 import scipy
C:\Users\admin\Anaconda2\lib\site-packages\scipy\__init__.py in <module>()
74
75 # Allow distributors to run custom init code
---> 76 from . import _distributor_init
77
78 __all__ += _num.__all__
ImportError: cannot import name _distributor_init
I have tried re-installing from pip by force reinstall, it says that scipy is up-to-date but then, loading it gives the above error. How do I resolve it? I'm using Python 2.x version.
I was getting the same error while using cx_freeze, i managed to make it work by simply commenting this line in the init.py of scipy (---> 76 from . import _distributor_init).
From what i read there: [Numpy-discussion] Hook in init.py to let distributors patch numpy
it simply enables more customization of checks, that i didn't need.
Scipy seems to work just fine without it.
Fyi I installed scipy without using anaconda, and i use python 3.6.
Hope this helps.
I use cx_Freeze and package have this error. I add this code to solve this problem:
self.build_exe_options = {
'includes': "scipy._distributor_init"
}
just upgrade your sklearn, upgrade everything and u will be fine
When I try to import sklearn.linear_model, I get this error:
In [1]: from sklearn import linear_model
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-a6ebbebad697> in <module>()
----> 1 from sklearn import linear_model
/usr/local/lib/python2.7/dist-packages/sklearn/linear_model/__init__.py in <module>()
15 from .least_angle import (Lars, LassoLars, lars_path, LarsCV, LassoLarsCV,
16 LassoLarsIC)
---> 17 from .coordinate_descent import (Lasso, ElasticNet, LassoCV, ElasticNetCV,
18 lasso_path, enet_path, MultiTaskLasso,
19 MultiTaskElasticNet, MultiTaskElasticNetCV,
/usr/local/lib/python2.7/dist-packages/sklearn/linear_model/coordinate_descent.py in <module>()
27 from ..exceptions import ConvergenceWarning
28
---> 29 from . import cd_fast
30
31
ImportError: /usr/local/lib/python2.7/dist-packages/sklearn/linear_model/cd_fast.so: undefined symbol: ATL_dtger
I know it has something to do with Atlas, but I have no idea what. This exact code used to run smoothly on this very machine, and I do not know of any lib modification/installation.
Thank you.
I am not sure what the problem is. But why not uninstall and reinstall sklearn? I have had issues with some python libraries and this simple procedure sometimes works.
I solved it, but I'm not sure how. I reinstalled some things. I found out someone had installed Atlas via apt-get, so I removed it and recompiled pretty much everything.
I am working on learning how to use pandas in ipython notebook:
import pandas as pd
But I get the following error:
AttributeError Traceback (most recent call last)
<ipython-input-17-c7ecb2b0a99d> in <module>()
----> 1 from pandas import *
D:\Anaconda\lib\site-packages\pandas\__init__.py in <module>()
20
21 # numpy compat
---> 22 from pandas.compat.numpy import *
23
24 try:
D:\Anaconda\lib\site-packages\pandas\compat\numpy\__init__.py in <module>()
8
9 # numpy versioning
---> 10 _np_version = np.version.short_version
11 _nlv = LooseVersion(_np_version)
12 _np_version_under1p8 = _nlv < '1.8'
AttributeError: module 'numpy' has no attribute 'version'
I have no idea about how to fix it, what is the problem?My python's version is 3.6
Numpy has dependencies and Anaconda has a history of getting them wrong leading to numpy failing to initialize properly. The AttributeError is most likely caused by numpy initialization failure. This error usually happens when updating numpy or other dependencies that change numpy versions via conda (that's why you can get numpy failing after updating Pandas...)
Example of such failure: https://github.com/ipython/ipyparallel/issues/326
The solution that always works for me is updating to a known working version of numpy. Currently, for me on Windows 10 x64, it is 1.15.1.
Please note it is a problem with Anaconda dependencies rather than numpy itself. Can't provide more specific guidance without details like OS, package versions, etc.