“SyntaxError: invalid syntax” while installing autopy - python

I need to run code (for python 2.7) which requires autopy
Python 2.7
setuptools-rust 0.11.4
autopy 4.0.0
C:\pip install autopy
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting autopy
Using cached https://files.pythonhosted.org/packages/3d/3e/e589bfe03c7ee1c3d832dda10b908557f25a09d66acfc8fc7d982ee23d1a/autopy-4.0.0.tar.gz
ERROR: Command errored out with exit status 1:
command: 'c:\users\unitedsalvatore\appdata\local\python\python27\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\united~1\\appdata\\local\\temp\\pip-install-j55cvn\\autopy\\setup.py'"'"'; __file__='"'"'c:\\users\\united~1\\appdata\\local\\temp\\pip-install-j55cvn\\autopy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: c:\users\united~1\appdata\local\temp\pip-install-j55cvn\autopy\
Complete output (10 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\united~1\appdata\local\temp\pip-install-j55cvn\autopy\setup.py", line 8, in <module>
from setuptools_rust import Binding, RustExtension
File "c:\users\unitedsalvatore\appdata\local\python\python27\lib\site-packages\setuptools_rust\__init__.py", line 8, in <module>
from .tomlgen import tomlgen_rust, find_rust_extensions
File "c:\users\unitedsalvatore\appdata\local\python\python27\lib\site-packages\setuptools_rust\tomlgen.py", line 191
yield dep, toml.loads(f"{dep} = {options}")[dep]
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.3.4 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Why do I see this error? I am newbie in python

The installation code is using format strings (f-strings), which are only supported by Python 3.6+. Since you’re using Python 2.7, it doesn’t recognize this and raises a syntax error. To solve this, you need to upgrade to at least Python 3.6 or above.
For more information, Real Python has a good article here.

Related

Error: Command errored out with exit status 1: (really long command)

$ cd surface_dynamics
$ pip3 install .
Processing /Users/jacobelection/surface_dynamics
ERROR: Command errored out with exit status 1:
command: /usr/local/Caskroom/miniconda/base/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m8/lmzlkfq11wj3rn17q7xm7g2m0000gn/T/pip-req-build-ubkp2yci/setup.py'"'"'; __file__='"'"'/private/var/folders/m8/lmzlkfq11wj3rn17q7xm7g2m0000gn/T/pip-req-build-ubkp2yci/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/m8/lmzlkfq11wj3rn17q7xm7g2m0000gn/T/pip-pip-egg-info-jhapggrl
cwd: /private/var/folders/m8/lmzlkfq11wj3rn17q7xm7g2m0000gn/T/pip-req-build-ubkp2yci/
Complete output (15 lines):
Traceback (most recent call last):
File "/private/var/folders/m8/lmzlkfq11wj3rn17q7xm7g2m0000gn/T/pip-req-build-ubkp2yci/setup.py", line 9, in <module>
import sage.all
ModuleNotFoundError: No module named 'sage'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/m8/lmzlkfq11wj3rn17q7xm7g2m0000gn/T/pip-req-build-ubkp2yci/setup.py", line 11, in <module>
raise ValueError("this package currently installs only inside SageMath (http://www.sagemath.org)\n"
ValueError: this package currently installs only inside SageMath (http://www.sagemath.org)
If you are using Ubuntu with Sage installed from the official apt repository, run
first in a console "$ source /usr/share/sagemath/bin/sage-env"
----------------------------------------
WARNING: Discarding file:///Users/jacobelection/surface_dynamics. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
How could I fixed these problem? My python version is 3.8.3. macOS Big Sur 11.1
The command needs to be run with the pip that
corresponds to SageMath's Python, which would
depend on the way SageMath was installed:
built from source?
from binaries from the SageMath download page?
from Marc Culler's SageMath app?
via Homebrew cask?
via Conda?
One way to go is to install the SageMath macOS app from
https://github.com/3-manifolds/Sage_macOS/releases
and run the Recommended.pkg installer.
Then instead of
pip3 install .
run
sage --pip install .
Or if you installed SageMath via Conda, make sure to
first activate the corresponding Conda environment:
conda activate sage
pip install .
In case of doubt, check what pip is going to be called
with commands such as:
which pip
ls -halF $(which pip)
which pip3
ls -halF $(which pip3)

Error trying to install a library in Python [duplicate]

This question already has answers here:
Unable to install pygame on Python via pip (Windows 10)
(6 answers)
Closed 2 years ago.
I'm trying to install the pygame library of python, to do it I use pip install pygame in the CMD of Windows, but then I get this error.
Collecting pygame
Using cached pygame-1.9.6.tar.gz (3.2 MB)
ERROR: Command errored out with exit status 1:
command: 'c:\users\marcg\appdata\local\programs\python\python39\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\marcg\\AppData\\Local\\Temp\\pip-install-c1fzrnpr\\pygame\\setup.py'"'"'; __file__='"'"'C:\\Users\\marcg\\AppData\\Local\\Temp\\pip-install-c1fzrnpr\\pygame\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\marcg\AppData\Local\Temp\pip-pip-egg-info-07h2j4on'
cwd: C:\Users\marcg\AppData\Local\Temp\pip-install-c1fzrnpr\pygame\
Complete output (17 lines):
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x64"? [Y/n]Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\marcg\AppData\Local\Temp\pip-install-c1fzrnpr\pygame\setup.py", line 194, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\marcg\AppData\Local\Temp\pip-install-c1fzrnpr\pygame\buildconfig\config.py", line 210, in main
deps = CFG.main(**kwds)
File "C:\Users\marcg\AppData\Local\Temp\pip-install-c1fzrnpr\pygame\buildconfig\config_win.py", line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\marcg\AppData\Local\Temp\pip-install-c1fzrnpr\pygame\buildconfig\download_win_prebuilt.py", line 302, in ask
reply = raw_input(
EOFError: EOF when reading a line
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Can anyone help me?
You could try to install wheel before pip install wheel before installing pygame so it use already compiled package instead of trying to build it.
Python 3.8 doesn't support latest 1.9.6 pygame...
Try :
python3 -m pip install pygame==2.0.0.dev6
UPDATE: Windows users please use python instead of python3 and pip instead of pip3
Try pip3 uninstall pygame
and then python3 -m pip install -U pygame==2.0.0 --user
To see if it works, run one of the included examples:
python3 -m pygame.examples.aliens
If you get 'PermissionError: [WinError 5] Access is denied', before starting the command prompt right click and "Run as administrator".
If pip3 is not there, use pip
Make sure pip is updated.
Watch this video
https://www.youtube.com/watch?v=ABe_qpzQu0Q to learn about updating pip
Make sure to Read pygame official docs about windows installation

"ERROR: can't import snack module" printed while running byobu-config

I've installed byobu on my mac os x mojave. 10.14.xx,
however when I run byobu-config the prompt returns the message
ERROR:Could not import the python snack module
I've tried pip3 install snack with no effect.
it gives me the
pip3 install snack
Collecting snack
Using cached snack-0.0.3.tar.gz (155 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wj/hcvrw53j2rlb_htp5ppq84t80000gn/T/pip-install-u4a4xlgu/snack/setup.py'"'"'; __file__='"'"'/private/var/folders/wj/hcvrw53j2rlb_htp5ppq84t80000gn/T/pip-install-u4a4xlgu/snack/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/wj/hcvrw53j2rlb_htp5ppq84t80000gn/T/pip-install-u4a4xlgu/snack/pip-egg-info
cwd: /private/var/folders/wj/hcvrw53j2rlb_htp5ppq84t80000gn/T/pip-install-u4a4xlgu/snack/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/wj/hcvrw53j2rlb_htp5ppq84t80000gn/T/pip-install-u4a4xlgu/snack/setup.py", line 47
print GCC_VERSION
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(GCC_VERSION)?
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The correct solution is to install newt, not snack which is a scientific visualization library. The "snack" dependency of newt refers to snack.py file in newt library, not to be confused with the snack library (which is a scientific visualisation library). snack.py offers windowing abilities for byobu-config.
To install using conda, https://anaconda.org/conda-forge/newt
conda install -c conda-forge newt
This worked for me:
sudo zypper in python3-newt
If you're on another distro, try installing python3-newt using your package manager and it should fix the problem.
Old one, I know, but this particular
error is because you were trying to install a Python 2 module with Python 3's Pip. A tell-tale sign is the error being about print statement which is a function in Python 3.
About the error code
According to the Python documentation:
This module makes available standard errno system symbols. The value of each symbol is the corresponding integer value. The names and descriptions are borrowed from linux/include/errno.h, which should be pretty all-inclusive.
Error code 1 is defined in errno.h and means Operation not permitted.
About your error
Your setuptools do not appear to be installed. Just follow the Installation Instructions from the PyPI website.
If it's already installed, try
pip install --upgrade setuptools
If it's already up to date, check that the module ez_setup is not missing. If it is, then
pip install ez_setup
Then try again
pip install snack
If it's still not working, maybe pip didn't install/upgrade setup_tools properly so you might want to try
Refer to original answer:
https://stackoverflow.com/a/36025294/10798048

problems when using pip install

I am not quite experienced using pip. When I tried to install some packages, I had this error and had no idea what that meant. This happened to multiple packages that I tried to install. Any suggestions would be appreciated.
sudo pip install mysql-python
Password:
WARNING: The directory '/Users/yzr/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting mysql-python
Downloading MySQL-python-1.2.5.zip (108 kB)
|████████████████████████████████| 108 kB 2.2 MB/s
ERROR: Command errored out with exit status 1:
command: /Users/yzr/opt/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-0kcqh5vw/mysql-python/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-0kcqh5vw/mysql-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/tmp/pip-install-0kcqh5vw/mysql-python/pip-egg-info
cwd: /private/tmp/pip-install-0kcqh5vw/mysql-python/
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-install-0kcqh5vw/mysql-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/private/tmp/pip-install-0kcqh5vw/mysql-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I’m assuming you are using an Unix system such as Linux or MacOS.
Maybe you are accidentally using the python2.7 version installed on your system.
You can use a specific version of python for pip with:
python3 -m pip install mysql-python
Let me explain myself, every MacOS or Linux system has two Python versions (2.7 and 3.x) by default, and both of those versions has a pip module related to it, in other words, you have a pip module for Python 2.7 and other pip module for Python 3.x.
However, I’m assuming you are using python3 for your project, therefore, you must specify the pip module to use.
Other way to avoid this problem is using a virtual environment manager, such as pipenv or built in virtualenv module.
It looks like your pip package doesn't have the module "ConfigParser" installed. You should be able to install it by running:
pip install ConfigParser
Alternatively, depending on your Python version, try installing mysqlclient instead:
pip install mysqlclient

Error when trying to install pygame on Python 3

I tried installing pygame using
pip install pygame
I tried installing it using Python 3.8 but it outputs the error below.
I also tried installing using Python 3.7 but still no luck.
The error:
ERROR: Command errored out with exit status 1:
command: 'c:\users\asus\appdata\local\programs\python\python38-32\python.exe'
-c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Asus\\AppData\\Local\\Temp\\pip-install-_ptqagog\\pygame\\setup.py'"'"';
__file__='"'"'C:\\Users\\Asus\\AppData\\Local\\Temp\\pip-install-_ptqagog\\pygame\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Asus\AppData\Local\Temp\pip-install-_ptqagog\pygame\pip-egg-info'
cwd: C:\Users\Asus\AppData\Local\Temp\pip-install-_ptqagog\pygame\
Complete output (17 lines):
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x86"? [Y/n]Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Asus\AppData\Local\Temp\pip-install-_ptqagog\pygame\setup.py", line 194, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\Asus\AppData\Local\Temp\pip-install-_ptqagog\pygame\buildconfig\config.py", line 210, in main
deps = CFG.main(**kwds)
File "C:\Users\Asus\AppData\Local\Temp\pip-install-_ptqagog\pygame\buildconfig\config_win.py", line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\Asus\AppData\Local\Temp\pip-install-_ptqagog\pygame\buildconfig\download_win_prebuilt.py", line 302, in ask
reply = raw_input(
EOFError: EOF when reading a line
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Use this (I was facing the same issue and it helped me out):
pip install pygame --pre
You can try to install from the Wheel file.
After verifying that you're using python 3.7
python --version # Python 3.7.X
pip install pygame-1.9.6-cp37-cp37m-win_amd64.whl
What kind of OS system are you using? I have no problem to install on python 3.7
(base) $ python3 -m pip install -U pygame --user
Collecting pygame
Downloading https://files.pythonhosted.org/packages/32/37/453bbb62f90feff2a2b75fc739b674319f5f6a8789d5d21c6d2d7d42face/pygame-1.9.6-cp37-cp37m-macosx_10_11_intel.whl (4.9MB)
|████████████████████████████████| 4.9MB 2.7MB/s
Installing collected packages: pygame
Successfully installed pygame-1.9.6
(base) $ python -m pygame.examples.aliens
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
If the problem persists, you should use conda or another environment manager to create new environment and then install the library.
I'm not getting an error when I do this. Have you tried:
pip install pygame
Have you attempted installing with command-prompt or terminal? When I run what you are doing, I don't seem to get a problem.
Additionally, pygame is not compatible with 3.8 yet as it is unstable. Maybe wait a few months until modules are ready to be used with 3.8. Hope this helps, good day.

Categories