Project

General

Profile

Actions

Feature #13359

open

design myami-python3 autoinstaller for leginon

Added by Anchi Cheng over 2 years ago. Updated over 2 years ago.

Status:
Assigned
Priority:
Normal
Assignee:
Sargis Dallakyan
Category:
-
Target version:
Start date:
08/26/2022
Due date:
% Done:

0%

Estimated time:
Deliverable:

Description

Needs an autoinstaller to help new user to have an all-in-one installation quickly. Please consider a modern option if the old way feels obsolete. This feature can end at a functional leginon with simulator. Once the form of this is determined from this, we can then add appion support.

Possible python options uses conda, pip/pyproject.toml, instead of setuptools so dependency can be included.

Gabe Lander uses, for example, conda, for his newer development of appion that includes leginon requirement.

conda create -n [envName] python==3.9.2 numpy==1.22.3 scipy==1.8.0 Pillow==9.1.0 joblib==1.1.0 matplotlib==3.5.1 PyMySQL==1.0.2 slackclient==2.9.3 wxPython==4.1.1 future==0.18.2 tqdm==4.64.0 psutil=5.9.1 pandas=1.4.3 scikit-image=0.19.3

I do similar with pip.


Files

installation.log (5.73 KB) installation.log Anchi Cheng, 08/30/2022 06:16 PM
Actions #1

Updated by Sargis Dallakyan over 2 years ago

Thank you for creating this issue Anchi. The old autoinstaller is working fine and I think it is not obsolete. Users who want to use conda or pip venv, can do that, then activate venv and run the autoinstaller. The autoinstaller also installs MySQL server that we can't do with conda or pip/pyproject.toml.

I've made changes in autoinstaller in python3 branch to make it work with python3. I also changed the part when it does pip install. It now downloads requirements.txt and does `pip3 install -r ./requirements.txt`.

Actions #2

Updated by Anchi Cheng over 2 years ago

Thanks. I tried it in a docker image of centos:7

I did first

yum install python3

and then ran the installer with

python3 centos7AutoInstallation.py

Here is what I've got, after changing in the script for it to git clone myami-python3 instead of trunk.

locate mpirun

Please wait......(This may take a few minutes.)

b''
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
Traceback (most recent call last):
  File "centos7AutoInstallation.py", line 1479, in <module>
    a.run()
  File "centos7AutoInstallation.py", line 1425, in run
    result = self.setupProcessServer()
  File "centos7AutoInstallation.py", line 409, in setupProcessServer
    self.processServerPackageEnable()
  File "centos7AutoInstallation.py", line 287, in processServerPackageEnable
    self.linkMpiRun()
  File "centos7AutoInstallation.py", line 262, in linkMpiRun
    if ( filename not in resultstring ):
TypeError: a bytes-like object is required, not 'str'

Actions #3

Updated by Anchi Cheng over 2 years ago

The install log is also full of errors. See attached.

Actions #4

Updated by Anchi Cheng over 2 years ago

By the way, the python install through yum is 3.6.8. Not sure if it will work. We have been developed in 3.8+

Actions #5

Updated by Sargis Dallakyan over 2 years ago

Thank you Anchi. I fixed the issue with linkMpiRun. I'm using Python 3.9.5 installed locally.

Actions #6

Updated by Anchi Cheng over 2 years ago

How should I (and to instruct user to) install 3.9 on CentOS7 for autoinstallor to run ?

Actions #7

Updated by Sargis Dallakyan over 2 years ago

I checked online; to install 3.9 on CentOS7 currently, we or users need to install it from the source:
https://computingforgeeks.com/install-latest-python-on-centos-linux/
https://www.inmotionhosting.com/support/server/linux/install-python-3-9-centos-7/

Actions #8

Updated by Anchi Cheng over 2 years ago

There are so many steps to do on the build of python 3.9 as well as linking it so that autoinstallor will work. In the spirit of simplify this for users to quickly set up, please put these build instruction together to a shell script so that it can be run before centos7AutoInstallation.py and work correctly. Also please add your final instruction to wiki that will replace this part in Autoinstaller_for_CentOS. Mark it as myami-python3 so it can be found later. Thanks.

Actions #9

Updated by Anchi Cheng over 2 years ago

I also got this warning since this installation is done as root. Is this a concern ?

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Actions #10

Updated by Anchi Cheng over 2 years ago

ln -s /usr/local/bin/python3.9 python3
python3 centos7AutoInstallation.py

results in packages still installed in python2.7 site-packages.

python2
Python 2.7.5 (default, Jun 28 2022, 15:30:04) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyscope
>>> 

sh-4.2# python3
Python 3.6.8 (default, Nov 16 2020, 16:55:22) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyscope
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyscope'

If I replace the default python with

ln -s /usr/local/bin/python3.9 python

then I get many python2 syntax error like this.

yum -y install yum-fastestmirror.noarch yum-utils.noarch

Please wait......(This may take a few minutes.)

b''
  File "/usr/bin/yum", line 30
    except KeyboardInterrupt, e:
                            ^
SyntaxError: invalid syntax

I don't think this approach works.

Actions #11

Updated by Sargis Dallakyan over 2 years ago

I've made new commits to convert all python to python3. Please unlink python from /usr/local/bin/python3.9. The yum error is because it needs python2. Let's assume python is python2 as is it the default in CentOS7.

Let's see if it works with the default python36 that comes with CentOS7. If there are no new features that require python3.9, we don't need instructions to install python3.9. Thank you.

Actions #12

Updated by Anchi Cheng over 2 years ago

Please do the testing yourself first to completion. I've already tried linking python to python3. I can't accept python 3.6 solution. There are features needing at least python 3.8.

I haven't thought of this, I wonder if it will help if we use #!/usr/bin/env python3 instead of #!/usr/bin/env python in our script.

Anyway, please run your test to completion before asking me to test again. Thank you.

Actions #13

Updated by Sargis Dallakyan over 2 years ago

Thank you Anchi. So the prerequisite is to have Python 3.8 or 3.9 installed. We can have instructions or a script to do this.

For now, with python 3.9 installed in /usr/local (`which python3 > /usr/local/bin/python3`) the autoinstall works using python3 centos7AutoInstallation.py

There is an issue with setting up mysql password. I had to reset mysql root password using https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password. This is a typical post-install issue with securing the database that is also present in python2 version.

Now with mysql root password set, the installation completes without error, and all required packages are installed. The start-leginon.py has the right python interpreter set (#!/usr/local/bin/python3). However, I can't start leginon:

  1. start-leginon.py
    Error: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 111] Connection refused)")

I'm able to connect using `mysql -u root -h localhost -p`. I'll investigate why. Please let me know if you can reproduce this or have any insights on how to fix this. Thank you.

Actions #14

Updated by Sargis Dallakyan over 2 years ago

The problem with 'Can't connect to MySQL server' has been resolved. I had to restart mariadb to make it work. Now, I'm getting import errors. Are you able to start leginon with Python 3? I can go over and fix all remaining import errors if needed.

Actions

Also available in: Atom PDF