Error installing pyspark - SyntaxError: invalid syntax - python

I am not able to install pyspark or upgrade pip. I keep running into syntax error. I do not have this issue if I use pip3 however the program that runs the code must use python27
#### Installing pyspark using root
$python -V
Python 2.7.18
$pip install pyspark
Collecting pyspark
Using cached
https://files.pythonhosted.org/packages/b8/01/b2393cee7f6180d9150274e92c8bdc1c81220e2ad7554ee5febca1866899/pyspark-3.3.0.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-l7QVd5/pyspark/setup.py", line 31
file=sys.stderr)
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-l7QVd5/pyspark/
You are using pip version 8.1.2, however version 22.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
##### Upgrading pip using root
$pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
Downloading
https://files.pythonhosted.org/packages/4b/b6/0fa7aa968a9fa4ef63a51b3ff0644e59f49dcd7235b3fd6cceb23f202e08/pip-22.1.2.tar.gz (2.1MB)
100% |████████████████████████████████| 2.1MB 388kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-9iqM1O/pip/setup.py", line 7
def read(rel_path: str) -> str:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-9iqM1O/pip/
You are using pip version 8.1.2, however version 22.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Related

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-4hTMet/pip/

[root#localhost ~]# pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/88/d9/761f0b1e0551a3559afe4d34bd9bf68fc8de3292363b3775dda39b62ce84/pip-22.0.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-4hTMet/pip/setup.py", line 7
def read(rel_path: str) -> str:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-4hTMet/pip/
You are using pip version 8.1.2, however version 22.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Problems with pip install django-socketio

pip3 install -U django-socketio outputs the following errors python version on this environment is 3.4.3. The same thing appears when I try to install django channels on python 3.5 or higher
Collecting django-socketio
Downloading django-socketio-0.3.9.tar.gz (48kB)
100% |████████████████████████████████| 51kB 204kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-j3y67yvi/django-socketio/setup.py", line 7, in <module>
version = __import__("django_socketio").__version__,
File "/tmp/pip-build-j3y67yvi/django-socketio/django_socketio/__init__.py", line 2, in <module>
from django_socketio.utils import NoSocket, send, broadcast, broadcast_channel
File "/tmp/pip-build-j3y67yvi/django-socketio/django_socketio/utils.py", line 44
except IndexError, KeyError:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-j3y67yvi/django-socketio/
I tried to install it using pip but I was unsuccessful.
What you can do is:
1) download the Source Code from GitHub to where you want the files to be
git clone https://github.com/stephenmcd/django-socketio
2) unzip it and go inside the django-socketio directory
3) run:
python3 setup.py install
you can check if it has installed by running the command:
pip3 freeze
hope this helps!

egg_info failed with error code 1 for pip install in python 3.6

I've recently done a clean install of Python 3.6 on my Windows 10 laptop.
I wish to install BeautifullSoup. When i try to use
python -m pip install BeautifulSoup
it returns the following:
C:\Users\mjpvanzuijlen\AppData\Local\Programs\Python\Python36>python -m pip install BeautifulSoup
Collecting BeautifulSoup
Using cached BeautifulSoup-3.2.1.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\MJPVAN~1\AppData\Local\Temp\pip-build-kopzhsyx\BeautifulSoup\setup.py", line 22
print "Unit tests have failed!"
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\MJPVAN~1\AppData\Local\Temp\pip-build-kopzhsyx\BeautifulSoup\
I found others with similair problems with egg_info, but the solutions did not work for me. I have tried to upgrade pip, i downloaded setuptools32.3.2.1, i've upgraded setupttools but all to no avail.
It looks like you are trying to install the wrong package.
Try running: python -m pip install BeautifulSoup4
instead of: python -m pip install BeautifulSoup

Command "python setup.py egg_info" failed with error code 1?

So, I've been trying to install the gutenberg module for python pip install gutenberg using the directions at this site (using brew instead of pip since I'm on a mac). Every time I try do do it, it returns with this:
pip install gutenberg
Collecting gutenberg
Using cached Gutenberg-0.4.2.tar.gz
Collecting bsddb3>=6.1.0 (from gutenberg)
Using cached bsddb3-6.2.1.tar.gz
Complete output from command python setup.py egg_info:
Can't find a local Berkeley DB installation.
(suggestion: try the --berkeley-db=/path/to/bsddb option)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/53/zsh0zhwx635d_rss6hkgrknr0000gn/T/pip-build-Mn4wGp/bsddb3/
So, I installed the berkeley database using brew (brew install berkeley-db) and the error changed:
pip install gutenberg
Requirement already satisfied (use --upgrade to upgrade): gutenberg in ./anaconda2/lib/python2.7/site-packages/Gutenberg-0.4.2-py2.7.egg
Collecting bsddb3>=6.1.0 (from gutenberg)
Using cached bsddb3-6.2.1.tar.gz
Complete output from command python setup.py egg_info:
Trying to use the Berkeley DB you specified...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/53/zsh0zhwx635d_rss6hkgrknr0000gn/T/pip-build-FEd8dy/bsddb3/setup.py", line 40, in <module>
import setup2
File "setup2.py", line 350, in <module>
"version %d.%d" %db_ver)
TypeError: %d format: a number is required, not NoneType
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/53/zsh0zhwx635d_rss6hkgrknr0000gn/T/pip-build-FEd8dy/bsddb3/
I tried doing easy_install, re-installing setup-tools, and a bunch of other stuff. Here's the links to all the things I've tried:
Can't install via pip because of egg_info error
Python pip install gives "Command "python setup.py egg_info" failed with error code 1"
Python pip install fails: invalid command egg_info
pip fails to install anything, error: invalid command 'egg_info'
https://github.com/PokemonGoF/PokemonGo-Bot/issues/2919
When I say I've tried all of them, I really do mean all of the suggestions in the links above, so maybe I messed something up in that process. I'm not entirely sure what's going on, I've been working on it for hours and haven't been able to discover with any successful solutions. I'm not sure if I'm missing something here but if anyone has any suggestions it would really help.
Just an addition from my side...
I fixed this issue on my Windows 10 for python 3.4:
Go to Powershell Window and type below:
1) Update pip >>>>> py -3.4 -m pip install --upgrade pip
2) Install Numpy >>>>> py -3.4 -m pip install numpy
3) Install Matplotlib >>>> py -3.4 -m pip install matplotlib

Can't install python-ldap via pip

I can't install python-ldap via pip, I get the following error:
$ sudo pip3.4 install python-ldap
Downloading/unpacking python-ldap
Downloading python-ldap-2.4.19.tar.gz (138kB): 138kB downloaded
Running setup.py (path:/tmp/pip_build_root/python-ldap/setup.py) egg_info for package python-ldap
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/python-ldap/setup.py", line 53
print name + ': ' + cfg.get('_ldap', name)
^
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/python-ldap/setup.py", line 53
print name + ': ' + cfg.get('_ldap', name)
^
SyntaxError: invalid syntax
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/python-ldap
Storing debug log for failure in /home/nima/.pip/pip.log
Any ideas how to resolve this?
It seems that your python-ldap is implemented in Python-2.X but you're using Python-3.X (Print Is A Function in python 3). Therefore, you need to install a newer version of this library that supports Python-3.X or install the library in python-2.X which is not recommended.
You can install the proper version for Python-3.X though using following command:
# if pip3 is the default pip alias for python-3
pip3 install python3-ldap
# otherwise
pip install python3-ldap
Also here is the link of PiPy package for further information. https://pypi.python.org/pypi/python3-ldap/0.9.8.4/
You can install python-ldap which is implemented for python3
pip install python3-ldap

Categories