0

I have been trying a simple code on Pycharm 2019.2.1 on Windows 10 64-bit:

import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
df = pd.read_csv('covid_19_clean_complete.csv')
X = df[["Deaths"]]
Y = df["Confirmed"]
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=.25, random_state=42)
acr = LinearRegression()    
acr.fit(X_train,Y_train)
print(acr.score(X_test,Y_test))

but it is showing me this error:

error message

I've already uninstalled pandas once and installed again using

pip uninstall pandas 
pip install pandas

pandas installed photo

Interpreter photo

I searched but the links I found, were not clear to me.

Here's one of the search results:
OSError: [WinError 193] %1 is not a valid Win32 application

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Ayon134
  • 21
  • 5
  • have you defined the python interpreter for your project on pycharms? – Rajat Mishra Apr 15 '20 at 17:43
  • 2
    Architecture mismatch. You installed the wrong *NumPy* package (probably installed it manually, as *PIP* correctly selects it). Might check https://stackoverflow.com/questions/57187566/python-ctypes-loading-dll-throws-oserror-winerror-193-1-is-not-a-valid-win/57297745 for more details about the error. – CristiFati Apr 15 '20 at 17:58
  • Mr. @CristiFati, thank you for the link, but I was wondering how can I check if dll is 32 or 64? The python is 64. also, how can I change from 32 to 64. Thank You – Ayon134 Apr 15 '20 at 18:50
  • Mr. @RajatMishra I've defined in pycharm, not in the project. But, should it make any difference? Because I've defined the path. Before this problem, it used to work well. Already I have created an environment in the project folder, still problem remains. – Ayon134 Apr 15 '20 at 18:52
  • For the *.dll*, you can use *Dependency Walker*. For *Python*: https://stackoverflow.com/questions/1405913/how-do-i-determine-if-my-python-shell-is-executing-in-32bit-or-64bit-mode-on-os/50053286#50053286. You can install both *Python* versions. – CristiFati Apr 15 '20 at 19:02
  • Well, I just uninstalled python, PyCharm and all other relevant files from C drive. Then again installed them with modules. Now working pretty well. Though it is not the best way to solve it. – Ayon134 Apr 16 '20 at 03:45

1 Answers1

-1

Finally, all I did was uninstall Pycharm and Python from my system. Then again re-installed them. Then the problem was solved.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Ayon134
  • 21
  • 5