Python Forum
Pandas - error when running Pycharm, but works on cmd line
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pandas - error when running Pycharm, but works on cmd line
#1
I'm having problems running scripts that reference pandas when I use Pycharm, but when I run the python scripts on the command line, then it all works fine.

For example, I have a basic test program which has nothing more than this :

import pandas
print ('Hello')

In Pycharm I get this error msg (see attachment).

My Python version is 3.8, and my Pycharm version is in the attachment.

I can successfully run this from the command line as follows :

C:\Users\hsdhi\PycharmProjects\pythonProject>python aa.py
Hello



....and under this structure I have a pandas directory.

I suspect that my version of Pycharm is somehow out of sync with the pandas. I've removed and reinstalled pandas many times but get the same error.

All advice greatly appreciated.

Attached Files

Thumbnail(s)
           
Reply
#2
You are using virtual environment pythonProject\venv doc venv.
PyCharm can make venv automatically.
To use same Python interpreter as you use cmd look at Configure a Python interpreter
Do this from cmd:
C:\>python -c "import sys; print(sys.executable)"
C:\python310\python.exe

C:\>pip -V
pip 22.0.4 from C:\Python310\lib\site-packages\pip (python 3.10) 
Then look at Setting the default interpreter in link,
here you point to first output in cmd so for me this is C:\python310\python.exe for you it can be different.
Then PyCharm will use this Python interpreter every time you create a new project.
zxcv101 likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  DF.groupby(col).min works, mean gets a "not implemented" error samgardner5 3 500 Feb-29-2024, 06:13 PM
Last Post: deanhystad
  error "cannot identify image file" part way through running hatflyer 0 683 Nov-02-2023, 11:45 PM
Last Post: hatflyer
  Pycharm error zuri 1 493 Nov-01-2023, 03:38 PM
Last Post: deanhystad
  Error when running kivy on python janeik 8 2,071 Jun-16-2023, 10:58 PM
Last Post: janeik
  pyarrow error when importing pandas sravva 1 943 Jun-06-2023, 05:09 PM
Last Post: snippsat
  File "<string>", line 19, in <module> error is related to what? Frankduc 9 12,594 Mar-09-2023, 07:22 AM
Last Post: LocklearSusan
Bug Works In Pycharm, Tons of problems after EXE chob_thomas 3 2,948 Dec-29-2022, 04:51 PM
Last Post: snippsat
  Getting error when running "MINUS" between 2 databases marlonbown 4 1,279 Nov-10-2022, 05:49 AM
Last Post: deanhystad
  line by line debugging in PyCharm Community astral_travel 2 1,109 Nov-03-2022, 08:33 PM
Last Post: astral_travel
  Error while running code on VSC maiya 4 3,777 Jul-01-2022, 02:51 PM
Last Post: maiya

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020