Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
813 views
in Technique[技术] by (71.8m points)

python - Unable to install pytransform using pip, shows this after entering the command

here's the output:

  Using cached https://files.pythonhosted.org/packages/e1/37/c617b7de13cc506f75cbb6b88949f5ca0eb1a8229f3f40e4fe59cd469597/pytransform-0.2.3.2.tar.gz
Collecting MDAnalysis==0.8.1 (from pytransform)
  Using cached https://files.pythonhosted.org/packages/9b/45/5cfc731f70af562c860d5b79329980b8b380dd8e283847c950c1f7af8d4c/MDAnalysis-0.8.1.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'C:Pythonpython.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\gunot\AppData\Local\Temp\pip-install-_fymxu0p\MDAnalysis\setup.py'"'"'; __file__='"'"'C:\Users\gunot\AppData\Local\Temp\pip-install-_fymxu0p\MDAnalysis\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: C:UsersgunotAppDataLocalTemppip-install-_fymxu0pMDAnalysis
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsersgunotAppDataLocalTemppip-install-_fymxu0pMDAnalysissetup.py", line 58
        print "MDAnalysis requires Python 2.6 or better. Python %d.%d detected" % 
              ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print("MDAnalysis requires Python 2.6 or better. Python %d.%d detected" % )?
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I dont know why it keeps saying the same error again and again

question from:https://stackoverflow.com/questions/65952848/unable-to-install-pytransform-using-pip-shows-this-after-entering-the-command

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The package you are trying to install (which is ~ 5 years old) has

MDAnalysis==0.8.1

as a requirement, which is a version from 2014 and was therefore written for python 2x. In your error message you can see that in the setup.py of MDAnalysis, we have the line

print "MDAnalysis requires Python 2.6 or better. Python %d.%d detected" % 

which is the python 2x syntax of print(no parantheses).

You have multiple options now:

  1. Try to find a differerent library than pytransform that serves your need and is more up to date
  2. Download the pytransform tar.gz file manually, extract it and replace MDAnalysis==0.8.1 in the requires.txt with MDAnalysis. This is not guaranteed to work though, as the API might have changed
  3. Download the MDAnalysis 0.8.1 source code and try to adjust it to python 3 syntax. This might be a lot of work though
  4. Use python2 for your project. Do note though that python2 has reached it's end of life and is no longer supported, e.g. by the newest version of pip

Note:

Looking at the code of pytransform, option 2 might be the easiest. Even if it doesn't work with the newest MDAnalysis out of the box, the code is only 74 lines long, so changing it to a newer MDAnalysis API should not be too much work


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...