westlake-repl / SaprotHub

SaprotHub: Making Protein Modeling Accessible to All Biologists
MIT License
68 stars 7 forks source link

local_server #68

Open wangjiaqi8710 opened 2 months ago

wangjiaqi8710 commented 2 months ago

Dear Authors,

I have tried the script for setting up run in local_server and it seems that it did not work successfully. I have connect the colab saprothub to the local server and, I try click on the "1.1 install saprot", error message appears as below. Do you know what could be the problem? Thank you.

ModuleNotFoundError Traceback (most recent call last) in <cell line: 114>() 112 from transformers.models.esm.openfold_utils.feats import atom14_to_atom37 113 from string import ascii_uppercase,ascii_lowercase --> 114 from saprot.utils.mpr import MultipleProcessRunnerSimplifier 115 from saprot.data.parse import get_chain_ids 116 from saprot.scripts.training import my_load_model

ModuleNotFoundError: No module named 'saprot'

Best wishes, JQ

LTEnjoy commented 2 months ago

Hi JQ,

Have you installed the environment successfully before running the script run.sh?

wangjiaqi8710 commented 2 months ago

Hi JQ,

Have you installed the environment successfully before running the script run.sh?

I run the $bash install.sh, and it runs normally. I then have to go to the SaprotHub-main directory to run $bash local_server/run.sh


The version is not the latest. Updating... HEAD is now at 23a69ad No public description Already up to date. ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' WARNING: Skipping saprot as it is not installed.


| | | |_ | | | | __ | || | ' \/ / _ | / -) _/| ./_,_,|_\| |_|

Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.

https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html

Please note that updating to Notebook 7 might break some of your extensions.

[I 15:08:37.328 NotebookApp] Loading IPython parallel extension [I 15:08:37.331 NotebookApp] Serving notebooks from local directory: /home/dc/.cache/SaprotHub/colabtools [I 15:08:37.331 NotebookApp] Jupyter Notebook 6.5.5 is running at: [I 15:08:37.331 NotebookApp] http://localhost:8888/?token=175d42a [I 15:08:37.331 NotebookApp] or http://127.0.0.1:8888/?token=175d42a [I 15:08:37.331 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 15:08:37.376 NotebookApp]

To access the notebook, open this file in a browser:
    file:///home/dc/.local/share/jupyter/runtime/nbserver-90025-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/?token=175d42a
 or http://127.0.0.1:8888/?token=175d42a

It complains that saprot is not installed though, is that because it can find "requirements.txt", but even I run the command $bash run.sh, it stills complains cannot find the "requirements.txt". But this file is in the folder (local_server). How to fix the problem?

LTEnjoy commented 2 months ago

Maybe you should first go into the local_server directory? The system assumes you are in this directory and finds files using relative path.

wangjiaqi8710 commented 2 months ago

when I run $bash run.sh in local_server, it complains the same thing.


The version is not the latest. Updating... HEAD is now at 23a69ad No public description Already up to date. ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' WARNING: Skipping saprot as it is not installed.


| | | |_ | | | | __ | || | ' \/ / _ | / -) _/| ./_,_,|_\| |_|

Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.

https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html

Please note that updating to Notebook 7 might break some of your extensions.

[I 15:25:26.587 NotebookApp] Loading IPython parallel extension [I 15:25:26.592 NotebookApp] Serving notebooks from local directory: /home/dc/.cache/SaprotHub [I 15:25:26.592 NotebookApp] Jupyter Notebook 6.5.5 is running at: [I 15:25:26.592 NotebookApp] http://jqlab:12315/?token=... [I 15:25:26.592 NotebookApp] or http://127.0.0.1:12315/?token=... [I 15:25:26.592 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).


And moreover, no jupyternote book is launched when I run the $bash run.sh in the local_server folder.

JQ

LTEnjoy commented 2 months ago

Can you run the installation from scratch in the local_server directory? Also, it looks like the jupyter notebook runs normally as expected. image

wangjiaqi8710 commented 2 months ago

Ok, I have tried to install from scratch.

I have first modify the install.sh to make a directory for cache in /home/dc/.cache/SaprotHub instead of /root/.cache/SaprotHub, the modified install.sh script is as below

!/bin/bash

conda create -n SaprotHub python=3.10 --yes source activate SaprotHub

mkdir -p /home/dc/.cache/SaprotHub

Install packages

git clone https://github.com/googlecolab/colabtools.git /home/dc/.cache/SaprotHub/colabtools pip install /home/dc/.cache/SaprotHub/colabtools/ pip install -r ./requirements.txt

Overwrite files for properly calling colab

colab_dir=$CONDA_PREFIX/lib/python3.10/site-packages/google/colab cp ./data_table.py $colab_dir/data_table.py cp ./_reprs.py $colab_dir/_reprs.py

This step work normally. Next, I also modify the run.sh script to change "/root/.cache" to "/home/dc/.cache" accordingly, then

$bash run.sh

in the local_server directory, and it comes out with error message

[C 09:19:40.456 NotebookApp] Bad config encountered during initialization: No such notebook dir: ''/root/.cache/SaprotHub''


!/bin/bash

source activate SaprotHub

Checkout the version in the cache

ori_dir=$(pwd) if [ -d "/home/dc/.cache/SaprotHub/SaprotHub" ];then cd /home/dc/.cache/SaprotHub/SaprotHub local=$(git rev-parse HEAD) remote=$(git ls-remote https://github.com/westlake-repl/SaprotHub.git | grep HEAD) remote=(${remote//,/ }[0]) if [ "$local" != "$remote" ]; then echo "The version is not the latest. Updating..." git fetch --all && git reset --hard origin/main && git pull pip install -r local_server/requirements.txt pip uninstall saprot --yes fi fi

Run the server

jupyter notebook --config $ori_dir/jupyter_notebook_config.py --allow-root

Do you think anything I am doing wrong? As if I don't change the /root to /home/dc directory, in the first step $bash install.sh, it will complain about the root access and won't install the environment correctly.

But I failed in the $bash run.sh step.

Best wishes, JQ

LTEnjoy commented 2 months ago

Hi,

You also have to change the cache directory in jupyter_notebook_config.py and then everything should be OK。

wangjiaqi8710 commented 2 months ago

Ok, "$bash run.sh" works, but it did not provide the local server and connectable address. the message it gives as below


Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.

https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html

Please note that updating to Notebook 7 might break some of your extensions.

[I 11:30:04.460 NotebookApp] Loading IPython parallel extension [I 11:30:04.462 NotebookApp] Serving notebooks from local directory: /home/dc/.cache/SaprotHub [I 11:30:04.462 NotebookApp] Jupyter Notebook 6.5.5 is running at: [I 11:30:04.462 NotebookApp] http://jqlab:12315/?token=... [I 11:30:04.462 NotebookApp] or http://127.0.0.1:12315/?token=... [I 11:30:04.462 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

The "..." following "http://127.0.0.1:12315/?token=" is exactly what shows in the terminal. may I know how to deal with it?

Thanks.

JQ

LTEnjoy commented 2 months ago

And then you can follow the instructions to connect to you local server as here:

image

wangjiaqi8710 commented 2 months ago

Screenshot from 2024-09-07 12-47-06 I have tried and the connect button is disabled in this way. Please see attached picture. I also noticed that when I typed $bash run.sh, no web browser page was launched. Is this normal?

JQ

LTEnjoy commented 2 months ago

Is your server remote? If your server is a remote server, you have to follow the optional step and then input identically as the instruction does.

wangjiaqi8710 commented 2 months ago

It is the same computer that I launch the colabsaprot webpage.

JQ

LTEnjoy commented 2 months ago

Could you set the IP address to 127.0.0.1 to see if it works?

wangjiaqi8710 commented 2 months ago

ok, now it works by set the IP address to 127.0.0.1, but again when I clicked the run button to install saprot, it ends up with error


Installing SaProt... Cloning into 'SaprotHub'... remote: Enumerating objects: 1609, done. remote: Counting objects: 100% (772/772), done. remote: Compressing objects: 100% (372/372), done. error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8) error: 2740 bytes of body are still expected fetch-pack: unexpected disconnect while reading sideband packet fatal: early EOF fatal: fetch-pack: invalid index-pack output

ModuleNotFoundError Traceback (most recent call last) in <cell line: 114>() 112 from transformers.models.esm.openfold_utils.feats import atom14_to_atom37 113 from string import ascii_uppercase,ascii_lowercase --> 114 from saprot.utils.mpr import MultipleProcessRunnerSimplifier 115 from saprot.data.parse import get_chain_ids 116 from saprot.scripts.training import my_load_model

ModuleNotFoundError: No module named 'saprot'

Do you think what is the problem and how can I troubleshoot

JQ

LTEnjoy commented 2 months ago

Looks like it ran into an error when installing saprot through git commands. Could you try manually cloning the repo to see whether it works?

wangjiaqi8710 commented 2 months ago

following the above reported problem, in the colabsaprot site, when I clicked the run button to install saprot, my terminal showed error message as below

[W 13:27:30.683 NotebookApp] 404 OPTIONS /api/colab/build-info?token=SaprotHub (127.0.0.1) 16.920000ms referer=https://colab.research.google.com/ [W 13:27:30.685 NotebookApp] 404 GET /api/colab/build-info?token=SaprotHub (127.0.0.1) 0.720000ms referer=https://colab.research.google.com/ [I 13:27:30.725 NotebookApp] Kernel started: 75e63041-a962-4f35-8f6d-8eb3d8ed3acd, name: python3 ERROR: Could not open requirements file: [Errno 2] No such file or directory: '/home/dc/.cache/SaprotHub/SaprotHub/requirements.txt' ERROR: Invalid requirement: '/home/dc/.cache/SaprotHub/SaprotHub': Expected package name at the start of dependency specifier /home/dc/.cache/SaprotHub/SaprotHub ^ Hint: It looks like a path. File '/home/dc/.cache/SaprotHub/SaprotHub' does not exist. chmod: cannot access '/home/dc/.cache/SaprotHub/SaprotHub/bin/*': No such file or directory

Can I do something to fix the problem here?

If I would like to install saprot through git command, where should I install it?

Best wishes, JQ

LTEnjoy commented 2 months ago

You could git clone the SaprotHub repo in /home/dc/.cache/SaprotHub/ and then rerun the installation button. I think the problem is that your computer cannot successfully clone the repo so the later installation would fail.