how to run qiime2 in Jupiter notebook?

How do I run a chime on the Jupyter notebook? I want to show you the process of executing the command by executing the chime on the Jupyter notebook at once.

Option 1. Activate qiime2 environment and install jupyter notebook there.

Option 2. If jupyter notebook should be launched outside of environment, you need to install nb-kernels in "base":

conda install -n notebook_env nb_conda_kernels

and then inside of qiime2 env:

conda install -c anaconda ipykernel

In this case you will be able to choose qiime2 kernel in the notebook from "base".

When launched, qiime2 commands can be executed by providing "!" sign at the beginning of the first line of the command, or by using qiime2 python API.


Thank you for your answer!!
Is there any other way to run qiime without changing the kernel after running the jupyter notebook?

The kernel change method is not the method that the boss wants, and the first method can finally be implemented directly in the base environment. Because you need to create a py file (that is, a python script file).

Unfortunately, I am not aware of such options. I will leave your topic queued so other mods or expirienced users may jump in in case if they have some ideas / solutions to share.

Thank you @timanix !
I changed the kernel and ran it the way you taught me Is this how it works? What should I do if I want to apply the qiime cutadapt option here?

Is it right to enter the command as you do in the terminal? It won't run.
Please give me some advice

I think right now your command is a mixture of Python API and CLI version, you should use one in one command with qiime2 kernel - or Python API or CLI.

For the right syntax you can refer to the Moving pictures tutorial with "!" at the begining of the command for CLI version (not for API).

Thank you!!!
Thanks to you, it's getting solved little by little.
I'd like to write a command in the API version, where can I find an example of an API command?

For example, I want to write commands that I used to write in the cmd window in an api way, but I'm not sure how to write code.

I don't know how to write this next command.
How should I write input and output? Can I also specify a directory to be saved in output?

Is this how I did it? (Note, mani_visual is a .qza file that is stored with the path.)

Finally, I want to save the qza file which is output of cutadapt in the directory I specify.
Then, how do I write subcommands?

Is there any way to find this command method? For example, if you do qiime --help in the cmd window, you'll see how it should be written

Anyway, thank you so much for your help @timanix

I've merged these two topics because I think they are similar.

Remember to be patient. Please don't post the same question twice.


Hi @rbfks100333,

Check out our developer documentation here - we have a Python API (our Artifact API in the docs) with plenty of examples listed there that should help get you started. Hope this helps! Cheers :lizard:


It's also possible to see API commands illustrated in our multi-interface tutorials, one of which @timanix linked you to earlier. The best starting point is probably that one - the multi-interface version of the Moving Pictures tutorial.

By default, you'll see the q2cli (command line) commands. However, if you select Python 3 API in the Interfaces dropdown box, the command blocks in the tutorial will be updated to show how to achieve the same thing with Python 3 API calls:

Screenshot 2022-11-16 at 4.48.36 PM


Thank you. I solved the problem using the api method!


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.