2

I'm trying to install updates from my requirements.txt:

pip install -r requirements.txt

but when the installing has arrived to cheetah it printed this error:

I'm trying to run some updates require by pycharm, so for the update of cheetah I got this error:
Collecting Cheetah==2.4.4 (from -r requirements.txt (line 6))
  Using cached https://files.pythonhosted.org/packages/cd/b0/c2d700252fc251e91c08639ff41a8a5203b627f4e0a2ae18a6b662ab32ea/Cheetah-2.4.4.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-rnxaujfa/Cheetah/setup.py", line 10, in <module>
        import SetupTools
      File "/tmp/pip-build-rnxaujfa/Cheetah/SetupTools.py", line 50
        except DistutilsPlatformError, x:
                                     ^
    SyntaxError: invalid syntax
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-rnxaujfa/Cheetah/

please help me !

Moez Ben Rebah
  • 170
  • 1
  • 12

1 Answers1

3

The error shows that the code is written in Python 2. Probably the library depending on Cheetah is also written in Python 2. I suggest you to create a anaconda environment and install Python 2.7 instead.

If you insist to use Python 3, Cheetah3 has been released (https://cheetahtemplate.org/) You should update the version number of Cheetah in the requirements.txt file, say Cheetah==3.2.6. You may also need to use 2to3 to upgrade the code.

Paco Wong
  • 680
  • 5
  • 12
  • thank you for replying! I already used a virtual environment to install updates but it still the same error with cheetah==2.4.4, so I published an issue on its repo on GitHub. [check screenshot](https://imgur.com/gallery/jSe15OS) – Moez Ben Rebah Oct 13 '20 at 21:45
  • You cannot install cheetah==2.4.4 in a Python 3 environment as shown in your screenshot. You should downgrade to Python 2 if possible. Code written in Python 2 is NOT always compatible with Python 3. To install Python 2.7, please follow the instruction here: https://docs.anaconda.com/anaconda/user-guide/tasks/switch-environment/ – Paco Wong Oct 14 '20 at 01:02
  • But that won't affect the arcade library which requires python 3.6 and higher ? – Moez Ben Rebah Oct 14 '20 at 07:48
  • When it runs with pyhon 2.7, it couldn't even recognize the aracde library [check the screenshot](https://imgur.com/gallery/jvtd5Hw) – Moez Ben Rebah Oct 14 '20 at 08:15
  • Why don't you install cheetah *3* and arcade library in Python 3? Would you mind including the content of requirements.txt in the question so that everyone knows what you want to install? Besides, who provides you the requirements.txt? – Paco Wong Oct 14 '20 at 13:37
  • Yeah, you're right! And that's what I already did. I used this following command: ``` pip install cheetah3 ``` – Moez Ben Rebah Oct 14 '20 at 16:06
  • Then, please remove "cheetah==2.4.4" from requirements.txt. That line will force to downgrade cheetah. You cannot install same package with different versions in one Python environment. The problem will be solved. – Paco Wong Oct 15 '20 at 01:35
  • Is the error still "Collecting Cheetah==2.4.4 (from -r requirements.txt (line 6))"? It should have changed if "cheetah==2.4.4" from line 6 of requirements.txt – Paco Wong Oct 15 '20 at 14:18
  • No! because I tried to collect all dependencies for python3 only in the requirements.txt file and execute installation from the terminal of pycharm: first -> "python3 -m pip freeze > requirements.txt" then -> "python3 -m pip install -r requirements.txt" – Moez Ben Rebah Oct 15 '20 at 20:12
  • @PacoWong Fix: `Cheetah==3.2.6` -> `Cheetah3==3.2.6` – phd Oct 17 '20 at 15:46
  • These days it's `CT3==3.3.1` – phd Aug 02 '23 at 10:35