0

When I run this program:

import pandas as pd
from sklearn.tree import DecisionTreeClassifier

music_data = pd.read_csv('music.csv')
X = music_data.drop(columns=['genre'])
y = music_data['genre']

model = DecisionTreeClassifier()
model.fit(X, y)
prediction = model.predict([[21, 1], [22, 0]])
print(prediction)

I get this error:

OSError: [WinError 193] %1 is not a valid Win32 application

I have taken the information from https://www.youtube.com/watch?v=7eh4d6sabA0&ab_channel=ProgrammingwithMosh

  • I used to get this error with `vlc` and the problem was I was using 32 bit `vlc` with 64 bit python. I don't know if that relates to your problem, but it is the same error. If something in your imports is using python bindings for a dll. The chances exist that the dll and your python are not the same bits. For me, the fix was simple. I downloaded 64 bit `vlc` to match my python. I don't use any of the packages you are using and I'm not familiar with their dependencies. – OneMadGypsy Nov 25 '22 at 16:01
  • I found [this question](https://stackoverflow.com/questions/66408976/oserror-winerror-193-when-trying-to-import-sklearn-in-spyder), which supports much of what I said above. There is no answer to the question, but it is clear that DLL's are in use with `sklearn`. I bet you need to make sure those DLLs match your python bits. You could test this very easily. Change just your python to whatever bits that it isn't and see what happens. If it works, you can either keep it like that or revert the python and try to fix the DLLs. – OneMadGypsy Nov 25 '22 at 16:12
  • If you don't know what bit version of python you have, open a console, type "python" (maybe "python3"), and press enter. Towards the end of the top line it will say whether it's 32 or 64. If you intend to use my troubleshooting approach, you want to download and install the opposite of whatever it says you have. – OneMadGypsy Nov 25 '22 at 16:25

0 Answers0