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?python pandas pycharm ipython pytz
|
show 1 more comment
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?python pandas pycharm ipython pytz
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
|
show 1 more comment
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?python pandas pycharm ipython pytz
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
python pandas pycharm ipython pytz
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
|
show 1 more comment
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
|
show 1 more comment
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
Thanks. But still doesn't work in the Run environment.
– Vim
Nov 7 at 23:44
add a comment |
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
Thanks. But still doesn't work in the Run environment.
– Vim
Nov 7 at 23:44
add a comment |
up vote
1
down vote
can you try this once and check if the error remain,
pip install python-dateutil pytz --force-reinstall --upgrade
Thanks. But still doesn't work in the Run environment.
– Vim
Nov 7 at 23:44
add a comment |
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
can you try this once and check if the error remain,
pip install python-dateutil pytz --force-reinstall --upgrade
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
add a comment |
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
add a comment |
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%2f53194982%2fpandas-import-error-missing-pytz-but-works-fine-in-console%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
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