i2bc / SURFMAP

Other
20 stars 3 forks source link

[Bug]: APBS not recognized from a local installation #18

Open nchenche opened 6 months ago

nchenche commented 6 months ago

Operating System

Unix (e.g., Ubuntu 20.04)

Version

2.0.0

Python Version (optional)

3.7

Python Virtual Environment

Conda (or related)

Execution Environment

Local environment after installation of all external dependencies

Bug Description

I installed the APBS software from "https://apbs.readthedocs.io/en/latest/releases.html#apbs-3-4-1-apr-2022". After installation, I typed "apbs" and it worked well. But when I used "surfmap -pdb foo.pdb -tomap electrostatics", it presented an error (see relevant log output).

It seems like surfmap could not find "APBS", and I'm not sure why.

Is there anything I can do to resolve this problem? Your assistance would be greatly appreciated. Sorry for bringing you so many problems. Thank you again for your time.

Steps to Reproduce

  1. Install apbs as described here: https://apbs.readthedocs.io/en/latest/releases.html#apbs-3-4-1-apr-2022
  2. run surfmap for electrostatics computation: surfmap -pdb foo.pdb -tomap electrostatics

Relevant Log Output

SURFACE MAPPING OF THE ELECTROSTATICS PROPERTY
Step 1: computing a shell around the protein surface
Step 2: computing electrostatics potential
Traceback (most recent call last):
File "/home/xielong/miniconda3/envs/surfmap/bin/surfmap", line 8, in
sys.exit(main())
File "/home/xielong/miniconda3/envs/surfmap/lib/python3.7/site-packages/surfmap/bin/surfmap.py", line 63, in main
surfmap_local(params=params)
File "/home/xielong/miniconda3/envs/surfmap/lib/python3.7/site-packages/surfmap/bin/surfmap.py", line 18, in surfmap_local
surfmap_from_pdb(params=params)
File "/home/xielong/miniconda3/envs/surfmap/lib/python3.7/site-packages/surfmap/lib/core.py", line 169, in surfmap_from_pdb
shell = run_compute_electrostatics(pdb_filename=params.pdbarg, csv_filename=csv_coords, force_field=params.force_field, pqr_filename=params.pqr, out_dir=outdir_elec)
File "/home/xielong/miniconda3/envs/surfmap/lib/python3.7/site-packages/surfmap/tools/compute_electrostatics.py", line 93, in run
PATH_APBS = Path(os.getenv("APBS"))
File "/home/xielong/miniconda3/envs/surfmap/lib/python3.7/pathlib.py", line 1027, in new
self = cls._from_parts(args, init=False)
File "/home/xielong/miniconda3/envs/surfmap/lib/python3.7/pathlib.py", line 674, in _from_parts
drv, root, parts = self._parse_args(args)
File "/home/xielong/miniconda3/envs/surfmap/lib/python3.7/pathlib.py", line 658, in _parse_args
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Additional context (optional)

No response

Confirmation

nchenche commented 6 months ago

surfmap is looking at an environment variable named "APBS" to get the path of the directory containing APBS executable and libraries. It seems that this variable does not exist on your system.

  1. check if the variable exists: echo $APBS (it should return nothing)
  2. add the APBS env variable in your /home/xielong/.bashrc (or /home/xielong/.profile):
    • note the directory where you have installed APBS (mine is: /home/nchenche/projects/SURFMAP/softwares/APBS-3.4.1.Linux
    • create an alias in your .bashrc file ; mine looks like this (adapt the path of the directory): export APBS="$HOME/projects/SURFMAP/softwares/APBS-3.4.1.Linux"
  3. type source ~/.bashrc

Then you should be ok to run surfmap as you wanted.

Please let me know if it works.

Biosuperkitty commented 6 months ago

Thank you for your prompt response. I have made the following additions to the end of the ~/.bashrc file and rerun the software:

Adding APBS path

export LD_LIBRARY_PATH=/home/xielong/software/APBS/APBS-3.4.1.Linux/lib:${LD_LIBRARY_PATH} export PATH=/home/xielong/software/APBS/APBS-3.4.1.Linux/bin:${PATH} export APBS="/home/xielong/software/APBS/APBS-3.4.1.Linux"

However, when run, an error occurred during the execution, presenting the following message:

SURFACE MAPPING OF THE ELECTROSTATICS PROPERTY Step 1: computing a shell around the protein surface Step 2: computing electrostatic potential An error occurred during the inputgen command, and the process has been halted. Status: 1

It appears to be a recurring issue.

Thank you for taking the time to read this message again.

Happy New Year! Although my wishes may be arriving a bit late, I assure you that they are nonetheless the best and most heartfelt.

nchenche commented 6 months ago

Dear Xielong,

Happy new year too.

Could you please run the same command adding the following option -verbose 2 ?

Thanks

shuchingou commented 3 weeks ago

Hi nchenche,

I ran into the same problem and I think it is due to this bug: https://github.com/Electrostatics/apbs/issues/290

I manually modified the psize.py in apbs by changing

if nsmall <= 0:

to

if nsmall[i] <= 0:

then I got a new error:

SURFACE MAPPING OF THE ELECTROSTATICS PROPERTY
Step 1: computing a shell around the protein surface
Step 2: computing electrostatics potential
Traceback (most recent call last):
  File "/home/ousc/miniconda3/envs/surfmap/bin/surfmap", line 33, in <module>
    sys.exit(load_entry_point('surfmap', 'console_scripts', 'surfmap')())
  File "/home/ousc/SURFMAP/surfmap/bin/surfmap.py", line 63, in main
    surfmap_local(params=params)
  File "/home/ousc/SURFMAP/surfmap/bin/surfmap.py", line 18, in surfmap_local
    surfmap_from_pdb(params=params)
  File "/home/ousc/SURFMAP/surfmap/lib/core.py", line 180, in surfmap_from_pdb
    shell = run_compute_electrostatics(pdb_filename=params.pdbarg, csv_filename=csv_coords, force_field=params.force_field, pqr_filename=params.pqr, out_dir=outdir_elec)
  File "/home/ousc/SURFMAP/surfmap/tools/compute_electrostatics.py", line 162, in run
    io_apbs.unlink(missing_ok=True)
TypeError: unlink() got an unexpected keyword argument 'missing_ok'

So I removed missing_ok=True from compute_eletrostatics.py and everything works perfectly.

Hope that helps.

nchenche commented 3 weeks ago

Hi @shuchingou,

Actually the error about the "missing_ok" is related to your python version, since this method was added to pathlib in python version 3.8. It's good to know even though, so thanks.

About the electrostatics install issue, it is directly on the side of the APBS developers, we can't do much. That is the reason we recommend to use the SURFMAP docker image to prevent users from encountering issues with APBS installation.

Thanks again for your help,

Bests