Importing Open Data set giving attribute error - python-3.x

I am trying to import kaggle datasets using opendatasets module but after using pandas 1.1.2 with python 3.6v it is not working.
It's giving me this error during the import:
AttributeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/opendatasets/utils/network.py in <module>()
7 try:
----> 8 urlopen = urllib.request.urlopen
9 except Exception:
AttributeError: module 'urllib' has no attribute 'request'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last
PS. I'm working on virtual colab files and not on a local machine
Following is the command of what i am doing
import opendatasets as od
dataset_url='https://www.kaggle.com/rohanrao/air-quality-data-in-india'
od.download('https://www.kaggle.com/rohanrao/air-quality-data-in-india')
data_dir = './air-quality-data-in-india'

!pip install jovian opendatasets --upgrade --quiet
!pip install -q kaggle
import urllib.request
import opendatasets as od
and then entering your kaggle username as well as your kaggle key allows you to import the dataset (until and unless it's not opendata set)

Related

ModuleNotFoundError: No module named 'gpxpy'

I'm running a Jupyter notebook with the lines:
import gpxpy
import gpxpy.gpx
and I'm getting:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
/var/folders/kc/5p61t70n0llbn05934gj4r_w0000gn/T/ipykernel_37440/3640958118.py in <module>
----> 1 import gpxpy
2 import gpxpy.gpx
ModuleNotFoundError: No module named 'gpxpy'
FWIW, doing the following on the terminal command line (macOS 16.6.4)
$ pip3 search gpxpy
ERROR: XMLRPC request failed [code: -32500]
RuntimeError: PyPI's XMLRPC API is currently disabled due to unmanageable load and will be deprecated in the near future. See https://status.python.org/ for more information.
$
Don't know whether it's a conda environment problem or a problem with the gpxpy package itself.
I logged into anaconda.org, searched for module gpxpy and then did one of the recommended installs:
conda install -c conda-forge gpxpy
At least I got around the module load error.

Why do I get "No module named Object detection" in Google colab?

I am trying to do object detection using tensor flow in google colab but everytime I run the following code
%run model_builder_test.py
I get this error
ModuleNotFoundError Traceback (most recent call last)
/content/drive2/My Drive/object_detection/builders/model_builder_test.py in <module>()
21
22 from google.protobuf import text_format
---> 23 from object_detection.builders import model_builder
24 from object_detection.meta_architectures import faster_rcnn_meta_arch
25 from object_detection.meta_architectures import rfcn_meta_arch
ModuleNotFoundError: No module named 'object_detection'
I have setup the python path as they said but still keep getting this error.I will give you link to my program below
https://colab.research.google.com/drive/1iko-bEUfxLimtbGqCmrypRyEzaWzE3vu?usp=sharing
Please help
%set_env PYTHONPATH=$PYTHONPATH:/content/models/research:/content/models/research/slim:/content/models
import os
os.environ['PYTHONPATH'] += ':/kaggle/working/models/research/:/kaggle/working/models/research/slim/'

Pandas not working: DataFrameGroupBy ; PanelGroupBy

I have just upgraded python and I cannot get pandas to run properly, please see below. Nothing appears to work.
Traceback (most recent call last): File
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tqdm/_tqdm.py",
line 613, in pandas
from pandas.core.groupby.groupby import DataFrameGroupBy, \ ImportError: cannot import name 'DataFrameGroupBy' from
'pandas.core.groupby.groupby'
(/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/groupby/groupby.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"code/analysis/get_cost_matrix.py", line 23, in
tqdm.pandas() # Gives us nice progress bars File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tqdm/_tqdm.py",
line 616, in pandas
from pandas.core.groupby import DataFrameGroupBy, \ ImportError: cannot import name 'PanelGroupBy' from 'pandas.core.groupby'
(/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/groupby/init.py)
I guess you are using an older version of tqdm. Try using a version above tqdm>=4.23.4.
The command using pip would be,
pip install tqdm --upgrade
The problem is with the 0.25.1 version of pandas. Consider downgrading it to 0.24.0.
For more information read this
pip install --upgrade pandas==0.24.0

getting an error like ModuleNotFoundError: No module named 'tesserocr'

When I am trying to execute program for OCR I am getting Module not found error.
I am using Anaconda with Jupyter notebook.
I have already installed tesserocr and activated it in conda console but still getting the same error.
import tesserocr
from PIL import Image
print (tesserocr.tesseract_version() ) # print tesseract-ocr version
print (tesserocr.get_languages() ) # prints tessdata path and list of available languages
image = Image.open('C:\\Users\\xxxxx\\Desktop\\CAR_APPLICATIONS\\2019-11-02_15-29-08.jpg')
print(image)
print (tesserocr.image_to_text(image) ) # print ocr text from image
Error:
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import tesserocr
2 from PIL import Image
3 print (tesserocr.tesseract_version() ) # print tesseract-ocr version
4 print (tesserocr.get_languages() ) # prints tessdata path and list of available languages
5
ModuleNotFoundError: No module named 'tesserocr'
fixed.. Installed Pylint and it started working.

import boost in python3.5

I use
apt-get install libboost-all-dev
But when I import boost with python3, I get some errors
In [1]: import boost
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-df3240a4d6cf> in <module>()
----> 1 import boost
/usr/lib/python3/dist-packages/boost/__init__.py in <module>()
7 sys.setdlopenflags(flags)
8 else:
----> 9 import mpi
10
ImportError: No module named 'mpi'
I try to use pip3 to install the module mpi, but it seems that there has no module named mpi.
By the way, boost works well in python2.7.
What should I do?

Resources