0

I have downloaded the script "install_esoreflex" (ftp://ftp.eso.org/pub/dfs/reflex/install_esoreflex) and then execute the following commands:

chmod u+x install_esoreflex

./install_esoreflex 

I get the following warnings

WARNING: The following Python version is installed in your system Python 3.7.0
WARNING: Some of the available workflows use functionality
WARNING: only available in version Python 2.6.0 or greater
WARNING: and will not work properly with the installed version.
WARNING: Additionally, python 3.x is not yet supported.

Eventhough I have both Python 3.7.0 and 2.7. Python 2 is installed in /usr/bin/python2 and Python 3 is installed in /home/USER/miniconda3/bin/python3. How can I make the script "know" I have python 2?

4
  • Does the command python —version give you Python 2 or 3? If it gives version 3, type alias python=python2 and then run the script. This points python to version 2 instead of 3. – agtoever Dec 25 '18 at 20:22
  • You must have python3 first in $PATH. Try: PATH=/usr/bin:$PATH ./install_esoreflex. – Arkadiusz Drabczyk Dec 25 '18 at 20:24
  • @agtoever it gives Python 3. You mean I have to run alias python=python2 and then ./install_esoreflex in the same terminal? – bajotupie Dec 25 '18 at 20:43
  • Added it as an answer. Please accept it. – agtoever Dec 26 '18 at 5:52
0

From Ubuntu version 18.04, python 3 is the default python version (link). This means that /usr/bin/python is symlinked to /usr/bin/python3. You can check this by running python —version.

To default to python 2 in scripts (as your install script requires), you need to install the python 2 version (apt-get install python2). And tell Ubuntu to use that python version.

It is not recommended to change the /usr/bin/python symlink, because it is part of the distribution maintained configuration. Instead you should use the alias command (link): alias python=python2. This (locally) points python to python2, which is found in /usr/bin. You could use this command once in the terminal before running your install script. To change it more permanently, add it to your .bash_profile.

0

See if the script has a "shebang" (first line with #!...) and change the python reference in it to point to python2 instead of just python

Edit:

OK, so the whole script assumes that your default python is Python v2. You can perhaps get an installation run successfully using an alias (alias python=python2) as indicated in comments above.

However, it is likely that the whole package expects python to be python v2, so you will have to do the same each time you run something from the package. But if you set a permanent alias this may conflict with other things in your system that expect python=python3.

So you may have to use facade scripts to launch parts of that package after setting up an alias for python v2.

3
  • The first line is #!/bin/sh. How do I change the python reference? – bajotupie Dec 25 '18 at 20:45
  • Edited the answer... – xenoid Dec 25 '18 at 21:04
  • the script looks the python binary using command-v python, change that line to command -v python2 – user1330614 Dec 26 '18 at 22:50
0

this solves your problem in one line without changing system's python symlink which can lead to other problems.

wget ftp://ftp.eso.org/pub/dfs/reflex/install_esoreflex  -O - | sed 's/command -v python/command -v python2/g' | sh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.