Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name six #103

Closed
Sopor opened this issue Nov 13, 2015 · 19 comments
Closed

ImportError: cannot import name six #103

Sopor opened this issue Nov 13, 2015 · 19 comments

Comments

@Sopor
Copy link

Sopor commented Nov 13, 2015

When i run 'tx' i get this error message.
I did clone it and run 'python setup.py install'
Ubuntu 14.04.3
Python 2.7.4
Six 1.5.2

$ tx
Traceback (most recent call last):
  File "/usr/local/bin/tx", line 5, in <module>
    pkg_resources.run_script('transifex-client==0.11', 'tx')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 528, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1394, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/transifex_client-0.11-py2.7.egg/EGG-INFO/scripts/tx", line 10, in <module>
    from txclib import utils
  File "/usr/local/lib/python2.7/dist-packages/transifex_client-0.11-py2.7.egg/txclib/utils.py", line 13, in <module>
    from urllib3.packages import six
ImportError: cannot import name six
@diegobz
Copy link
Contributor

diegobz commented Nov 13, 2015

Can you check what version of urllib3 you have?

@Sopor
Copy link
Author

Sopor commented Nov 13, 2015

1.7.1

@diegobz
Copy link
Contributor

diegobz commented Nov 13, 2015

It looks like you should be fine:

https://github.com/shazow/urllib3/blob/1.7.1/urllib3/packages/six.py

Have you installed urllib3 from Ubuntu packaging? Maybe they drop the six.py from packages?

If this is true I would advise you to create a virtual environment and runpip install -r requirements.txt in order to get the correct package for now.

@Sopor
Copy link
Author

Sopor commented Nov 13, 2015

First i tried 'easy_install --upgrade pip' and then 'pip install urllib3 --upgrade' and i got this message...

The directory '/home/username/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/username/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Requirement already up-to-date: urllib3 in /usr/local/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

...and when i then tried to run 'tx' again it worked :)

@Sopor Sopor closed this as completed Nov 13, 2015
@tehnick
Copy link

tehnick commented Mar 23, 2016

@bys1123
Copy link

bys1123 commented Apr 7, 2016

thx, I run 'pip install urllib3 --upgrade' and this was ok.

@schildbach
Copy link

Got this problem on Ubuntu 16.04. My versions are:

transifex-client                        0.11.1+git15~g655c5e9-1
python-urllib3                          1.13.1-2
python3-urllib3                         1.13.1-2

I'm installing everything from the Ubuntu repos, so no "pip install" for me.

@gunchleoc
Copy link

I have the same problem. I managed to fix it somehow on my Ubuntu machine a while ago, but I don't remember what I did and I have difficulty with finding the information again.

The system I am using right now is Linux Mint 17.1 Cinnamon 64 bit on VMWare for Windows.

Command and output log:

 $ tx pull -a
Traceback (most recent call last):
  File "/usr/local/bin/tx", line 10, in <module>
    from txclib import utils
  File "/usr/local/lib/python2.7/dist-packages/txclib/utils.py", line 13, in <module>
    from urllib3.packages import six
ImportError: cannot import name six

 $ sudo easy_install six
Searching for six
Best match: six 1.5.2
Adding six 1.5.2 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Processing dependencies for six
Finished processing dependencies for six

 $ sudo pip install six
Requirement already satisfied (use --upgrade to upgrade): six in /usr/lib/python2.7/dist-packages
Cleaning up...

 $ sudo pip install six --upgrade
Downloading/unpacking six from https://pypi.python.org/packages/c8/0a/b6723e1bc4c516cb687841499455a8505b44607ab535be01091c0f24f079/six-1.10.0-py2.py3-none-any.whl#md5=3ab558cf5d4f7a72611d59a81a315dc8
  Downloading six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six
  Found existing installation: six 1.5.2
    Not uninstalling six at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed six
Cleaning up...

 $ sudo pip install urllib3 --upgrade
Downloading/unpacking urllib3 from https://pypi.python.org/packages/61/54/3f6149b3b9027f3386ad56816a3be83c201fe7bed1ba67a0ca249f1a8cb1/urllib3-1.16-py2.py3-none-any.whl#md5=3dfc4a65f15bb8fd42f236275168eeb4
  Downloading urllib3-1.16-py2.py3-none-any.whl (98kB): 98kB downloaded
Installing collected packages: urllib3
  Found existing installation: urllib3 1.7.1
    Not uninstalling urllib3 at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed urllib3
Cleaning up...


 $ tx pull -a
Traceback (most recent call last):
  File "/usr/local/bin/tx", line 10, in <module>
    from txclib import utils
  File "/usr/local/lib/python2.7/dist-packages/txclib/utils.py", line 13, in <module>
    from urllib3.packages import six
ImportError: cannot import name six

The packages are owned by the OS, so I tried:

 $ sudo apt-get install python-six
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.       
Statusinformationen werden eingelesen.... Fertig
python-six ist schon die neueste Version.
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.

 $ sudo apt-get install python-urllib3
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.       
Statusinformationen werden eingelesen.... Fertig
python-urllib3 ist schon die neueste Version.
python-urllib3 wurde als manuell installiert festgelegt.
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.

The German-language output means "already on the newest version", so nothing is being done.

Please let me know if you need any version information for the python libs - since this will be another research project, I'd rather wait until I know that you actually need them.

@kouk
Copy link
Contributor

kouk commented Jun 14, 2016

@gunchleoc could you try the commits in this PR? https://github.com/transifex/transifex-client/pull/124/commits
you can do pip install -e git+https://github.com/transifex/transifex-client.git@8c3358d2689ef8a8ce4a6a038873325c0982cbbb#egg=transifex_client for example.

@gunchleoc
Copy link

Thanks for your fast reply!

I ran the install code that you suggested, but the only effect is to make the error message shorter:

$ tx pull -a
ImportError: cannot import name six

@kouk
Copy link
Contributor

kouk commented Jun 14, 2016

@gunchleoc can you try with tx --traceback pull -a?

@gunchleoc
Copy link

Here's the output:

Traceback (most recent call last):
  File "/home/username/src/transifex-client/txclib/cmdline.py", line 97, in main
    utils.exec_command(cmd, args[1:], path_to_tx)
  File "/home/username/src/transifex-client/txclib/utils.py", line 208, in exec_command
    commands = discover_commands()
  File "/home/username/src/transifex-client/txclib/utils.py", line 190, in discover_commands
    from txclib import commands
  File "/home/username/src/transifex-client/txclib/commands.py", line 30, in <module>
    from txclib import utils, project
  File "/home/username/src/transifex-client/txclib/project.py", line 24, in <module>
    from txclib.config import OrderedRawConfigParser, Flipdict
  File "/home/username/src/transifex-client/txclib/config.py", line 6, in <module>
    from urllib3.packages import six
ImportError: cannot import name six

@Sopor
Copy link
Author

Sopor commented Jun 16, 2016

I have also got it back... If i try to get the version out of tx i get this:

$ tx --version

Traceback (most recent call last):
  File "/usr/local/bin/tx", line 5, in <module>
    pkg_resources.run_script('transifex-client==0.11', 'tx')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 528, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1394, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/transifex_client-0.11-py2.7.egg/EGG-INFO/scripts/tx", line 10, in <module>
    from txclib import utils
  File "/usr/local/lib/python2.7/dist-packages/transifex_client-0.11-py2.7.egg/txclib/utils.py", line 13, in <module>
    from urllib3.packages import six
ImportError: cannot import name six

I then did what i did before: 'easy_install --upgrade pip' and then 'pip install urllib3 --upgrade' and it worked again

$ tx --version
0.11

@Sopor
Copy link
Author

Sopor commented Jun 16, 2016

I also updated tx :)

$ tx --version
0.12.1

@kouk
Copy link
Contributor

kouk commented Jun 17, 2016

@gunchleoc if the workaround that @Sopor- mentions doesn't work you may want to try the updated code in #124 which depends directly on six instead of through urllib3.

@kouk
Copy link
Contributor

kouk commented Jun 17, 2016

@schildbach we will be releasing a new version of the client which simplifies these dependencies. Hopefully the package maintainers will update their package not long after that.

@choldrim
Copy link

pip install urllib3 --upgrade +1

@gunchleoc
Copy link

kouk's suggestion fixed it for me - I ran pip install -e git+https://github.com/transifex/transifex-client.git@5e9b769647d85b5183df75a05cbf36ce9d5ef30d#egg=transifex_client and it's working now :)

@r10s
Copy link

r10s commented Nov 16, 2017

pip install urllib3 --upgrade did it for me, Ubuntu 16.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants