JanoschMenke / metis

Python-based GUI to collect Feedback of Chemist in Molecules
MIT License
27 stars 5 forks source link

Correct Python Version? #4

Closed yzimmermann closed 2 months ago

yzimmermann commented 2 months ago

According to pyproject.toml, metis should work with Python 3.8, but it seems like you need 3.9 at least:

Traceback (most recent call last): File "/Users/yoel/.pyenv/versions/3.8.10/bin/metis", line 5, in from metis.metis import launch File "/Users/yoel/.pyenv/versions/3.8.10/lib/python3.8/site-packages/metis/metis.py", line 13, in from metis.backend import Backend File "/Users/yoel/.pyenv/versions/3.8.10/lib/python3.8/site-packages/metis/backend/init.py", line 1, in from .backend_class import Backend File "/Users/yoel/.pyenv/versions/3.8.10/lib/python3.8/site-packages/metis/backend/backend_class.py", line 1, in from metis.utils import ( File "/Users/yoel/.pyenv/versions/3.8.10/lib/python3.8/site-packages/metis/utils/data.py", line 11, in from metis.reinvent_connect import train_rf as trf File "/Users/yoel/.pyenv/versions/3.8.10/lib/python3.8/site-packages/metis/reinvent_connect/train_rf.py", line 199, in class ecfp_generator: File "/Users/yoel/.pyenv/versions/3.8.10/lib/python3.8/site-packages/metis/reinvent_connect/train_rf.py", line 212, in ecfp_generator def get_fingerprints(self, smiles: List[str]) -> np.ndarray[np.int32]: TypeError: Type subscription requires python >= 3.9

JanoschMenke commented 2 months ago

Sorry I did not see the description. You are right. I will have a. check if the type hinting is the only thing that causes the issue after which I will remove that type hint.

I usually run it with Python 3.10.

yzimmermann commented 2 months ago

It should be >= 3.8, <3.11. I usually run it with Python 3.10. Have you had issues with a particular version?

See above. I accidentally posted too early.

JanoschMenke commented 2 months ago

Yeah I saw it haha I updated my original comment.

JanoschMenke commented 2 months ago

I changed the requirements for now.

yzimmermann commented 2 months ago

Yeah, so adding from __future__ import annotations in the relevant files is sufficient to make it run in 3.8. I would also like to note that the UI would first not open on my Apple silicon machine (with Rosetta to make PySide2 work on arm), which seems to be a common issue. Adding

import os os.environ['QT_MAC_WANTS_LAYER'] = '1'

in metis.py fixed the issue for me.

JanoschMenke commented 2 months ago

That works as well, although I just removed the numpy type and "upgraded" tuple to Tuple

Yeah, I saw the ARM issue as well, which is only true for PySide2 versions 15.5.1 and 15.5.2. I am adding a statement that checks whether metis is running on a MacOS and uses the PySide2 versions in question

JanoschMenke commented 2 months ago

See #5 The updated code should be robust to Macs with PySide2 5.15.2.1

However the issue seems to be with Python3.8 + Mac Silicon + PySide2 5.15.2.1

yzimmermann commented 2 months ago

Looks good!