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

%aiida ipython magic broken? #4547

Closed
ltalirz opened this issue Nov 6, 2020 · 3 comments · Fixed by #4548
Closed

%aiida ipython magic broken? #4547

ltalirz opened this issue Nov 6, 2020 · 3 comments · Fixed by #4548
Assignees

Comments

@ltalirz
Copy link
Member

ltalirz commented Nov 6, 2020

Describe the bug

It seems the instructions for enabling the %aiida ipython magic are broken.

Steps to reproduce

  1. pip install aiida-core[notebook]
  2. Copy the snippet from the documentation into ~/.ipython/profile_default/startup/aiida_magics.py
  3. Start ipython shell
  4. Run %aiida
In [1]: %aiida
UsageError: Line magic function `%aiida` not found.

Expected behavior

The magics are enabled.

Furthermore, it seems the snippet in the docs is outdated wrt to the one in the codebase (but neither work).

The ipython magics is already listed as one of the few remaining offenders of completely untested code: #2835

Your environment

  • Operating system [e.g. Linux]: MacOS
  • Python version [e.g. 3.7.1]: 3.7
  • aiida-core version [e.g. 1.2.1]: 1.4.2
@ltalirz
Copy link
Member Author

ltalirz commented Nov 6, 2020

I correct myself: When testing locally, I discovered a file ~/.ipython/profile_default/startup/aiida.py (probably left over from a long time ago). This obviously has the potential to confuse import aiida ;-)

The steps from the documentation seem to work fine, as does the current aiida_ipython_magics.py file from the aiida-core repo.

In [1]: %aiida
Out[1]:
Loaded AiiDA DB environment - profile name: nanoporous_pipeline.

We should still update the snippet from the docs to coincide with the code from the repo (and eventually test it).
Will take care of the first part; perhaps also the second.

@ltalirz ltalirz self-assigned this Nov 6, 2020
@hududed
Copy link

hududed commented Nov 6, 2020

Hi Leo, I had this problem

In [1]: %aiida
UsageError: Line magic function `%aiida` not found.

following the updated documentation for aiida 1.4.2 here.

I restarted the kernel and made sure the correct ipython is run for the environment. Still not working.

Then I pip install aiida-core[notebook] and restarted the kernel and cleared output, and now it works. So either the pip install helped, or restarted the kernel+clear output.

@ltalirz
Copy link
Member Author

ltalirz commented Nov 6, 2020

@hududed if pip install aiida-core[notebook] solved the problem, then the issue was likely that the ipython executable you were using was not the one from the AiiDA python environment.

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

Successfully merging a pull request may close this issue.

2 participants