No module named six - even though six is installed - python-2.7

I'm trying to use matplotlib but I'm getting this error saying "No Module named six". I read previous answers and installed six using pip and also tried pip install six --upgrade. But nothing worked. What could be wrong?
EDIT:
The TraceBack:
Traceback (most recent call last):
File "<string>", line 254, in run_nodebug
File "C:\Users\Akshay\Documents\Internship.py", line 290, in <module>
from matplotlib import pyplot
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 105, in <module>
import six
ImportError: No module named six
And sorry I'm unfamiliar with the which command. I'm using Python 2.7, and the latest pip.

Related

Try to get variable type on python3 on macOS and it show the below error

Traceback (most recent call last): File "/Users/kane/study/python/basicDataStructure/liner_data_structure.py", line 2, in <module> from turtle import clear File "/usr/local/Cellar/python#3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/turtle.py", line 107, in <module> import tkinter as TK File "/usr/local/Cellar/python#3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py", line 37, in <module> import _tkinter # If this fails your Python may not be configured for Tk ModuleNotFoundError: No module named '_tkinter'
Note Please note that, I didn't use anything regarding tkinter. I only created a variable and checked its type.
I have found the answer at the link
brew install python-tk
You will have to firstly import it on the os device!
Run these in your terminal
python3 get-pip.py
Pip install turtle
Pip install tkinter

numpy and pandas breaking after installing biopython on spyder anaconda

I'm using spyder 2 anaconda 2.3.0 on windows as a python IDE for python 2.7. I've been using this for a long time to code in python but suddenly I don't know what happened and it said I did not have biopython package installed, when I installed biopython using
conda -c install anaconda biopython
command, biopython started running however it broke pandas and numpy.
now when I import pandas I get this:
>>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda\lib\site-packages\pandas\__init__.py", line 13, in
<module>
"extensions first.".format(module))
ImportError: C extension: hashtable not built. If you want to import pandas
from the source directory, you may need to run 'python setup.py build_ext --
inplace' to build the C extensions first.
and then when I import numpy I get this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Anaconda\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Anaconda\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Anaconda\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Anaconda\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified module could not be found.
I uninstalled numpy and pandas and then installed them back using pip ... still the same. I entirely unistalled anaconda and installed it back still the same errors. I really do not know what's causing this. Any help will be truly appreciated. I've been trying to fix this for the past three days and its not working out. Thanks for your time.

ImportError: No module named six - Already Installed six

I've installed six with the command
pip install six
and if I print the version with:
python -c "import six; print (six.__version__)"
the version of six is listed as:
1.10.0
I'm trying to convert my Python program into stand-alone executable.
I've tried py2exe and PyInstaller. Both create the package fine but when I run the main.exe I get a brief flash with the following error:
Traceback (most recent call last):
File "main.py", line 9, in <module>
File "requests\__init__.pyc", line 58, in <module>
File "requests\utils.pyc", line 26, in <module>
File "requests\compat.pyc", line 7, in <module>
File "requests\packages\__init__.pyc", line 7, in <module>
File "urllib3\__init__.pyc", line 10, in <module>
File "urllib3\connectionpool.pyc", line 30, in <module>
File "urllib3\packages\six.pyc", line 5, in <module>
ImportError: No module named six
Can someone help me understand how to use this traceback to fix my issue?
I have tried to include six in my setup.py for p2exe:
from distutils.core import setup
import py2exe
setup(windows=[{"script":"main.py"}], options={"py2exe":{"includes":["six"]}})
But alas it did not work.
pip install urllib3 --upgrade
solved the issue.
Found this here: https://stackoverflow.com/a/44071536/3804349

Can't find sklearn module

from sklearn import datasets
digits = datasets.load_digits()
print(digits)
This is the error I get when using sklearn. However, I have the module installed and updated. Is there an easy way to reinstall the module via terminal? Is there another mistake I didn't notice (ex: importing the wrong module)?
Traceback (most recent call last):
File "/Users/patrickmaynard/scikitLearn/driver/driver.py", line 11, in <module>
from sklearn import datasets
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/__init__.py", line 57, in <module>
from .base import clone
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/base.py", line 10, in <module>
from scipy import sparse
ImportError: No module named scipy
Credit goes to Evert
Even if the sklearn module is fully installed, it will not work unless the scipy module is also installed.

how to make a python package with numpy, pandas, scipy, sklearn inside?

I want to make a python package with numpy, pandas, scipy and sklearn, so I can take it to any linux without install python, but i came across this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/data1/sigmoidguo/TOOLS/python27/lib/python2.7/site-packages/numpy/__init__.py", line 180, in <module>
from . import add_newdocs
File "/data1/sigmoidguo/TOOLS/python27/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/data1/sigmoidguo/TOOLS/python27/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/data1/sigmoidguo/TOOLS/python27/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/data1/sigmoidguo/TOOLS/python27/lib/python2.7/site-packages/numpy/core/__init__.py", line 14, in <module>
from . import multiarray
ImportError: libblas.so.3: cannot open shared object file: No such file or directory
How can I fix it without root permission?
PS: I don't have root permission, so I can't install python site-packages to python...
You can install anaconda. It is a multi-platform python distribution that can be installed in your home folder (with user rights). It comes with pip and conda commands to install any package you need. It already comes with all the packages you mention (numpy, pandas, scipy and sklearn), so sounds like a good fit for your needs.
Would http://python-xy.github.io/ do the trick?
(if it was windows I would suggest the portable http://winpython.sourceforge.net/)