reticulate ImportError: No module named pandas in Rstudio version 1.2
I am trying to use the reticulate package in a Rmd file. I first created a setup chunk as follows:
library(reticulate)
use_virtualenv("r-reticulate")
use_python("C:\Python27")
Then I import pandas
:
#importing libraries
import pandas
ImportError: No module named pandas
Detailed traceback:
File "<string>", line 1, in <module>
I have checked that pandas is already installed from the python command line. Why am I getting an import error here?
python r reticulate
add a comment |
I am trying to use the reticulate package in a Rmd file. I first created a setup chunk as follows:
library(reticulate)
use_virtualenv("r-reticulate")
use_python("C:\Python27")
Then I import pandas
:
#importing libraries
import pandas
ImportError: No module named pandas
Detailed traceback:
File "<string>", line 1, in <module>
I have checked that pandas is already installed from the python command line. Why am I getting an import error here?
python r reticulate
2
Silly question, but did you installpandas
while the virtualenv was active?
– CodeSpent
Jan 18 at 22:25
@CodeSpent thanks for your comment. I guess I updated it to make sure that it was installed. Was that the culprit? What should I do now?
– umair durrani
Jan 18 at 23:35
1
Well your virtualenv is isolating your application, so justpip install pandas
from inside your virtualenv.
– CodeSpent
Jan 18 at 23:39
1
Where do I dopip install pandas
? Python does not recognize that. I can only do that in cmd on Windows and I am not sure if there is a cmd engine in knitr. Sorry, I am an R user and still learning Python.
– umair durrani
Jan 18 at 23:44
1
Added an answer, let me know if that works or if you need some more clarification. :)
– CodeSpent
Jan 18 at 23:53
add a comment |
I am trying to use the reticulate package in a Rmd file. I first created a setup chunk as follows:
library(reticulate)
use_virtualenv("r-reticulate")
use_python("C:\Python27")
Then I import pandas
:
#importing libraries
import pandas
ImportError: No module named pandas
Detailed traceback:
File "<string>", line 1, in <module>
I have checked that pandas is already installed from the python command line. Why am I getting an import error here?
python r reticulate
I am trying to use the reticulate package in a Rmd file. I first created a setup chunk as follows:
library(reticulate)
use_virtualenv("r-reticulate")
use_python("C:\Python27")
Then I import pandas
:
#importing libraries
import pandas
ImportError: No module named pandas
Detailed traceback:
File "<string>", line 1, in <module>
I have checked that pandas is already installed from the python command line. Why am I getting an import error here?
python r reticulate
python r reticulate
asked Jan 18 at 21:52
umair durraniumair durrani
1,90022246
1,90022246
2
Silly question, but did you installpandas
while the virtualenv was active?
– CodeSpent
Jan 18 at 22:25
@CodeSpent thanks for your comment. I guess I updated it to make sure that it was installed. Was that the culprit? What should I do now?
– umair durrani
Jan 18 at 23:35
1
Well your virtualenv is isolating your application, so justpip install pandas
from inside your virtualenv.
– CodeSpent
Jan 18 at 23:39
1
Where do I dopip install pandas
? Python does not recognize that. I can only do that in cmd on Windows and I am not sure if there is a cmd engine in knitr. Sorry, I am an R user and still learning Python.
– umair durrani
Jan 18 at 23:44
1
Added an answer, let me know if that works or if you need some more clarification. :)
– CodeSpent
Jan 18 at 23:53
add a comment |
2
Silly question, but did you installpandas
while the virtualenv was active?
– CodeSpent
Jan 18 at 22:25
@CodeSpent thanks for your comment. I guess I updated it to make sure that it was installed. Was that the culprit? What should I do now?
– umair durrani
Jan 18 at 23:35
1
Well your virtualenv is isolating your application, so justpip install pandas
from inside your virtualenv.
– CodeSpent
Jan 18 at 23:39
1
Where do I dopip install pandas
? Python does not recognize that. I can only do that in cmd on Windows and I am not sure if there is a cmd engine in knitr. Sorry, I am an R user and still learning Python.
– umair durrani
Jan 18 at 23:44
1
Added an answer, let me know if that works or if you need some more clarification. :)
– CodeSpent
Jan 18 at 23:53
2
2
Silly question, but did you install
pandas
while the virtualenv was active?– CodeSpent
Jan 18 at 22:25
Silly question, but did you install
pandas
while the virtualenv was active?– CodeSpent
Jan 18 at 22:25
@CodeSpent thanks for your comment. I guess I updated it to make sure that it was installed. Was that the culprit? What should I do now?
– umair durrani
Jan 18 at 23:35
@CodeSpent thanks for your comment. I guess I updated it to make sure that it was installed. Was that the culprit? What should I do now?
– umair durrani
Jan 18 at 23:35
1
1
Well your virtualenv is isolating your application, so just
pip install pandas
from inside your virtualenv.– CodeSpent
Jan 18 at 23:39
Well your virtualenv is isolating your application, so just
pip install pandas
from inside your virtualenv.– CodeSpent
Jan 18 at 23:39
1
1
Where do I do
pip install pandas
? Python does not recognize that. I can only do that in cmd on Windows and I am not sure if there is a cmd engine in knitr. Sorry, I am an R user and still learning Python.– umair durrani
Jan 18 at 23:44
Where do I do
pip install pandas
? Python does not recognize that. I can only do that in cmd on Windows and I am not sure if there is a cmd engine in knitr. Sorry, I am an R user and still learning Python.– umair durrani
Jan 18 at 23:44
1
1
Added an answer, let me know if that works or if you need some more clarification. :)
– CodeSpent
Jan 18 at 23:53
Added an answer, let me know if that works or if you need some more clarification. :)
– CodeSpent
Jan 18 at 23:53
add a comment |
1 Answer
1
active
oldest
votes
It appears pandas
is not installed in your virtualenv. It may be on your machine, but your virtualenv isolates your application from the rest of your machine.
While your virtualenv is active:
- Open cmd/bash
- Run
pip install pandas
Now pandas
should be available to you within this env
. Later you can generate a requirements.txt
file that makes dependency management much easier.
Thanks for your help, however, this didn't work for me. I first didlibrary(reticulate) use_virtualenv("r-reticulate") use_python("C:\Python27")
. Thenpip install pandas
in cmd showed that requirement is already satisfied. Then I ran thepython
chunkimport pandas
. However, I still getImportError: No module named pandas
. I have also tried closing and re-opening rstudio but to no avail.
– umair durrani
Jan 19 at 0:00
1
What about tryingpy_install("pandas")
?
– CodeSpent
Jan 19 at 0:07
NameError: name 'py_install' is not defined
– umair durrani
Jan 19 at 0:10
1
Hmm. According to this article that's the proper way of installing python packages.
– CodeSpent
Jan 19 at 0:12
1
I've tried all the options and somehow managed to fail everytime! Gonna watch youtube videos on reticulate now. Thanks for your help @CodeSpent
– umair durrani
Jan 19 at 1:23
|
show 2 more comments
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%2f54261906%2freticulate-importerror-no-module-named-pandas-in-rstudio-version-1-2%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
It appears pandas
is not installed in your virtualenv. It may be on your machine, but your virtualenv isolates your application from the rest of your machine.
While your virtualenv is active:
- Open cmd/bash
- Run
pip install pandas
Now pandas
should be available to you within this env
. Later you can generate a requirements.txt
file that makes dependency management much easier.
Thanks for your help, however, this didn't work for me. I first didlibrary(reticulate) use_virtualenv("r-reticulate") use_python("C:\Python27")
. Thenpip install pandas
in cmd showed that requirement is already satisfied. Then I ran thepython
chunkimport pandas
. However, I still getImportError: No module named pandas
. I have also tried closing and re-opening rstudio but to no avail.
– umair durrani
Jan 19 at 0:00
1
What about tryingpy_install("pandas")
?
– CodeSpent
Jan 19 at 0:07
NameError: name 'py_install' is not defined
– umair durrani
Jan 19 at 0:10
1
Hmm. According to this article that's the proper way of installing python packages.
– CodeSpent
Jan 19 at 0:12
1
I've tried all the options and somehow managed to fail everytime! Gonna watch youtube videos on reticulate now. Thanks for your help @CodeSpent
– umair durrani
Jan 19 at 1:23
|
show 2 more comments
It appears pandas
is not installed in your virtualenv. It may be on your machine, but your virtualenv isolates your application from the rest of your machine.
While your virtualenv is active:
- Open cmd/bash
- Run
pip install pandas
Now pandas
should be available to you within this env
. Later you can generate a requirements.txt
file that makes dependency management much easier.
Thanks for your help, however, this didn't work for me. I first didlibrary(reticulate) use_virtualenv("r-reticulate") use_python("C:\Python27")
. Thenpip install pandas
in cmd showed that requirement is already satisfied. Then I ran thepython
chunkimport pandas
. However, I still getImportError: No module named pandas
. I have also tried closing and re-opening rstudio but to no avail.
– umair durrani
Jan 19 at 0:00
1
What about tryingpy_install("pandas")
?
– CodeSpent
Jan 19 at 0:07
NameError: name 'py_install' is not defined
– umair durrani
Jan 19 at 0:10
1
Hmm. According to this article that's the proper way of installing python packages.
– CodeSpent
Jan 19 at 0:12
1
I've tried all the options and somehow managed to fail everytime! Gonna watch youtube videos on reticulate now. Thanks for your help @CodeSpent
– umair durrani
Jan 19 at 1:23
|
show 2 more comments
It appears pandas
is not installed in your virtualenv. It may be on your machine, but your virtualenv isolates your application from the rest of your machine.
While your virtualenv is active:
- Open cmd/bash
- Run
pip install pandas
Now pandas
should be available to you within this env
. Later you can generate a requirements.txt
file that makes dependency management much easier.
It appears pandas
is not installed in your virtualenv. It may be on your machine, but your virtualenv isolates your application from the rest of your machine.
While your virtualenv is active:
- Open cmd/bash
- Run
pip install pandas
Now pandas
should be available to you within this env
. Later you can generate a requirements.txt
file that makes dependency management much easier.
answered Jan 18 at 23:52
CodeSpentCodeSpent
746617
746617
Thanks for your help, however, this didn't work for me. I first didlibrary(reticulate) use_virtualenv("r-reticulate") use_python("C:\Python27")
. Thenpip install pandas
in cmd showed that requirement is already satisfied. Then I ran thepython
chunkimport pandas
. However, I still getImportError: No module named pandas
. I have also tried closing and re-opening rstudio but to no avail.
– umair durrani
Jan 19 at 0:00
1
What about tryingpy_install("pandas")
?
– CodeSpent
Jan 19 at 0:07
NameError: name 'py_install' is not defined
– umair durrani
Jan 19 at 0:10
1
Hmm. According to this article that's the proper way of installing python packages.
– CodeSpent
Jan 19 at 0:12
1
I've tried all the options and somehow managed to fail everytime! Gonna watch youtube videos on reticulate now. Thanks for your help @CodeSpent
– umair durrani
Jan 19 at 1:23
|
show 2 more comments
Thanks for your help, however, this didn't work for me. I first didlibrary(reticulate) use_virtualenv("r-reticulate") use_python("C:\Python27")
. Thenpip install pandas
in cmd showed that requirement is already satisfied. Then I ran thepython
chunkimport pandas
. However, I still getImportError: No module named pandas
. I have also tried closing and re-opening rstudio but to no avail.
– umair durrani
Jan 19 at 0:00
1
What about tryingpy_install("pandas")
?
– CodeSpent
Jan 19 at 0:07
NameError: name 'py_install' is not defined
– umair durrani
Jan 19 at 0:10
1
Hmm. According to this article that's the proper way of installing python packages.
– CodeSpent
Jan 19 at 0:12
1
I've tried all the options and somehow managed to fail everytime! Gonna watch youtube videos on reticulate now. Thanks for your help @CodeSpent
– umair durrani
Jan 19 at 1:23
Thanks for your help, however, this didn't work for me. I first did
library(reticulate) use_virtualenv("r-reticulate") use_python("C:\Python27")
. Then pip install pandas
in cmd showed that requirement is already satisfied. Then I ran the python
chunk import pandas
. However, I still get ImportError: No module named pandas
. I have also tried closing and re-opening rstudio but to no avail.– umair durrani
Jan 19 at 0:00
Thanks for your help, however, this didn't work for me. I first did
library(reticulate) use_virtualenv("r-reticulate") use_python("C:\Python27")
. Then pip install pandas
in cmd showed that requirement is already satisfied. Then I ran the python
chunk import pandas
. However, I still get ImportError: No module named pandas
. I have also tried closing and re-opening rstudio but to no avail.– umair durrani
Jan 19 at 0:00
1
1
What about trying
py_install("pandas")
?– CodeSpent
Jan 19 at 0:07
What about trying
py_install("pandas")
?– CodeSpent
Jan 19 at 0:07
NameError: name 'py_install' is not defined
– umair durrani
Jan 19 at 0:10
NameError: name 'py_install' is not defined
– umair durrani
Jan 19 at 0:10
1
1
Hmm. According to this article that's the proper way of installing python packages.
– CodeSpent
Jan 19 at 0:12
Hmm. According to this article that's the proper way of installing python packages.
– CodeSpent
Jan 19 at 0:12
1
1
I've tried all the options and somehow managed to fail everytime! Gonna watch youtube videos on reticulate now. Thanks for your help @CodeSpent
– umair durrani
Jan 19 at 1:23
I've tried all the options and somehow managed to fail everytime! Gonna watch youtube videos on reticulate now. Thanks for your help @CodeSpent
– umair durrani
Jan 19 at 1:23
|
show 2 more comments
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%2f54261906%2freticulate-importerror-no-module-named-pandas-in-rstudio-version-1-2%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
2
Silly question, but did you install
pandas
while the virtualenv was active?– CodeSpent
Jan 18 at 22:25
@CodeSpent thanks for your comment. I guess I updated it to make sure that it was installed. Was that the culprit? What should I do now?
– umair durrani
Jan 18 at 23:35
1
Well your virtualenv is isolating your application, so just
pip install pandas
from inside your virtualenv.– CodeSpent
Jan 18 at 23:39
1
Where do I do
pip install pandas
? Python does not recognize that. I can only do that in cmd on Windows and I am not sure if there is a cmd engine in knitr. Sorry, I am an R user and still learning Python.– umair durrani
Jan 18 at 23:44
1
Added an answer, let me know if that works or if you need some more clarification. :)
– CodeSpent
Jan 18 at 23:53