I tried to install a python package through pip, which raises a SyntaxError within setup.py:
$ /usr/bin/pip install dash --user
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting dash
Using cached https://files.pythonhosted.org/packages/ad/94/c591c1ff695c32e7fc5138525f3a792d289160008f1a7f517860cc744a85/dash-0.26.5.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-ysGuJO/dash/setup.py", line 5, in <module>
exec(open('dash/version.py').read(), main_ns) # pylint: disable=exec-used
File "<string>", line 1
__version__ = '0.26.5'
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ysGuJO/dash/
You are using pip version 7.1.0, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
What am I doing wrong here? I suppose it has something todo with a too old python version:
$ python --version
Python 2.6.6
since the response is similar to this, more specific question on stackoverflow and
pip install urllib3
worked fine, which only requires >= Python 2.6.
This is a problem because of an older version of python. you might have to upgrade your python. After upgrading you won't be facing any issue.below are the step to upgrade. write the steps in your terminal.
# refreshing the repositories
sudo apt update
# its wise to keep the system up to date!
# you can skip the following line if you not
# want to update all your software
sudo apt upgrade
# installing python 2.7 and pip for it
sudo apt install python2.7 python-pip
# installing python-pip for 3.6
sudo apt install python3-pip
apt-get update
apt-get install python python-pip
python -m pip install --no-cache-dir setuptools==20.7.0
python -m pip install xxx
Related
I want to upgrade pip
$ pip install --upgrade pip
I get this failure output.
$ pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/da/f6/c83229dcc3635cdeb51874184241a9508ada15d8baa337a41093fab58011/pip-21.3.1.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-FErPSL/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-FErPSL/pip/
You are using pip version 8.1.2, however version 21.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
What needs to be done here? Upgrading/installing any package with pip also suggests that upgrade pip version... but upgrading fails due to this...
I have tried the following without success
$ sudo python3 -m pip install -U pip
$ sudo python3 -m pip install -U setuptools
Looks like I have two installations of python in /bin/python and /bin/python3
python --version
Python 2.7.5
python3 --version
Python 3.6.8
You can try to execute the following commands:
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
pip install --upgrade setuptools
https://me.jinchuang.org/archives/1158.html
It seems like you have a Python version lower than 3.6. Pip has introduced new syntax on its latest releases, so upgrading from an old Python should fail.
From the output you posted, I can't see which is your Python version. So I'll give you the solution for the following cases:
You have a Python version lower than 3.6. Pip has dropped the support for your Python version. I recommend you to upgrade your Python version. Also, you can stay with and old pip (if you really need that old Python).
You have a newer Python version? Maybe you have many versions of Python installed. Verify that.
I'm trying to install numpy using docker, but I get the following error:
---> Running in 9f2546faf5d7
Collecting numpy
Downloading https://files.pythonhosted.org/packages/c5/63/a48648ebc57711348420670bb074998f79828291f68aebfff1642be212ec/numpy-1.19.4.zip (7.3MB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-xoiwnjj7/numpy/setup.py", line 68
f"NumPy {VERSION} may not yet support Python "
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-xoiwnjj7/numpy/
You are using pip version 8.1.1, however version 20.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip3 install numpy' returned a non-zero code: 1
Here is the Dockerfile:
from ubuntu:16.04
run apt-get update && apt-get install -y \
python3-pip
run pip3 install \
numpy
The Python version is 3.5.2.
The issue seems to be that the f-string syntax was only introduced in Python 3.6. It seems weird to me that pip is installing packages that are not compatible with my version of Python, especially since pip apparently doesn't install versions of packages that were released before the installed Python version.
Is there an easy way to only install versions of packages that work with my version of Python?
Seems like this is an ubuntu 16.04 specific issue from this thread.
upgrade pip as root so pip can be upgraded if it is installed in some other locations.
To upgrade pip, run sudo python3 -m pip install --upgrade pip.
I am trying to install something using "python setup.py install" but it shows me this error :-
Traceback (most recent call last):
File "setup.py", line 3, in <module>
from setuptools import setup
ImportError: No module named setuptools
I have installed this missing module using "pip install setuptools". But still it shows me the same error .I have also tried to install this using "sudo apt-get install python-setuptools" but the problem still remains the same. Help me in this issue
If you have Python 2 >=2.7.9 or Python 3 >=3.4 installed from python.org, you will already have pip and setuptools, but will need to upgrade to the latest version:
On Linux or macOS:
pip install -U pip setuptools
On Windows:
python -m pip install -U pip setuptools
If you’re using a Python install on Linux that’s managed by the system package manager (e.g “yum”, “apt-get” etc…), and you want to use the system package manager to install or upgrade pip, then see link
I'm trying to install the module aiohttp for python so I can set up a system for downloading files with uvloop. I'm having some difficulty, though, when I go into my folder which I extracted aiohttp to and doing the following commands:
sudo python3 setup.py install
Traceback (most recent call last):
File "setup.py", line 5, in <module>
from setuptools import setup, Extension
ImportError: No module named 'setuptools'
I looked around and saw that some people had this problem but it was fixed by getting the python-setuptools or python3-setuptools package. So I tried to do that but this is the output I get:
$ sudo apt-get install python3-setuptools
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-setuptools is already the newest version.
python3-setuptools set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
$ sudo apt-get install python-setuptools
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-setuptools is already the newest version.
python-setuptools set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
Which leads me to believe that python-setuptools is already installed! I'm not sure where to go from here. Just for clarity, I did try
sudo python setup.py install
but I received an error because Python 3.4.1+ is needed to install aiohttp:
sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 61, in <module>
raise RuntimeError("aiohttp requires Python 3.4.1+")
RuntimeError: aiohttp requires Python 3.4.1+
I'm running Linux Mint 17.2 Qiana on an HP Elitebook 8440p. Any suggestions as to what I should do?
Thanks in advance!
First Install python3
brew install python3 && cp /usr/local/bin/python3 /usr/local/bin/python
Then use pip3 to install aiohttp
pip3 install aiohttp
sudo dnf install python-devel-2.7.12-6.fc24.x86_64 solved my problem
For me installing uvloop worked, working on Mac laptop:
pip install uvloop
I'm using a clean instance of Ubuntu server and would like to install some python packages in my virtualenv.
I receive the following output from the command 'pip install -r requirements.txt'
Downloading/unpacking pymongo==2.5.2 (from -r requirements.txt (line 7))
Downloading pymongo-2.5.2.tar.gz (303kB): 303kB downloaded
Running setup.py egg_info for package pymongo
Traceback (most recent call last):
File "<string>", line 3, in <module>
ImportError: No module named setuptools.command
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 3, in <module>
ImportError: No module named setuptools.command
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/redacted/env/build/pymongo
Storing complete log in /home/redacted/.pip/pip.log
Any Idea what's going on?
python version 2.7.3
pip version pip 1.4 from /home/redacted/env/lib/python2.7/site-packages (python 2.7)
Try installing:
sudo apt-get install python-setuptools
if this doesn't work try:
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py
Edit: If you have several (possible conflicting) python installations or environments, the following commands can be useful to debug which executables are being used:
which python
which pip
which easy_install
They should "match". It can happen for example that you have pip installing packages for an EPD or global distribution while the current python that is being used corresponds to a local environment (or something different), in which case it might not be able to see the installed packages.
had the same problem, solved it with
pip install -U setuptools
Elaborating #elyase's Answer.
First check for which python version you want to install setuptools.
Normally both python versions comes default with debian or any linux distro.
So, as per your requirement install setup tools using apt package manager
For python 2.x
sudo apt-get install python-setuptools
For python 3.x
sudo apt-get install python3-setuptools
These instructions solved the problem for me:
first enter these commands
pip install --upgrade pip
pip install --upgrade wheel
pip install setuptools
and then try to install the package that requires setuptools.