Good morning,
i'm trying to install a package on portable python. I found that i do not have the easy_install.exe file, I just have the easy_install.py file.
I tried the following from prompt_CDOS:
1)
C:\Software\Portable Python 3.2.5.1>app\py
thon.exe textract-1.6.1.tar\textract-1.6.1\setup.py
Traceback (most recent call last):
File "textract-1.6.1.tar\textract-1.6.1\setup.py", line 4, in <module>
from setuptools import setup
File "C:\Software\Portable Python 3.2.5.
1\app\lib\site-packages\setuptools\__init__.py", line 2, in <module>
from setuptools.extension import Extension, Library
File "C:\Software\Portable Python 3.2.5.
1\app\lib\site-packages\setuptools\extension.py", line 5, in <module>
from setuptools.dist import _get_unpatched
File "C:\Software\Portable Python 3.2.5.
1\app\lib\site-packages\setuptools\dist.py", line 103
except ValueError, e:
^
SyntaxError: invalid syntax
2)
C:\Software\Portable Python 3.2.5.1>App\py
thon.exe App\easy_install.py textract-1.6.1.tar\textract-1.6.1\setup.py
Traceback (most recent call last):
File "App\easy_install.py", line 4, in <module>
from setuptools.command.easy_install import main
File "C:\Software\Portable Python 3.2.5.
1\App\lib\site-packages\setuptools\__init__.py", line 2, in <module>
from setuptools.extension import Extension, Library
File "C:\Software\Portable Python 3.2.5.
1\App\lib\site-packages\setuptools\extension.py", line 5, in <module>
from setuptools.dist import _get_unpatched
File "C:\Software\Portable Python 3.2.5.
1\App\lib\site-packages\setuptools\dist.py", line 103
except ValueError, e:
^
SyntaxError: invalid syntax
any suggestion?
thanks
The syntax
except ValueError, e:
^
SyntaxError: invalid syntax
is for Python 2. The error is from the file C:\Software\Portable Python 3.2.5.
1\App\lib\site-packages\setuptools\dist.py. It seems you have a wrong version of setuptools installed. You have setuptools for Py2 but you need setuptools for Py3.
Related
I needed to install Setuptools for a project I was doing, and I had to download Setuptools through a .tar file (don't ask), but when ran the command I needed to use to install it:
C:\Users\myname\Downloads\setuptools-51.1.1>py -2 setup.py install
It ended up with a SyntaxError:
Traceback (most recent call last):
File "setup.py", line 7, in <module>
import setuptools
File "C:\Users\myname\Downloads\setuptools-51.1.1\setuptools\__init__.py", line 16, in <module>
import setuptools.version
File "C:\Users\myname\Downloads\setuptools-51.1.1\setuptools\version.py", line 1, in <module>
import pkg_resources
File "C:\Users\myname\Downloads\setuptools-51.1.1\pkg_resources\__init__.py", line 1365
raise SyntaxError(e) from e
^
SyntaxError: invalid syntax
I'm using Python 2.7.
Why is it showing the error, and how can I fix it?
Edit:
When I looked into the __init__.py file, I found that there was something called an "invalid marker":
try:
marker = packaging.markers.Marker(text)
return marker.evaluate()
except packaging.markers.InvalidMarker as e:
raise SyntaxError(e) from e
The last version of setuptools to support Python 2.7 was 44.1.1 (Jan 2020). See the changelog.
Upgrade your Python version in order to use setuptools 51.1.1.
I am getting the following error when executing this command "sudo pip install django"
Traceback (most recent call last):
File "/usr/bin/pip", line 7, in <module>
from pip._internal import main
File "/usr/lib/python2.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
from pip._internal import cmdoptions
File "/usr/lib/python2.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
from pip._internal.index import (
File "/usr/lib/python2.6/site-packages/pip/_internal/index.py", line 526
{str(c.version) for c in all_candidates},
^
SyntaxError: invalid syntax
And python installed version is Python 2.7.11 using this command python -V
I use python3.5, i recently installed spamc using pip.
When i try to import spamc, an error is raised:
How can i resolve this error?Should i find and install other library where spamc is included in it?
import spamc
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import spamc
File "/usr/local/lib/python3.5/dist-packages/spamc/__init__.py", line 24, in <module>
from spamc.client import SpamC
File "/usr/local/lib/python3.5/dist-packages/spamc/client.py", line 230
except socket.gaierror, err:
^
SyntaxError: invalid syntax
I have python2.7 and python3.5 installed via Macports. I am trying to get neovim up and running and for this I ran
$ sudo pip2 install neovim
$ sudo pip-3.5 install neovim
Which installs the packages into different subdirs of /opt/local/Library/Frameworks/Python.framework/Versions/. Now when running Python 3.5, import neovim tries to load the 2.7 package (which fails), as I can see from the stack trace.
The full error is this:
$ python3.5 -c "import neovim"
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/__init__.py", line 7, in <module>
from .uv import UvEventLoop
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/uv.py", line 5, in <module>
import pyuv
ImportError: No module named 'pyuv'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/asyncio.py", line 19, in <module>
import asyncio
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/__init__.py", line 21, in <module>
from .base_events import *
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/base_events.py", line 18, in <module>
import concurrent.futures
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/concurrent/futures/_base.py", line 357
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/__init__.py", line 11, in <module>
from .msgpack_rpc import (ErrorResponse, child_session, socket_session,
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/msgpack_rpc/__init__.py", line 8, in <module>
from .event_loop import EventLoop
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/__init__.py", line 12, in <module>
from .asyncio import AsyncioEventLoop
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/asyncio.py", line 22, in <module>
import trollius as asyncio
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/trollius/__init__.py", line 21, in <module>
from .base_events import *
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/trollius/base_events.py", line 39, in <module>
from . import coroutines
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/trollius/coroutines.py", line 16, in <module>
from . import futures
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/trollius/futures.py", line 19, in <module>
from . import executor
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/trollius/executor.py", line 12, in <module>
import concurrent.futures
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/concurrent/futures/_base.py", line 357
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
What do I have to do in order for Python 2.7 and 3 to coexist peacefully on my system?
I recently had this problem as well, but it was not related to PYTHONPATH, which on my machine was unset. In my situation Python and pip were installed via MacPorts. Cleaning, self-updating MacPorts and then updating pip to the most recent version, and then running the following resolved the issue:
port select --set pip pip35
When i install module configparser on windows 7 using command "pip install ConfigParser", I receive an error:
SyntaxError: invalid syntax
E:\KIENNH\projects\Projs\acs>pip install ConfigParser
Downloading/unpacking ConfigParser Downloading
configparser-3.3.0r2.tar.gz Running setup.py
(path:C:***\ConfigParser\setup.py) egg_info for package ConfigParser
Traceback (most recent call last):
File "", line 3, in
File "C:\Python34\lib\site-packages\setuptools__init__.py", line 5, in
import distutils.core
File "C:\Python34\lib\distutils\core.py", line 18, in
from distutils.config import PyPIRCCommand
File "C:\Python34\lib\distutils\config.py", line 7, in
from configparser import ConfigParser
File "C:***\ConfigParser\configparser.py", line 397
_KEYCRE = re.compile(ur"%(([^)]+))s")
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 3, in
File "C:\Python34\lib\site-packages\setuptools__init__.py", line 5,
in
import distutils.core
File "C:\Python34\lib\distutils\core.py", line 18, in
from distutils.config import PyPIRCCommand
File "C:\Python34\lib\distutils\config.py", line 7, in
from configparser import ConfigParser
File "C:***\configparser.py", line 397
_KEYCRE = re.compile(ur"%\(([^)]+)\)s")
^
SyntaxError: invalid syntax
Ps: I have found a similar question here, but there no answer!:
https://github.com/flyingrub/scdl/issues/8
configparser is included in the standard library.
https://docs.python.org/3/library/configparser.html
Just use import configparser