ModuleNotFoundError: No module named 'xagg.wrappers' - python

I am trying to import a package 'xagg' but it gives me the error described below. I managed to install 'xagg' but the following error popped up when I try to import it
Here is the command line
import xagg as xa
The error I got:
ModuleNotFoundError Traceback (most recent call last)
Input In [15], in <module>
----> 1 import xagg as xa
File ~\AppData\Roaming\Python\Python39\site-packages\xagg\__init__.py:5, in <module>
1 # Eventually restrict to just pixel_overlaps and aggregate; with
2 # everything else happening behind the scenes (and the exporting
3 # happening as methods to the classes that are exported from those
4 # two functions)
----> 5 from .wrappers import pixel_overlaps
6 from .aux import (normalize,fix_ds,get_bnds,subset_find)
7 from .core import aggregate
ModuleNotFoundError: No module named 'xagg.wrappers'
OS: Windows

pip install wrapper
I hope it work

Related

BUILD CHATBOTS WITH PYTHON- Discover Insights into Classic Texts

I keep getting this error code from my Jupyter Notebook and there is little to no explanation.
After inputting:
from nltk import pos_tag, RegexpParser
from tokenize_words import word_sentence_tokenize
from chunk_counters import np_chunk_counter, vp_chunk_counter
I get:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-14-a5041508c9f2> in <module>
1 from nltk import pos_tag, RegexpParser
----> 2 from tokenize_words import word_sentence_tokenize
3 from chunk_counters import np_chunk_counter, vp_chunk_counter
ModuleNotFoundError: No module named 'tokenize_words'
The full lesson allows the student to follow along with Jupyter. I don't know why but all it ever gives me is module not found error codes.

Problem with StringIO importing ee, although it could be imported alone

I am trying to import the module ee to use the google earth engine according to the documentation on the dedicated website.
https://developers.google.com/earth-engine/guides/python_install
I got this error:
import ee
ModuleNotFoundError Traceback (most recent call last)
/tmp/ipykernel_35721/2985164896.py in <module>
----> 1 import ee
~/anaconda3/lib/python3.7/site-packages/ee/__init__.py in <module>
----> 1 from .main import main
~/anaconda3/lib/python3.7/site-packages/ee/main.py in <module>
8 import stat
9 import plistlib
---> 10 import StringIO
11 import platform
12 import time
ModuleNotFoundError: No module named 'StringIO'
The puzzling thing is that I can import this module without ee flawlessly.
from io import StringIO
import io
Would anyone had the same issue?
Modifying the original python file at the following location solve the problem:
~/anaconda3/lib/python3.7/site-packages/ee/main.py
Line 10, replace 'import StringIO' by 'from io import StringIO'.

Importing stldecompose result in error - cannot import name '_maybe_get_pandas_wrapper_freq' from 'statsmodels.tsa.filters._utils'

My code
!pip install stldecompose
from stldecompose import decompose
Error Msg
ImportError Traceback (most recent call last)
in
2 # Install the library via PIP
3 get_ipython().system('pip install stldecompose')
----> 4 from stldecompose import decompose, forecast
~/opt/anaconda3/lib/python3.7/site-packages/stldecompose/init.py in
----> 1 from .stl import decompose, forecast
~/opt/anaconda3/lib/python3.7/site-packages/stldecompose/stl.py in
3 from pandas.core.nanops import nanmean as pd_nanmean
4 from statsmodels.tsa.seasonal import DecomposeResult
----> 5 from statsmodels.tsa.filters._utils import _maybe_get_pandas_wrapper_freq
6 import statsmodels.api as sm
7
ImportError: cannot import name '_maybe_get_pandas_wrapper_freq' from 'statsmodels.tsa.filters._utils' (/Users/georgeng/opt/anaconda3/lib/python3.7/site-packages/statsmodels/tsa/filters/_utils.py)
You have two pathway to go about this:
If you are running statsmodels==0.11.0, statsmodels.tsa.filters._utils function was removed from the library.
Alternatively you may use statsmodels.tsa.seasonal.STL, which gives similar functionality. See its documentation:
https://www.statsmodels.org/stable/generated/statsmodels.tsa.seasonal.STL.html#statsmodels.tsa.seasonal.STL
Downgrade to pip install statsmodels==0.10.2

NameError: name 'the_given_file' is not defined while being in the directory

I try to import a file Python which is in the same folder with the jupyter notebook I'm calling it. It worked well until some point when I shut down the kernel and relaunched it :
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-7-28aefea88e42> in <module>
1 import imp
2 from stocker import Stocker
----> 3 imp.reload(stocker)
NameError: name 'stocker' is not defined
I also tried with importlib :
import importlib
from stocker import Stocker
importlib.reload(stocker)
But it didn't worked neither.
Thus I thought it was a Path problem so I added it with sys.path.append(r'C:\Users\antoi\Documents\Programming\Luxurynsight\Finance')
C:\ProgramData\Anaconda3\python36.zip
C:\ProgramData\Anaconda3\DLLs
C:\ProgramData\Anaconda3\lib
C:\ProgramData\Anaconda3
C:\ProgramData\Anaconda3\lib\site-packages
C:\ProgramData\Anaconda3\lib\site-packages\win32
C:\ProgramData\Anaconda3\lib\site-packages\win32\lib
C:\ProgramData\Anaconda3\lib\site-packages\Pythonwin
C:\ProgramData\Anaconda3\lib\site-packages\IPython\extensions
C:\Users\antoi\.ipython
C:\Users\antoi\AppData\Local\Temp\tmpxi5uysfy
C:\Users\antoi\AppData\Local\Temp\tmpvwwnclc1
C:\Users\antoi\Documents\Programming\Luxurynsight\Finance
C:\Users\antoi\Documents\Programming\Luxurynsight\Finance
C:\Users\antoi\Documents\Programming\Luxurynsight\Finance
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-15-0bf8ff56cd18> in <module>
6 import importlib
7 from stocker import Stocker
----> 8 importlib.reload(stocker)
9
10 import imp
NameError: name 'stocker' is not defined
But it doesn't work ...
I also tried from the anaconda prompt and it is the same error. My OS is Windows10.
Update
I tried to get rid of imp.reload(). Now I import the file stocker.py with from stocker import Stocker. Yet, how can I load the former library then ?

ImportError in Jupyter Notebook

I am trying import a module in Jupyter and it is not working:
import alyn
ImportError Traceback (most recent call last)
<ipython-input-8-8e9535ea4303> in <module>()
----> 1 import alyn
~\Anaconda3\envs\tracx\lib\site-packages\alyn\__init__.py in <module>()
1 """ Import required modules"""
----> 2 from deskew import *
3 from skew_detect import *
ImportError: No module named 'deskew'
I don't quite understand why, since the package in question has a correct init.py file:
whose contents are:
""" Import required modules"""
from deskew import *
from skew_detect import *
What am I missing?
P.S.
This is all taking place on Windows 10.
Well, I've figured it out!
Turns out that the package I was trying to import is written in Python 2 and its init file is using the relative import mechanism. However, I am working in Python 3 and relative import is no longer supported in it. The init file can be made to work in Python 3 by adding a . in both lines, like this:
""" Import required modules"""
from .deskew import *
from .skew_detect import *
I think this should be backward compatible with Python 2.

Categories