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

python package #11

Open
gabor1 opened this issue Jan 30, 2020 · 13 comments
Open

python package #11

gabor1 opened this issue Jan 30, 2020 · 13 comments

Comments

@gabor1
Copy link
Collaborator

gabor1 commented Jan 30, 2020

hi guys!

What is the plan and timescale of making this an installable python package? We are trying to use ASAP in a toolchain together with other tools, and finding it more difficult to work with it as is, paths need to be set specially etc. All this would go away if ASAP was installable as a python package.

@BingqingCheng
Copy link
Owner

We'll need to discuss a bit about this. Do you mean that you want to import ASAP as a library? IMO, given the current design, it makes more sense to add a script to install it (aka. adding the location of the package to PYTHONPATH).

@gabor1
Copy link
Collaborator Author

gabor1 commented Jan 31, 2020 via email

@BingqingCheng
Copy link
Owner

Okay. I see. I'll dig up on how to do this.

@gabor1
Copy link
Collaborator Author

gabor1 commented Feb 2, 2020 via email

@Ryan-Rhys
Copy link
Collaborator

I've created a mock python package for ASAP on TestPyPI:

https://test.pypi.org/project/ASAP/

scripts are executable via the os.system() method. If this feature is satisfactory I can make a 'proper' python package that will install third-party dependencies like numpy!

@BingqingCheng
Copy link
Owner

Fantastic. I tried it, seems to be working great!

@gabor1
Copy link
Collaborator Author

gabor1 commented Feb 3, 2020 via email

@Ryan-Rhys
Copy link
Collaborator

Are the commands findable with this package?

https://test.pypi.org/project/ASAP2/0.0.3/

@gabor1
Copy link
Collaborator Author

gabor1 commented Feb 3, 2020 via email

@Ryan-Rhys
Copy link
Collaborator

Yep, this is a problem because the scripts will be run by the system python. I'll look into how to ensure that they're run by the venv python!

@Ryan-Rhys
Copy link
Collaborator

Apologies for the delay in responding; I have two conference submission deadlines over the coming two weeks and so these are demanding most of my attention!

With a command such as:

pip install -i https://test.pypi.org/simple/ ASAP2==0.0.3 --install-option="--install-scripts=path/to/custom_script_location"

it should be possible to specify a custom path to house the scripts. I can create a temporary python package on TestPyPi (@BingqingCheng presumably we're not ready to release on PyPi) now if this would substantially speed up your workflow?

@Wangmumu0403
Copy link

I have trouble in asap select

asap select  -n 100 -f dataset.xyz

then shows error

load xyz file:  dataset.xyz , a total of  3052 frames , a total of  439488 atoms , with elements:  [3, 5, 8] .
Find the following descriptor names that match the specifications:  ['']
Traceback (most recent call last):
  File "/home/hp/.local/lib/python3.8/site-packages/asaplib-0.0.1-py3.8.egg/asaplib/data/xyz.py", line 448, in get_descriptors
  File "<__array_function__ internals>", line 5, in hstack
  File "/usr/lib/python3/dist-packages/numpy/core/shape_base.py", line 337, in hstack
    arrs = atleast_1d(*tup)
  File "/home/hp/.local/lib/python3.8/site-packages/asaplib-0.0.1-py3.8.egg/asaplib/data/xyz.py", line 449, in <genexpr>
  File "/home/hp/.local/lib/python3.8/site-packages/asaplib-0.0.1-py3.8.egg/asaplib/data/xyz.py", line 449, in <listcomp>
KeyError: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hp/.local/bin/asap", line 11, in <module>
    load_entry_point('asaplib==0.0.1', 'console_scripts', 'asap')()
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/hp/.local/lib/python3.8/site-packages/asaplib-0.0.1-py3.8.egg/asaplib/cli/cmd_asap.py", line 72, in select
  File "/home/hp/.local/lib/python3.8/site-packages/asaplib-0.0.1-py3.8.egg/asaplib/cli/func_asap.py", line 80, in read_xyz_n_dm
  File "/home/hp/.local/lib/python3.8/site-packages/asaplib-0.0.1-py3.8.egg/asaplib/data/xyz.py", line 452, in get_descriptors
IndexError: list index out of range

@BingqingCheng
Copy link
Owner

BingqingCheng commented Mar 3, 2022 via email

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

4 participants