7
$\begingroup$

I'm trying to install something called ASE that models atomic structures. I have ASE currently installed on python 3.7, however I need to run scripts that can import and recognize ASE in an older version of python (specifically python/anaconda2.7-5.2.0). For additional trouble, ASE cannot be downloaded on any python older than 3.6. For some reason, when I switch to the older version of python to run the scripts I need, they don't recognize that ASE is downloaded. Is this because ASE is downloaded on a newer version of python? If this is the case, since I cannot download ASE onto the older version of python, how can I get the script to run?

(Brand new to coding! I don't know a whole lot so sorry in advance!)

$\endgroup$
3
  • 1
    $\begingroup$ If the code you want to use requires Python 3.6 at least, there's no chance to run it on Python 2.7 without making (possibly very) important changes to the code. Is there no way for you to use a recent version (Python 2.7 reached end of life more than a year ago and is no longer supported). $\endgroup$
    – Thierry Lathuille
    Commented May 22, 2021 at 16:42
  • 2
    $\begingroup$ What do you mean by cannot be downloaded on any python older than 3.6 ? Version 3.17 clearly supports 2.7. Only later versions dropped support. $\endgroup$
    – Lukasz Tracewski
    Commented May 22, 2021 at 17:22
  • 4
    $\begingroup$ Two details that might be worth adding to the question 1. How are you downloading ASE (pip, conda, GitHub, etc)? 2. Why do you need to use Python2.7? As Thierry mentioned, Python2 is at end of life and unless you have a very pressing reason like a large existing Python2 codebase it needs to work within, you would definitely be better served moving to Python3. $\endgroup$
    – Tyberius
    Commented May 24, 2021 at 1:48

1 Answer 1

6
$\begingroup$

You likely need to ensure the correct anaconda environment is loaded. Use the following to get a 2.7 environment.

conda create --name py2 python=2.7
conda activate 2.7
pip install ase==3.12.0

Your problems probably stem from issues with pip or the location of the installation. Use this method to ensure you have your 2.7 environment and you have ase in it. Then whenever you need the 2.7 version, simply run the activate command (you wont have to remake the environment).

$\endgroup$

You must log in to answer this question.