error in python install module - python

I need to install a module txsckjs,but when I run pip install txsockjs it shows me some error and I don't know what happened.
The error is following:
(venv)lk#linux-7hhe:~/MyImprove/project> pip install txsockjs
Collecting txsockjs
Using cached txsockjs-1.2.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-5pxhyr0u/txsockjs/setup.py", line 73
except Exception, e:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5pxhyr0u/txsockjs/

It is possible that the version of Python you are using is not compatible with the given module.
I have Python 3.5.2 and was able to reporduce your error. It should work on Python 2 I suppose.

Try replacing except Exception, e with except Exception as e in txsockjs/setup.py.
As underlined by SilentMonk and Saket, Python version matters in this case. See Python try…except comma vs 'as' in except and the reference, PEP 3110 -- Catching Exceptions in Python 3000.

Related

I am unable to install Jinja in Pycharm using pip3 install Jinja. How to solve this error?

$ pip3 install Jinja
Collecting Jinja
Using cached https://files.pythonhosted.org/packages/df/50/70f41c599cf0ace6c554b07108916513c70d0e950b0abb18c27a865df7a2/Jinja-1.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-zmxr6gb7/Jinja/setup.py", line 28
except DistutilsError, e:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-zmxr6gb7/Jinja/
Jinja is old and supports only Python 2.
I guess you want to install Jinja2.

Install pyspec module in Anaconda

After installing Anaconda with python3 under C (Path: C:\Anaconda)and setting the path to the environmental variables in windows 10 system, I try to install "pyspec" module to Anaconda in command lines. It turns out to the following messages:
C:\Users\Timothy>pip install pyspec
Collecting pyspec
Using cached https://files.pythonhosted.org/packages/f0/36/fdcd349f2873a5ebd16b7ba2ed4c869a7474e1a77c2f1b6371ff2cfe0ee3/pyspec-0.2-r213.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Timothy\AppData\Local\Temp\pip-install-a766ikbc\pyspec\setup.py", line 15, in <module>
from ez_setup import use_setuptools
File "C:\Users\Timothy\AppData\Local\Temp\pip-install-a766ikbc\pyspec\ez_setup.py", line 106
except pkg_resources.VersionConflict, e:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Timothy\AppData\Local\Temp\pip-install-a766ikbc\pyspec\
And I have no idea what happened. Could anybody help me to fix it?
One of the files in pyspec, namely the file ez-setup.py, has the line
except pkg_resources.VersionConflict, e:
Unfortunately, that syntax is acceptable in Python 2 but not in Python 3. The Python 3 syntax is
except pkg_resources.VersionConflict as e:
This shows that pyspec was written for Python version 2 and will not work with Python version 3. Its PyPI page shows that the package has not been updated since July 21, 2011. Most worrying, there are no versions of Python listed for the package. That means it was indeed written for Python 2 and has not been updated to Python 3.
Your best bet is to use another package. Using such an old, outdated package is not wise. If you really want to try, you could use 2to3 or something similar to attempt to convert pyspec to Python 3. But that would probably be a nightmare.
You could try to contact the authors, Stuart B. Wilkins and Certified Scientific Software, for updated code. (Contact info is in that PyPI page).

Installing Pattern for Python 3

I have installed Python 3 via Anaconda 3 to my PC which runs Windows10.
In trying to install pattern I get an error message:
(base) C:\Users\Alienware\Documents>pip install pattern
Collecting pattern
Using cached https://files.pythonhosted.org/packages/bf/50/d09941d53416f2a86676bd0dc341d5968b599a763b73f5d13f51c57b5641/pattern-2.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\ALIENW~1\AppData\Local\Temp\pip-install-w36z8q7u\pattern\setup.py", line 40
print n
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\ALIENW~1\AppData\Local\Temp\pip-install-w36z8q7u\pattern\
Moreover at Github (https://github.com/clips/pattern) it is stated that:
Pattern supports Python 2.7 and Python 3.6+. The Python 3 version is
currently only available on the development branch.
But how do I access the 'development branch'?
On the other hand, I have successfully installed pattern3 to use with Python 3 but I can not find documentation for pattern3 (compatible with Python 3) using Google.
Update
#Roshan, I am running into an exception. See below:

python-weka-wrapper installing failed with error code 1 in python3.6 version

i'm installing github's python-weka-wrapper with the latest version.
i've installed other library with "pip install ___".
but i got this error code when i'm trying to install the python-weka-wrapper pkg
Collecting python-weka-wrapper
Using cached python-weka-wrapper-0.3.10.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/sf/fwjdy8n10j721jhhp85cpbz40000gn/T/pip-build-xdr96_le/python-weka-wrapper/setup.py", line 41
except HTTPError, e:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/sf/fwjdy8n10j721jhhp85cpbz40000gn/T/pip-build-xdr96_le/python-weka-wrapper/
this msg keep pops in and i've edited "HTTPError, e" syntax to "HTTPError as e"
and this error aren't solved yet.
please help me!!!!!!!!!
Your log output indicates that you're trying to install version python-weka-wrapper, which is Python 2.7 only. Instead, install python-weka-wrapper3 when using Python 3.

SyntaxError in setup.py with pip to install module

So my teacher in Python showed the turtle module, so I want to try it myself, but when I try to install the turtle module on my PC I have an error:
I'm using "pip" to install modules, so when I do "pip install turtle" on a console
(not Python console) I have an error :
Collecting turtle
using cached turtle-0.0.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Daxxas\AppData\Local\Temp\pip-build-727hpv0w\turtle\setup.py", line40
except ValueError, ve:
^
SyntaxError: invalid syntax
and there is this in red :
Command "python setup.py egg_info" failed with error code 1 C:\Users\Daxxas\AppData\Local\temp\pip-build-727hpv0w\turtle\
And I don't know what to do. There isn't pip's folder in "Temp".
So how can I fix this to be able to install the turtle module ?
ps : Is it possible to copy/paste something in a console ?
Turtle is already included in the Python standard library; you don't need to install anything.
The library you were installing is a completely different thing (an HTTP proxy, apparently) which looks like it's not compatible with any recent Python version.
This might be happening because you are trying to install a library that is already included in the standard library.
For example, I was trying to install hashlib using pip and was getting a similar error
python -m pip install hashlib
Complete output from command python setup.py egg_info:
....
File "C:\Users\bla\AppData\Local\Temp\pip-build-l8pg66yd\hashlib\hashlib.py", line 80
raise ValueError, "unsupported hash type"
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\bla\AppData\Local\Temp\pip-build-l8pg66yd\hashlib\
If you are not able to resolve the library, you might have not correctly setup the python interpreter or SDK in your IDE. Check if that is the case.
If you name your file turtle.py, it will give you this error. I figured it out after I had finished checked my Python interpreter, settings, etc.
Is it possible to copy/paste something in a console ?
YES SHIFT+INSERT
This shortcut works well with console as well as with console tools ie vim, emacs, nano etc.

Categories