Error No module named six - python

I am new to Python/OpenCV.
I have the code below run in Python. But I got an error as shown below.
>>> from matplotlib import pyplot as plt
Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
from matplotlib import pyplot as plt
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 105, in <module>
import six
ImportError: No module named six
I followed what is being suggested in this post: ImportError: No module named six
I have downloaded six-1.8.0.tar.gz and unzip the file. I am wondering of is the next thing to do? I tried to run the six.py but I still got the same error.

You shouldn't need to download the tar.gz file. Instead run this at the command line (note, not the Python command line):
pip install six
And if that doesn't work, try:
easy_install six

I met the same problem (No module named six) when I tried to import nltk and to type easy_install six in cmd (Windows), it installed six for me.
And I imported nltk successfully.

Related

ModuleNotFoundError: No module named 'six.moves.collections_abc'

i am just starting with machine learning i am following this tutorial from Weights&Bias where they gave us some code and asked to run it i am unable to run the code
First I was getting the error
Keras requires TensorFlow 2.2 or higher
for which I tried this method
Following the advice given here, downgrading Keras did the trick for me without having to touch any other packages. Just do:
pip install keras==2.3.0
from this link
Error "Keras requires TensorFlow 2.2 or higher"
then I started getting the error
Using TensorFlow backend.
Traceback (most recent call last):
File "perceptron-single.py", line 6, in <module>
import wandb
File "C:\Users\hp\AppData\Local\Programs\Python\Python37\lib\site-packages\wandb\__init__.py", line 37, in <module>
from wandb import sdk as wandb_sdk
File "C:\Users\hp\AppData\Local\Programs\Python\Python37\lib\site-packages\wandb\sdk\__init__.py", line 9, in <module>
from .wandb_config import Config # noqa: F401
File "C:\Users\hp\AppData\Local\Programs\Python\Python37\lib\site-packages\wandb\sdk\wandb_config.py", line 10, in <module>
from six.moves.collections_abc import Sequence
*ModuleNotFoundError: No module named 'six.moves.collections_abc'
for which I tried this method
easy_install six
from this link
ImportError: No module named six
but it did not solve my issue
Using this method
pip install --ignore-installed six
From the following link solved the problem for me.
ImportError: No Module named six; six already installed
Although I still don't understand about what was actually wrong and how it got fixed.

After installed asprise_ocr_sdk_python_api on mac, got "No module named 'ocr'"

I ran both
sudo pip install asprise_ocr_sdk_python_api
pip install asprise_ocr_sdk_python_api
Got message
"Requirement already satisfied: asprise_ocr_sdk_python_api in /Users/myid/miniconda3/envs/competition/lib/python3.5/site-packages"
But when I ran asprise_ocr to test:
Got the following error:
Traceback (most recent call last):
File "/Users/myuser/miniconda3/envs/competition/bin/asprise_ocr", line 7, in <module>
from asprise_ocr_api.ocr_app import run_ocr_app
File "/Users/myuser/miniconda3/envs/competition/lib/python3.5/site-packages/asprise_ocr_api/__init__.py", line 1, in <module>
from ocr import *
ImportError: No module named 'ocr'
The asprise_ocr_api module doesn't do submodule imports correctly in Python 3.
For example init.py contains from ocr import *. For a sub-module in Python 3 that should be from .ocr import *. Idem for from ocr_app import OcrApp, run_ocr_app. That should be from .ocr_app import OcrApp, run_ocr_app.
After making these changes in all files it imports correctly.
i've tried:
import ocr
same error:
ModuleNotFoundError: No module named 'ocr'
i am using python 3

No module named 'oauthlib' Python 3.4

I can't import requests_oauthlib, I've tried looking for a fix, but have had no luck. When I try to import it I get the following error
Traceback (most recent call last):
File "/home/steven/PycharmProjects/howareyou/questions.py", line 4, in <module>
import requests_oauthlib
File "/usr/local/lib/python3.4/dist-packages/requests_oauthlib/__init__.py", line 1, in <module>
from .oauth1_auth import OAuth1
File "/usr/local/lib/python3.4/dist-packages/requests_oauthlib/oauth1_auth.py", line 6, in <module>
from oauthlib.common import extract_params
ImportError: No module named 'oauthlib'
import sys; print (sys.path) gives me:
['/home/steven/PycharmProjects/howareyou',
'/usr/lib/python3/dist-packages',
'/home/steven/PycharmProjects/howareyou',
'/usr/lib/python3.4',
'/usr/lib/python3.4/plat-x86_64-linux-gnu',
'/usr/lib/python3.4/lib-dynload',
'/home/steven/howareyouve/lib/python3.4/site-packages',
'/usr/local/lib/python3.4/dist-packages']
The actual package is located in /usr/local/lib/python3.4/dist-packages as are all of my packages, and I can import everything else, it's just seems to be oauthlib. I've tried uninstalling it and reinstalling as well.
Alright, I think I figured it out finally. It looks like there were two copies of oauthlib installed. I installed oauthlib using pip to /usr/local/lib/python3.4/dist-packages, and at sometime or another oauthlib was also installed to the /usr/lib/python3/dist-packages
I was able to simply use:
apt-get remove python3-oauthlib
and everything seems to work again

How to install mathplotlib - python

I'm using sublime text 2 to run python 2.7. I have downloaded and installed mathplotlib. When I type the code:
import matplotlib.pyplot
I'm getting this error.
Traceback (most recent call last):
File "/Volumes/HP v190b/Python - Squash Coursework/squashFINAL.py", line 212, in <module>
import matplot.pyplot as plt
ImportError: No module named matplot.pyplot
Any ideas why? I'm using a Mac!
You may check the dependencies, sometimes you need to install some dependencies so that you can import certain module, take a look at this link http://matplotlib.org/users/installing.html

ATpy ImportError: No module named astropy.io

I tried to get atpy on python 2.7. I downloaded ATpy0.9.6 from
https://pypi.python.org/pypi/ATpy/0.9.6
then tar it, and run:
cd ATpy0.9.6
sudo python setup.py install
things seemed to work well.
But when I tried to import atpy on python, I got always this error message:
ImportError: No module named astropy.io
More precisely,
>>> import atpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/__init__.py", line 1, in <module>
from .basetable import Table, TableSet, VectorException
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/basetable.py", line 15, in <module>
from . import registry
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/registry.py", line 164, in <module>
from . import fitstable
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/fitstable.py", line 8, in <module>
from astropy.io import fits
ImportError: No module named astropy.io
>>>
Could anyone help me to figure out the problem?
Perhaps the 'atpy' package depends on another package called 'astropy.io' that you are missing? Yes here it is https://astropy.readthedocs.org/en/v0.1/index.html
It happens that downloading the tar balls from pypi.python.org is the wrong way to install Python packages. The right way (though the Python docs explain poorly), is to run a command like
pip install atpy
This command will install your package and all its dependencies.
If the command pip is missing, you have to install it, which is ironically really complicated.
In my case the solution was to install astropy
pip install --no-deps astropy

Categories

Resources