Pandas import error: missing “pytz”. But works fine in console











up vote
0
down vote

favorite












I'm using PyCharm and running a script by clicking the "Run" button, which executes the script in the "Run" environment. Interpreter is Anaconda 3.5. The script begins with import pandas as pd. It's been always working perfectly until just now when I clicked 'Run' I got an unexpected error raised:



D:Anaconda3python.exe MY_PATH
Traceback (most recent call last):
File MY_PATH, line 2, in <module>
import pandas as pd
File "D:Anaconda3libsite-packagespandas__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['pytz']


This error persists even after I uninstalled and reinstalled both pytz and pandas.



On the other hand, pandas has been always working properly in the IPython console environment (with the same interpreter as the "Run" environment). Such an error never occurs in the console.



What could be wrong? Please help me. Thanks!






As Julian noted, the problem is most likely due to pytz being absent from the "Run" environment, although it's present in the IPython console environment. So how can I restore pytz in the "Run" environment in PyCharm?








share|improve this question
























  • This is almost certainly because you don't have pytz installed in the correct environment. PyCharm will often create a virtual environment for your interpreters to run in when creating a project. The answer from @Tanvir is correct, but you need to run it in the right environment.
    – Julian
    Nov 7 at 18:00










  • @Julian thanks, it seems to be the case. Could you also kindly tell me how to restore pytz in the Run virtual environment?
    – Vim
    Nov 7 at 23:42










  • Usually pycharm will underline missing libraries when you put your cursor over the import. If not here is a pretty detailed explanation of how to install it: quora.com/…
    – Julian
    Nov 11 at 17:31










  • +1, but in anaconda. pandas doesn't load if python is called in the command line. But it works fine inside spyder. Environment is same. However, if kernel crashes and is restarted in spyder, then pandas doesn't load again. Issue is always related to pytz.
    – Raf
    Nov 16 at 20:02












  • @Raf I solved the problem by reinstalling both conda and pycharm. But take heed of the latest pycharm version which doesn't correctly set the PATH variable for Windows, and you have to manually add several paths to PATH to ensure functionality. See stackoverflow.com/a/27199024 for details.
    – Vim
    Nov 17 at 6:40

















up vote
0
down vote

favorite












I'm using PyCharm and running a script by clicking the "Run" button, which executes the script in the "Run" environment. Interpreter is Anaconda 3.5. The script begins with import pandas as pd. It's been always working perfectly until just now when I clicked 'Run' I got an unexpected error raised:



D:Anaconda3python.exe MY_PATH
Traceback (most recent call last):
File MY_PATH, line 2, in <module>
import pandas as pd
File "D:Anaconda3libsite-packagespandas__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['pytz']


This error persists even after I uninstalled and reinstalled both pytz and pandas.



On the other hand, pandas has been always working properly in the IPython console environment (with the same interpreter as the "Run" environment). Such an error never occurs in the console.



What could be wrong? Please help me. Thanks!






As Julian noted, the problem is most likely due to pytz being absent from the "Run" environment, although it's present in the IPython console environment. So how can I restore pytz in the "Run" environment in PyCharm?








share|improve this question
























  • This is almost certainly because you don't have pytz installed in the correct environment. PyCharm will often create a virtual environment for your interpreters to run in when creating a project. The answer from @Tanvir is correct, but you need to run it in the right environment.
    – Julian
    Nov 7 at 18:00










  • @Julian thanks, it seems to be the case. Could you also kindly tell me how to restore pytz in the Run virtual environment?
    – Vim
    Nov 7 at 23:42










  • Usually pycharm will underline missing libraries when you put your cursor over the import. If not here is a pretty detailed explanation of how to install it: quora.com/…
    – Julian
    Nov 11 at 17:31










  • +1, but in anaconda. pandas doesn't load if python is called in the command line. But it works fine inside spyder. Environment is same. However, if kernel crashes and is restarted in spyder, then pandas doesn't load again. Issue is always related to pytz.
    – Raf
    Nov 16 at 20:02












  • @Raf I solved the problem by reinstalling both conda and pycharm. But take heed of the latest pycharm version which doesn't correctly set the PATH variable for Windows, and you have to manually add several paths to PATH to ensure functionality. See stackoverflow.com/a/27199024 for details.
    – Vim
    Nov 17 at 6:40















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm using PyCharm and running a script by clicking the "Run" button, which executes the script in the "Run" environment. Interpreter is Anaconda 3.5. The script begins with import pandas as pd. It's been always working perfectly until just now when I clicked 'Run' I got an unexpected error raised:



D:Anaconda3python.exe MY_PATH
Traceback (most recent call last):
File MY_PATH, line 2, in <module>
import pandas as pd
File "D:Anaconda3libsite-packagespandas__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['pytz']


This error persists even after I uninstalled and reinstalled both pytz and pandas.



On the other hand, pandas has been always working properly in the IPython console environment (with the same interpreter as the "Run" environment). Such an error never occurs in the console.



What could be wrong? Please help me. Thanks!






As Julian noted, the problem is most likely due to pytz being absent from the "Run" environment, although it's present in the IPython console environment. So how can I restore pytz in the "Run" environment in PyCharm?








share|improve this question















I'm using PyCharm and running a script by clicking the "Run" button, which executes the script in the "Run" environment. Interpreter is Anaconda 3.5. The script begins with import pandas as pd. It's been always working perfectly until just now when I clicked 'Run' I got an unexpected error raised:



D:Anaconda3python.exe MY_PATH
Traceback (most recent call last):
File MY_PATH, line 2, in <module>
import pandas as pd
File "D:Anaconda3libsite-packagespandas__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['pytz']


This error persists even after I uninstalled and reinstalled both pytz and pandas.



On the other hand, pandas has been always working properly in the IPython console environment (with the same interpreter as the "Run" environment). Such an error never occurs in the console.



What could be wrong? Please help me. Thanks!






As Julian noted, the problem is most likely due to pytz being absent from the "Run" environment, although it's present in the IPython console environment. So how can I restore pytz in the "Run" environment in PyCharm?





python pandas pycharm ipython pytz






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 1:18

























asked Nov 7 at 17:48









Vim

344212




344212












  • This is almost certainly because you don't have pytz installed in the correct environment. PyCharm will often create a virtual environment for your interpreters to run in when creating a project. The answer from @Tanvir is correct, but you need to run it in the right environment.
    – Julian
    Nov 7 at 18:00










  • @Julian thanks, it seems to be the case. Could you also kindly tell me how to restore pytz in the Run virtual environment?
    – Vim
    Nov 7 at 23:42










  • Usually pycharm will underline missing libraries when you put your cursor over the import. If not here is a pretty detailed explanation of how to install it: quora.com/…
    – Julian
    Nov 11 at 17:31










  • +1, but in anaconda. pandas doesn't load if python is called in the command line. But it works fine inside spyder. Environment is same. However, if kernel crashes and is restarted in spyder, then pandas doesn't load again. Issue is always related to pytz.
    – Raf
    Nov 16 at 20:02












  • @Raf I solved the problem by reinstalling both conda and pycharm. But take heed of the latest pycharm version which doesn't correctly set the PATH variable for Windows, and you have to manually add several paths to PATH to ensure functionality. See stackoverflow.com/a/27199024 for details.
    – Vim
    Nov 17 at 6:40




















  • This is almost certainly because you don't have pytz installed in the correct environment. PyCharm will often create a virtual environment for your interpreters to run in when creating a project. The answer from @Tanvir is correct, but you need to run it in the right environment.
    – Julian
    Nov 7 at 18:00










  • @Julian thanks, it seems to be the case. Could you also kindly tell me how to restore pytz in the Run virtual environment?
    – Vim
    Nov 7 at 23:42










  • Usually pycharm will underline missing libraries when you put your cursor over the import. If not here is a pretty detailed explanation of how to install it: quora.com/…
    – Julian
    Nov 11 at 17:31










  • +1, but in anaconda. pandas doesn't load if python is called in the command line. But it works fine inside spyder. Environment is same. However, if kernel crashes and is restarted in spyder, then pandas doesn't load again. Issue is always related to pytz.
    – Raf
    Nov 16 at 20:02












  • @Raf I solved the problem by reinstalling both conda and pycharm. But take heed of the latest pycharm version which doesn't correctly set the PATH variable for Windows, and you have to manually add several paths to PATH to ensure functionality. See stackoverflow.com/a/27199024 for details.
    – Vim
    Nov 17 at 6:40


















This is almost certainly because you don't have pytz installed in the correct environment. PyCharm will often create a virtual environment for your interpreters to run in when creating a project. The answer from @Tanvir is correct, but you need to run it in the right environment.
– Julian
Nov 7 at 18:00




This is almost certainly because you don't have pytz installed in the correct environment. PyCharm will often create a virtual environment for your interpreters to run in when creating a project. The answer from @Tanvir is correct, but you need to run it in the right environment.
– Julian
Nov 7 at 18:00












@Julian thanks, it seems to be the case. Could you also kindly tell me how to restore pytz in the Run virtual environment?
– Vim
Nov 7 at 23:42




@Julian thanks, it seems to be the case. Could you also kindly tell me how to restore pytz in the Run virtual environment?
– Vim
Nov 7 at 23:42












Usually pycharm will underline missing libraries when you put your cursor over the import. If not here is a pretty detailed explanation of how to install it: quora.com/…
– Julian
Nov 11 at 17:31




Usually pycharm will underline missing libraries when you put your cursor over the import. If not here is a pretty detailed explanation of how to install it: quora.com/…
– Julian
Nov 11 at 17:31












+1, but in anaconda. pandas doesn't load if python is called in the command line. But it works fine inside spyder. Environment is same. However, if kernel crashes and is restarted in spyder, then pandas doesn't load again. Issue is always related to pytz.
– Raf
Nov 16 at 20:02






+1, but in anaconda. pandas doesn't load if python is called in the command line. But it works fine inside spyder. Environment is same. However, if kernel crashes and is restarted in spyder, then pandas doesn't load again. Issue is always related to pytz.
– Raf
Nov 16 at 20:02














@Raf I solved the problem by reinstalling both conda and pycharm. But take heed of the latest pycharm version which doesn't correctly set the PATH variable for Windows, and you have to manually add several paths to PATH to ensure functionality. See stackoverflow.com/a/27199024 for details.
– Vim
Nov 17 at 6:40






@Raf I solved the problem by reinstalling both conda and pycharm. But take heed of the latest pycharm version which doesn't correctly set the PATH variable for Windows, and you have to manually add several paths to PATH to ensure functionality. See stackoverflow.com/a/27199024 for details.
– Vim
Nov 17 at 6:40














1 Answer
1






active

oldest

votes

















up vote
1
down vote













can you try this once and check if the error remain,



pip install python-dateutil pytz --force-reinstall --upgrade





share|improve this answer





















  • Thanks. But still doesn't work in the Run environment.
    – Vim
    Nov 7 at 23:44











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',
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
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194982%2fpandas-import-error-missing-pytz-but-works-fine-in-console%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








up vote
1
down vote













can you try this once and check if the error remain,



pip install python-dateutil pytz --force-reinstall --upgrade





share|improve this answer





















  • Thanks. But still doesn't work in the Run environment.
    – Vim
    Nov 7 at 23:44















up vote
1
down vote













can you try this once and check if the error remain,



pip install python-dateutil pytz --force-reinstall --upgrade





share|improve this answer





















  • Thanks. But still doesn't work in the Run environment.
    – Vim
    Nov 7 at 23:44













up vote
1
down vote










up vote
1
down vote









can you try this once and check if the error remain,



pip install python-dateutil pytz --force-reinstall --upgrade





share|improve this answer












can you try this once and check if the error remain,



pip install python-dateutil pytz --force-reinstall --upgrade






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 7 at 17:55









Tanvir

339




339












  • Thanks. But still doesn't work in the Run environment.
    – Vim
    Nov 7 at 23:44


















  • Thanks. But still doesn't work in the Run environment.
    – Vim
    Nov 7 at 23:44
















Thanks. But still doesn't work in the Run environment.
– Vim
Nov 7 at 23:44




Thanks. But still doesn't work in the Run environment.
– Vim
Nov 7 at 23:44


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194982%2fpandas-import-error-missing-pytz-but-works-fine-in-console%23new-answer', 'question_page');
}
);

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







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini