Does unirest support python3? - python-3.x

Does unirest support python3? I have googled and zero information comes up. Even in the unirest documentation it does not say it is 2.x only which leads me to believe it supports both 3.x and 2.x. However the install fails with 3.4 and succeeds with 2.7. See below.
nkltss:~/dev$ mkvirtualenv mashape -p /usr/bin/python3
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in mashape/bin/python3
Also creating executable in mashape/bin/python
Installing setuptools, pip...done.
(mashape)nkltss:~/dev$ pip install unirest
Downloading/unpacking unirest
Downloading Unirest-1.1.6.tar.gz
Running setup.py (path:/home/nick/.virtualenvs/mashape/build/unirest/setup.py) egg_info for package unirest
warning: no files found matching '*.txt' under directory 'docs'
Downloading/unpacking poster>=0.8.1 (from unirest)
Downloading poster-0.8.1.tar.gz
Running setup.py (path:/home/nick/.virtualenvs/mashape/build/poster/setup.py) egg_info for package poster
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/nick/.virtualenvs/mashape/build/poster/setup.py", line 2, in <module>
import poster
File "/home/nick/.virtualenvs/mashape/build/poster/poster/__init__.py", line 29, in <module>
import poster.streaminghttp
File "/home/nick/.virtualenvs/mashape/build/poster/poster/streaminghttp.py", line 61
print "send:", repr(value)
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/nick/.virtualenvs/mashape/build/poster/setup.py", line 2, in <module>
import poster
File "/home/nick/.virtualenvs/mashape/build/poster/poster/__init__.py", line 29, in <module>
import poster.streaminghttp
File "/home/nick/.virtualenvs/mashape/build/poster/poster/streaminghttp.py", line 61
print "send:", repr(value)
^
SyntaxError: invalid syntax
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/nick/.virtualenvs/mashape/build/poster
Storing debug log for failure in /home/nick/.pip/pip.log
For now I am using 2.7 but I prefer to use 3.x for new projects.

The project is not Python 3 compatible. When the project doesn't explicitly state this (not in the setup.py trove classifiers nor in documentation), you'll have to look at the source code.
There I find:
no use_2to3 use in setup to automatically rewrite code on install
imports for urllib2, a Python 2 only library.
The project depends on the poster library, which is also urllib2 specific.
I'd use the requests library instead. It supports Python 3 out of the box, and apart from asynchronous requests it supports the same feature set (but better as it doesn't have the shortcomings urllib2 brings along). For asynchronous requests, you can add on requests-futures.

Related

pip failed with error code 1 while installing pyzmail

I'm trying to send Gmail through python3. I can use the email and smptlib, but I wanted to try out pyzmail.
However, when I try to install pyzmail, I get this:
$ pip3 install pyzmail
Collecting pyzmail
Using cached https://files.pythonhosted.org/packages/23/9a/c8709821fa15cec44f825fba884284b261a06d8a0033a16f4c35470eb26a/pyzmail-1.0.3.tar.gz
Collecting distribute (from pyzmail)
Using cached https://files.pythonhosted.org/packages/5f/ad/1fde06877a8d7d5c9b60eff7de2d452f639916ae1d48f0b8f97bf97e570a/distribute-0.7.3.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/setuptools/__init__.py", line 2, in <module>
from setuptools.extension import Extension, Library
File "/private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/setuptools/extension.py", line 5, in <module>
from setuptools.dist import _get_unpatched
File "/private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/setuptools/dist.py", line 7, in <module>
from setuptools.command.install import install
File "/private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/setuptools/command/__init__.py", line 8, in <module>
from setuptools.command import install_scripts
File "/private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/setuptools/command/install_scripts.py", line 3, in <module>
from pkg_resources import Distribution, PathMetadata, ensure_directory
File "/private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/pkg_resources.py", line 1518, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/
I tested installing a different pip module but everything seemed to be in order.
I also tried easy_install but it installed for python 2.7, and not 3.
I think it might be something about my setuptools, but I don't know what needs to be done.
The pyzmail packages seems to be inactive now as the last commit and the last release were made 4 years ago. It does not seem to be updated for Python 3.6+.
There was an issue posted on the package's github page with the same error as yours: https://github.com/aspineux/pyzmail/issues/15. Someone posted a patch as a workaround but the best solution is to use pyzmail36 instead:
Tagging #cfenollosa #GheloAce in case you're still using this library
and are looking for a more maintainable way forward.
This repository unfortunately seems inactive, so I created a new
package on PyPI that includes all the fixes to make pyzmail
pip-installable on Python 3.6.
The name of the new package is pyzmail36. You can just update your
requirements.txt file to list pyzmail36 instead of pyzmail and all of
the rest of your code shouldn't need to change.
So just try with:
pip3 install pyzmail36
There are several ways to install pyzmail such as:
Try to use " pip install pyzmail36" by installing Python 3.6 first on your device.
Try to update the setup-tools by typing "pip install setuptools==20.1.1" and then install pyzmail.
Try to search for easy_install on Python 3.x, I have found several links for that.
Good luck.

Trouble installing RDF package

My problem is:
I am having trouble for installing RDF package. I am using python 3.6.3.
C:\Users\suresh\Downloads>pip --no-cache-dir install RDF
Collecting RDF
Downloading rdf-0.9a6.tar.gz (48kB)
100% |████████████████████████████████| 51kB 749kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\suresh\AppData\Local\Temp\pip-build-62ewx87w\RDF\setup.py",
line 1, in <module>
from ez_setup import use_setuptools
File "C:\Users\suresh\AppData\Local\Temp\pip-build-62ewx87w\RDF\ez_setup.py",
line 97
except pkg_resources.VersionConflict, e:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\suresh\AppData\Local\Temp\pip-build-62ewx87w\RDF\
Any suggestions to solve this problem, so that I can install the RDF package? Please suggest me any solution if you have ever encounter this problem before.
Setup script of RDF package is erroneous. It is specified to work with Python3 but uses the try...catch syntax of Python2. You can either use the package with Python2 or follow up with the developer of RDF package to fix the install issue for Python3. The package is broken for Python3 at the moment.

NameError: name 'unicode' is not defined when I install package - Python 3

I'm trying to install the package. But there is the error. How can I fix it?
C:\WINDOWS\system32>python -m pip install zopyx.convert2
Collecting zopyx.convert2
Using cached zopyx.convert2-2.4.6.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Admin\AppData\Local\Temp\pip-build-e90y11sx\zopyx.convert2\setup.py", line 17, in <module>
desc = unicode(file(os.path.join('docs', 'source', 'README.rst')).read().strip(), 'utf-8')
NameError: name 'unicode' is not defined
It looks to me like this library, which has not been updated since 2012, is not compatible with Python 3 and they haven't properly indicated that in the pypi metadata.
The source code is here, if you can't find an alternative library, you may be able to update it to python3 yourself and either make a pull request or a fork.

Python3.4 - Install pyautogui - Raspberry Pi 3

I've been trying to install pyautogui for Python 3.4 on my Raspberry Pi 3 for the last 2 hours... I need it because I wrote a touch keyboard application that needs to run on it. On my main machine (elementary OS 0.4 with Python 3.5) I was able to install it without any problems. First I tried sudo pip install pyautogui but that only installed the Python 2.7 version of pyautogui. Of course next I tried sudo pip3 install pyautogui but that gave me this error:
Running setup.py (path:/tmp/pip-build-hf289jja/pyautogui/setup.py) egg_info for package pyautogui
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip-build-hf289jja/pyautogui/setup.py", line 6, in <module>
version=__import__('pyautogui').__version__,
File "/tmp/pip-build-hf289jja/pyautogui/pyautogui/__init__.py", line 114, in <module>
from . import _pyautogui_x11 as platformModule
File "/tmp/pip-build-hf289jja/pyautogui/pyautogui/_pyautogui_x11.py", line 6, in <module>
from Xlib.display import Display
File "/usr/local/lib/python3.4/dist-packages/Xlib/display.py", line 20, in <module>
import new
ImportError: No module named 'new'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 17, in
File "/tmp/pip-build-hf289jja/pyautogui/setup.py", line 6, in
version=__import__('pyautogui').__version__,
File "/tmp/pip-build-hf289jja/pyautogui/pyautogui/init.py", line 114, in
from . import _pyautogui_x11 as platformModule
File "/tmp/pip-build-hf289jja/pyautogui/pyautogui/_pyautogui_x11.py", line 6, in
from Xlib.display import Display
File "/usr/local/lib/python3.4/dist-packages/Xlib/display.py", line 20, in
import new
ImportError: No module named 'new'
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-hf289jja/pyautogui
Storing debug log for failure in /root/.pip/pip.log
... sorry for the formatting of the above, I couldn't get it to stay inside one code box.
I have no idea what module "new" is. I tried everything else under the sun, such as installing from the official resources: https://pypi.python.org/pypi/PyAutoGUI and various other guides, with NO results.. I'm kinda loosing my mind right now.
ANY Help is grately appreciated :)
Try the following:
sudo pip3 install python3-xlib
sudo pip3 install pyautogui
This assumes you have some other python3 libraries already installed, but you will see missing installs in the above if not.

Python 3.4 invalid syntax in setup.py on ubuntu 14.04, why?

I have a bug (ussue #14 on github) in my python project rma. Installing it trow pip 1.5.4 with python 3.4 some got error like this:
Downloading/unpacking rma
Downloading rma-0.1.5.tar.gz
Running setup.py (path:/tmp/pip_build_root/rma/setup.py) egg_info for package rma
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/rma/setup.py", line 47
setup(**sdict, install_requires=['redis', 'tabulate', 'tqdm', 'msgpack-python'])
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/rma/setup.py", line 47
setup(**sdict, install_requires=['redis', 'tabulate', 'tqdm', 'msgpack-python'])
^
SyntaxError: invalid syntax
----------------------------------------
My own pip version 8.0.2 (python is 3.5).
I newby in python, sorry if this well known issue. I want to know - should i found way to fix it (if this is my issue) or just recommend to update pip to my user?
That package won't install on any Python version < 3.5, because the syntax is indeed invalid on anything but Python 3.5 and newer.
You can't put the **kwargs syntax in front of other keyword arguments. The two should be swapped:
setup(install_requires=['redis', 'tabulate', 'tqdm', 'msgpack-python'], **sdict)
Reporting this as a bug was the correct thing to do; the package states it supports Python 3.4 and up.
Python 3.5 added support for an arbitrary number of *args and **kwargs expansions through PEP 448, opening the door for the above to work too.

Resources