SyntaxError: invalid syntax when install pandas latest version

10,176

Your error says you need to upgrade your pip:

pip install --upgrade pip

Or you could also try:

pip3 install --upgrade pip

Then pip3 -V should show you correct version it mentioned about.

Then try installing pandas using pip3 install pandas

On 19.10 it installs the latest version, but on 16.04 it installs older version. I think, it's because of newer versions of pandas do not support python 3.5:

Python version support
Officially Python 3.6.1 and above, 3.7, and 3.8

Share:
10,176

Related videos on Youtube

shashank verma
Author by

shashank verma

Updated on September 18, 2022

Comments

  • shashank verma
    shashank verma over 1 year

    I am installing pandas new version 1.0.3 using below command pip3 install pandas.

    But I am getting below error

    Collecting pandas
      Using cached https://files.pythonhosted.org/packages/2f/79/f236ab1cfde94bac03d7b58f3f2ab0b1cc71d6a8bda3b25ce370a9fe4ab1/pandas-1.0.3.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-d_rfkjs6/pandas/setup.py", line 42
            f"numpy >= {min_numpy_ver}",
                                      ^
        SyntaxError: invalid syntax
        
        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-d_rfkjs6/pandas/
    You are using pip version 8.1.1, however version 20.0.2 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    

    I have tried installing pandas from below command

    apt-get install python3-pandas
    

    This commands work But it installs the old version of pandas.

    I am using python 3.5 version and wanted to install latest version of pandas 1.0.3

    • karel
      karel about 4 years
      Did you ever hear of a thing called a Python virtual environment?
    • Gryu
      Gryu about 4 years
      I have no problems with pip3 install pandas on 19.10, python 3.7, pip 18.1. So specify your specs: pip3 --version, cat /etc/lsb-release by editing your question.
    • Gryu
      Gryu about 4 years
      I was also able to install it on 16.04, but it installs old version of pandas: 0.24.... Also, do what it asks: pip install --upgrade pip