135

I'm trying to build OpenERP project, done with dependencies. It's giving this error now

Traceback (most recent call last):
  File "openerp-client.py", line 105, in <module>
  File "modules\__init__.pyo", line 23, in <module>
  File "modules\gui\__init__.pyo", line 22, in <module>
  File "modules\gui\main.pyo", line 33, in <module>
  File "rpc.pyo", line 29, in <module>
  File "common\__init__.pyo", line 22, in <module>
  File "common\common.pyo", line 26, in <module>
  File "tools\__init__.pyo", line 28, in <module>
  File "dateutil\relativedelta.pyo", line 12, in <module>
ImportError: No module named six

Could someone guide what's wrong and how it can be fixed???

Laf
  • 7,965
  • 4
  • 37
  • 52
asadullah07
  • 1,461
  • 2
  • 10
  • 9
  • 1
    In case six is stored under the wrong Python version, see my [kludge][1] [1]: http://stackoverflow.com/questions/26859356/error-no-module-named-six – Prune Sep 03 '15 at 22:40

14 Answers14

163

You probably don't have the six Python module installed. You can find it on pypi.

To install it:

$ easy_install six

(if you have pip installed, use pip install six instead)

Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
Sylvain Defresne
  • 42,429
  • 12
  • 75
  • 85
  • 19
    I'm sorry, but this is a very lacking answer. Why are so many pip modules not installing their dependencies? – swade May 27 '16 at 13:44
  • 1
    I have no idea why some python module incorrectly list their dependencies. Maybe the author do not test installing the module in a chroot to validate the dependencies are correct. – Sylvain Defresne May 30 '16 at 16:56
  • I needed it in my Pipfile for a web app. I used `pipenv install six`. – Blaskovicz Mar 05 '18 at 19:16
  • @StevenWade For me, I found that `pip install git+...` was the culprit; no deps were followed. Installing the pypi version, uninstalling, and then installing the git+ version pulled in the necessary dependencies, though this seems silly. – tsbertalan Sep 23 '18 at 03:58
  • 2
    On Ubuntu for Python 2.7, I installed it with `sudo apt install python-six`. Thanks! – wjandrea Aug 14 '20 at 04:40
64

If pip "says" six is installed but you're still getting:

ImportError: No module named six.moves

try re-installing six (worked for me):

pip uninstall six
pip install six
3ygun
  • 1,192
  • 12
  • 14
  • 1
    As you told, I could fix the issue after reinstalling six. Thank you! – alones Aug 17 '19 at 04:54
  • For me also ... I had the package installed, but software-properties-gtk was failing. Eventually I traced it down to an import error in six. Th package python3-six was installed, but the module was not loading. I reinstalled the module with apt, and problem fixed. – Tim Richardson Sep 06 '19 at 08:14
  • Very helpful. Thanks. – keramat Aug 08 '20 at 00:33
  • When I do this, I get `Found existing installation: six 1.16.0 Not uninstalling six at /usr/lib/python3/dist-packages, outside environment /usr Can't uninstall 'six'. No files were found to uninstall.` – Keyslinger Dec 20 '22 at 21:23
34

For Mac OS X:

pip install --ignore-installed six
Tom Hale
  • 40,825
  • 36
  • 187
  • 242
Rochan
  • 1,412
  • 1
  • 14
  • 17
29

On Ubuntu and Debian

apt-get install python-six

does the trick.

Use sudo apt-get install python-six if you get an error saying "permission denied".

Praveen
  • 6,872
  • 3
  • 43
  • 62
user144437
  • 1,063
  • 10
  • 9
  • Why does debian not install the dependencies correct? – Timo Sep 15 '21 at 19:04
  • With `apt-get install python3-six` I get "newest version" but with `ipython` I get `ModuleNotFoundError: No module named 'six'`. In `/usr/lib/python3/dist-packages/`, `six` is not there. – Timo Sep 15 '21 at 19:07
5
pip install --ignore-installed six

Source: 1233 thumbs up on this comment

Tom Hale
  • 40,825
  • 36
  • 187
  • 242
3

I did the following to solve the mentioned problem. I got the mentioned problem when I was trying to run the built exe, even I successfully built the exe using pyinstaller. I did this on Windows 10.

  1. go to https://pypi.org/project/six/#files
  2. download "six-1.14.0.tar.gz (33.9 kB)"
  3. unzip it, copy and paste "six.py" into your source directory.
  4. import "six" module into your source code (import six)
  5. run source script.
2

on Ubuntu Bionic (18.04), six is already install for python2 and python3 but I have the error launching Wammu. @3ygun solution worked for me to solve

ImportError: No module named six

when launching Wammu

If it's occurred for python3 program, six come with

pip3 install six

and if you don't have pip3:

apt install python3-pip

with sudo under Ubuntu!

bcag2
  • 1,988
  • 1
  • 17
  • 31
1

In my case, six was installed for python 2.7 and for 3.7 too, and both pip install six and pip3 install six reported it as already installed, while I still had apps (particularly, the apt program itself) complaining about missing six.

The solution was to install it for python3.6 specifically:

/usr/bin/python3.6 -m pip install six
Alpi Murányi
  • 1,117
  • 10
  • 17
1

Ubuntu 18.04.5 LTS (Bionic Beaver):

apt --reinstall install python3-debian
apt --reinstall install python3-six

If /usr/bin/chardet3 fails with error "ModuleNotFoundError: No module named 'pkg_resources'":

apt --reinstall install python3-pkg-resources
0

For me the issue wasn't six but rst2pdf itself. head -1 $(which rst2pdf) (3.8) didn't match python3 --version (3.9). My solution:

pip3 install rst2pdf
Rik Renich
  • 774
  • 6
  • 12
0

six is a Python module. The python command may refer to Python2.

It is possible that you are confusing Python2 and Python3, or that you confused the Python version number this module applies to. six for Python2 is distinct from six for Python3.

If installing six still does not work via pip, consider running Python3 instead.

0

For Ubuntu and Debian

Try to execute the following command-

 sudo apt install python-six

If it's not working perfectly then try to force it by using the following command-

/usr/local/bin/pip3 install six

I hope it works!

0

With poetry you can add this package with poetry add six.

To more details, you can see the documentation here.

natielle
  • 380
  • 3
  • 14
0

For me this was some kind of issue with improper installation of required libraries. Had to run pip as a module by:

python -m pip install six

This is just fast fix, better check python env config. But it worked.

Dawid Gacek
  • 544
  • 3
  • 19