Jupyter Notebook's terminal command not using correct conda environment
I have 2 conda environments installed:
- env1
: base environment where jupyter-notebook is installed and started from
- env2
: project environment with ipykernel installed
I manually added kernelspecs for the 2 environments following this guide.
Everything works fine. sys.executable
in 2 kernels show separate, correct paths. But for terminal commands (i.e. !which python
), no matter which kernel I'm running in the environment defaults to env1
.
Is there any way to have the notebook automatically change this to the kernel's environment?
P.S. I already tried installing nb_conda, nb_conda_kernels
python jupyter-notebook conda
add a comment |
I have 2 conda environments installed:
- env1
: base environment where jupyter-notebook is installed and started from
- env2
: project environment with ipykernel installed
I manually added kernelspecs for the 2 environments following this guide.
Everything works fine. sys.executable
in 2 kernels show separate, correct paths. But for terminal commands (i.e. !which python
), no matter which kernel I'm running in the environment defaults to env1
.
Is there any way to have the notebook automatically change this to the kernel's environment?
P.S. I already tried installing nb_conda, nb_conda_kernels
python jupyter-notebook conda
add a comment |
I have 2 conda environments installed:
- env1
: base environment where jupyter-notebook is installed and started from
- env2
: project environment with ipykernel installed
I manually added kernelspecs for the 2 environments following this guide.
Everything works fine. sys.executable
in 2 kernels show separate, correct paths. But for terminal commands (i.e. !which python
), no matter which kernel I'm running in the environment defaults to env1
.
Is there any way to have the notebook automatically change this to the kernel's environment?
P.S. I already tried installing nb_conda, nb_conda_kernels
python jupyter-notebook conda
I have 2 conda environments installed:
- env1
: base environment where jupyter-notebook is installed and started from
- env2
: project environment with ipykernel installed
I manually added kernelspecs for the 2 environments following this guide.
Everything works fine. sys.executable
in 2 kernels show separate, correct paths. But for terminal commands (i.e. !which python
), no matter which kernel I'm running in the environment defaults to env1
.
Is there any way to have the notebook automatically change this to the kernel's environment?
P.S. I already tried installing nb_conda, nb_conda_kernels
python jupyter-notebook conda
python jupyter-notebook conda
edited Dec 7 '18 at 3:52
Nguyễn Trọng Tín
asked Nov 23 '18 at 5:12
Nguyễn Trọng TínNguyễn Trọng Tín
8310
8310
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
install nb_conda and nb_conda_kernels into your base.
conda install nb_conda nb_conda_kernels -n env1
This should give you the ability to change kernel in jupyter, and use the env2 kernel.
This does not work. In fact I already had these 2 packages from before.
– Nguyễn Trọng Tín
Dec 7 '18 at 3:51
Can you try listing kernelspecs? jupyter kernelspec list
– emmet02
Dec 7 '18 at 9:41
python3 /home/ec2-user/miniconda3/envs/airflow3/lib/python3.6/site-p ackages/ipykernel/resources | airflow3 /home/ec2-user/.local/share/jupyter/kernels/airflow3 | data_interface /home/ec2-user/.local/share/jupyter/kernels/data_interface
– Nguyễn Trọng Tín
Dec 7 '18 at 9:52
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440940%2fjupyter-notebooks-terminal-command-not-using-correct-conda-environment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
install nb_conda and nb_conda_kernels into your base.
conda install nb_conda nb_conda_kernels -n env1
This should give you the ability to change kernel in jupyter, and use the env2 kernel.
This does not work. In fact I already had these 2 packages from before.
– Nguyễn Trọng Tín
Dec 7 '18 at 3:51
Can you try listing kernelspecs? jupyter kernelspec list
– emmet02
Dec 7 '18 at 9:41
python3 /home/ec2-user/miniconda3/envs/airflow3/lib/python3.6/site-p ackages/ipykernel/resources | airflow3 /home/ec2-user/.local/share/jupyter/kernels/airflow3 | data_interface /home/ec2-user/.local/share/jupyter/kernels/data_interface
– Nguyễn Trọng Tín
Dec 7 '18 at 9:52
add a comment |
install nb_conda and nb_conda_kernels into your base.
conda install nb_conda nb_conda_kernels -n env1
This should give you the ability to change kernel in jupyter, and use the env2 kernel.
This does not work. In fact I already had these 2 packages from before.
– Nguyễn Trọng Tín
Dec 7 '18 at 3:51
Can you try listing kernelspecs? jupyter kernelspec list
– emmet02
Dec 7 '18 at 9:41
python3 /home/ec2-user/miniconda3/envs/airflow3/lib/python3.6/site-p ackages/ipykernel/resources | airflow3 /home/ec2-user/.local/share/jupyter/kernels/airflow3 | data_interface /home/ec2-user/.local/share/jupyter/kernels/data_interface
– Nguyễn Trọng Tín
Dec 7 '18 at 9:52
add a comment |
install nb_conda and nb_conda_kernels into your base.
conda install nb_conda nb_conda_kernels -n env1
This should give you the ability to change kernel in jupyter, and use the env2 kernel.
install nb_conda and nb_conda_kernels into your base.
conda install nb_conda nb_conda_kernels -n env1
This should give you the ability to change kernel in jupyter, and use the env2 kernel.
answered Nov 26 '18 at 13:52
emmet02emmet02
68417
68417
This does not work. In fact I already had these 2 packages from before.
– Nguyễn Trọng Tín
Dec 7 '18 at 3:51
Can you try listing kernelspecs? jupyter kernelspec list
– emmet02
Dec 7 '18 at 9:41
python3 /home/ec2-user/miniconda3/envs/airflow3/lib/python3.6/site-p ackages/ipykernel/resources | airflow3 /home/ec2-user/.local/share/jupyter/kernels/airflow3 | data_interface /home/ec2-user/.local/share/jupyter/kernels/data_interface
– Nguyễn Trọng Tín
Dec 7 '18 at 9:52
add a comment |
This does not work. In fact I already had these 2 packages from before.
– Nguyễn Trọng Tín
Dec 7 '18 at 3:51
Can you try listing kernelspecs? jupyter kernelspec list
– emmet02
Dec 7 '18 at 9:41
python3 /home/ec2-user/miniconda3/envs/airflow3/lib/python3.6/site-p ackages/ipykernel/resources | airflow3 /home/ec2-user/.local/share/jupyter/kernels/airflow3 | data_interface /home/ec2-user/.local/share/jupyter/kernels/data_interface
– Nguyễn Trọng Tín
Dec 7 '18 at 9:52
This does not work. In fact I already had these 2 packages from before.
– Nguyễn Trọng Tín
Dec 7 '18 at 3:51
This does not work. In fact I already had these 2 packages from before.
– Nguyễn Trọng Tín
Dec 7 '18 at 3:51
Can you try listing kernelspecs? jupyter kernelspec list
– emmet02
Dec 7 '18 at 9:41
Can you try listing kernelspecs? jupyter kernelspec list
– emmet02
Dec 7 '18 at 9:41
python3 /home/ec2-user/miniconda3/envs/airflow3/lib/python3.6/site-p ackages/ipykernel/resources | airflow3 /home/ec2-user/.local/share/jupyter/kernels/airflow3 | data_interface /home/ec2-user/.local/share/jupyter/kernels/data_interface
– Nguyễn Trọng Tín
Dec 7 '18 at 9:52
python3 /home/ec2-user/miniconda3/envs/airflow3/lib/python3.6/site-p ackages/ipykernel/resources | airflow3 /home/ec2-user/.local/share/jupyter/kernels/airflow3 | data_interface /home/ec2-user/.local/share/jupyter/kernels/data_interface
– Nguyễn Trọng Tín
Dec 7 '18 at 9:52
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440940%2fjupyter-notebooks-terminal-command-not-using-correct-conda-environment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown