Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with installation of Uni-Mol tools #220

Open
dgg95223 opened this issue May 8, 2024 · 4 comments
Open

Error with installation of Uni-Mol tools #220

dgg95223 opened this issue May 8, 2024 · 4 comments

Comments

@dgg95223
Copy link

dgg95223 commented May 8, 2024

Dear developers,
I am trying to install Uni-Mol tools on WSL from the source using command python setup.py install. But it always fails with the following message:

Searching for [numpy>=1.25.0]
Reading https://pypi.org/simple/numpy/
Downloading https://files.pythonhosted.org/packages/40/9f/a4a4e07c40dd4c4771266a2e786a3e7fb91429d93a5a8a0538753598cac3/numpy-2.0.0rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=070a8b1c93b0bf21c1a3c51514145acbba612e9f3fd86870c1ca37a36cebbfce
Best match: numpy 2.0.0rc1
Processing numpy-2.0.0rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Installing numpy-2.0.0rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl to /home/jingheng/venv/lib/python3.9/site-packages
Adding numpy 2.0.0rc1 to easy-install.pth file
Installing f2py script to /home/jingheng/venv/bin
Installing numpy-config script to /home/jingheng/venv/bin
Installed /home/jingheng/venv/lib/python3.9/site-packages/numpy-2.0.0rc1-py3.9-linux-x86_64.egg
error: numpy 2.0.0rc1 is installed but numpy<1.23.0,>=1.16.5 is required by {'scipy'}

After I reinstall numpy 1.22, it still goes wrong with the same message.
Please let me know how to fix it, thank you.

@emotionor
Copy link
Collaborator

It looks likes there is a version incompativility between scipy and numpy and your installation of scipy might be 1.7.
Installing numpy with 1.22 should fix it, make sure it's installed correctly.
If that still doesn't work, try reinstalling both scipy and numpy.

@dgg95223
Copy link
Author

It looks likes there is a version incompativility between scipy and numpy and your installation of scipy might be 1.7. Installing numpy with 1.22 should fix it, make sure it's installed correctly. If that still doesn't work, try reinstalling both scipy and numpy.

Thank you for your reply. I finally figure out what the conflict is: daal4py is not installed for some unknown reasons and pymatgen 2024.5.1 requires numpy>=1.25.0 while numba 0.54.1 requires numpy<1.21, >=1.17. After I install daal 2021.2.3, pymatgen 2022 and numpy 1.20.1, unimol-tools is installed successfully.
However, I still have problem with installing Uni-Core which is described in https://github.com/dptech-corp/Uni-Core/issues/48. Could you please have a look and give me any advice? Thank you very much.

@dgg95223
Copy link
Author

It looks likes there is a version incompativility between scipy and numpy and your installation of scipy might be 1.7. Installing numpy with 1.22 should fix it, make sure it's installed correctly. If that still doesn't work, try reinstalling both scipy and numpy.

Thank you for your previous help with the installation. Now I am trying to do an example job with the csv file in Uni-Mol/unimol/notebooks. Here is my code:

from unimol_tools import MolTrain, MolPredict

root = '~/Projects/uni-molgen/'
clf = MolTrain(task='classification',
                data_type='molecule',
                epochs=20,
                learning_rate=0.0001,
                batch_size=16,
                early_stopping=5,
                metrics='auc',
                split='random',
                save_path=root+'exp',
                remove_hs=True,
              )

clf.fit(data=root+'data/mol_property_demo.csv')

However, I always receive the following error:

(venv_torch) (base) jingheng@Bai-Group-1:~/Uni-Mol/unimol_tools$ python ~/Projects/uni-molgen/test/test1.py
fused_multi_tensor is not installed corrected
fused_rounding is not installed corrected
fused_layer_norm is not installed corrected
fused_softmax is not installed corrected
2024-05-22 16:04:41 | unimol_tools/data/conformer.py | 90 | INFO | Uni-Mol(QSAR) | Start generating conformers...
20it [00:00, 67.45it/s]
2024-05-22 16:04:42 | unimol_tools/data/conformer.py | 94 | INFO | Uni-Mol(QSAR) | Failed to generate conformers for 0.00% of molecules.
2024-05-22 16:04:42 | unimol_tools/data/conformer.py | 96 | INFO | Uni-Mol(QSAR) | Failed to generate 3d conformers for 0.00% of molecules.
2024-05-22 16:04:42 | unimol_tools/train.py | 169 | INFO | Uni-Mol(QSAR) | Create output directory: ~/Projects/uni-molgen/exp
2024-05-22 16:04:42 | unimol_tools/models/unimol.py | 146 | INFO | Uni-Mol(QSAR) | Loading pretrained weights from /home/jingheng/Uni-Mol/unimol_tools/unimol_tools/weights/mol_pre_no_h_220816.pt
2024-05-22 16:04:43 | unimol_tools/models/nnmodel.py | 144 | INFO | Uni-Mol(QSAR) | start training Uni-Mol:unimolv1
val: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  6.79it/s, Epoch=Epoch 1/20, loss=1.6434]Traceback (most recent call last):
  File "/home/jingheng/Projects/uni-molgen/test/test1.py", line 16, in <module>
    clf.fit(data=root+'data/mol_property_demo.csv')
  File "/home/jingheng/Uni-Mol/unimol_tools/unimol_tools/train.py", line 141, in fit
    self.model.run()
  File "/home/jingheng/Uni-Mol/unimol_tools/unimol_tools/models/nnmodel.py", line 161, in run
    _y_pred = self.trainer.fit_predict(
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jingheng/Uni-Mol/unimol_tools/unimol_tools/tasks/trainer.py", line 204, in fit_predict
    y_preds, val_loss, metric_score = self.predict(
                                      ^^^^^^^^^^^^^
  File "/home/jingheng/Uni-Mol/unimol_tools/unimol_tools/tasks/trainer.py", line 347, in predict
    metric_score = self.metrics.cal_metric(
                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jingheng/Uni-Mol/unimol_tools/unimol_tools/utils/metrics.py", line 207, in cal_metric
    return self.cal_classification_metric(label, predict, nan_value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jingheng/Uni-Mol/unimol_tools/unimol_tools/utils/metrics.py", line 162, in cal_classification_metric
    res_dict[metric_type] = nan_metric(
                            ^^^^^^^^^^^
  File "/home/jingheng/Uni-Mol/unimol_tools/unimol_tools/utils/metrics.py", line 159, in nan_metric
    def nan_metric(label, predict): return cal_nan_metric(
                                           ^^^^^^^^^^^^^^^
  File "/home/jingheng/Uni-Mol/unimol_tools/unimol_tools/utils/metrics.py", line 49, in cal_nan_metric
    result.append(metric_func(
                  ^^^^^^^^^^^^
  File "/home/jingheng/anaconda3/lib/python3.11/site-packages/sklearn/metrics/_ranking.py", line 572, in roc_auc_score
    return _average_binary_score(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jingheng/anaconda3/lib/python3.11/site-packages/sklearn/metrics/_base.py", line 75, in _average_binary_score
    return binary_metric(y_true, y_score, sample_weight=sample_weight)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jingheng/anaconda3/lib/python3.11/site-packages/sklearn/metrics/_ranking.py", line 339, in _binary_roc_auc_score
    raise ValueError(
ValueError: Only one class present in y_true. ROC AUC score is not defined in that case.

I am not sure what might be wrong causing this error. Can you please provide any suggestion or give more detailed instruction with examples on the Docs site?

@Naplessss
Copy link
Collaborator

Hi, ValueError: Only one class present in y_true. ROC AUC score is not defined in that case. This error is due to imbalance data, with only one class present in the labels (y_true). The ROC AUC score requires both classes to be present in order to compute a meaningful metric.
you can use other metric or increase your batch size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants