Forums

Computer vision python 2.7 to 3.4 django joblib problem?

Hi everyone,

I am saving some object arrays using python 2.7 with joblib.dump( SVM ).

Then I am uploading my file onto pythonanywhere.

But my pythonanywhere is 3.4. I get an error saying I am trying to un-pickle a python 2.

Either I copypaste all my files into a python 2.7 webapp, or I convert this small little joblib.load from 2.7 into 3.4.

Or I save in a version-compatible format. I tried np.save but it didn't work. Even with pickle=false (it doesn't allow pickle to be = false with object arrays).

Any ideas?

Thanks,

Fred

We can switch your PythonAnywhere website over to 2.7, if you like...? That said, that will just change the Python version in use -- if you have 3.4-specific code then it is likely to break.

Hey,

Yeah could you do that?

TBH all my stuff is 2.7, just the ordinary urls/models files besides that.

From what I read OpenCV is tough to install on python 3 too.

Thanks a lot,

Fred

OK, that's done. You'll need to re-build your virtualenv with Python 2.7, and then reload the website on the "Web" tab.

Ok thanks a lot. Do I need to do pip install on the modules again?

Yup. Maybe it's easiest to create a new virtualenv with Python 2.7, then re-install everything into there -- that would lower the risk of anything getting left over from the old one. Then you'll need to change the virtualenv specified on the "Web" tab before reloading.

Okay. Is it safe for me to just delete my virtualenv then make again from bash?

Yes, so long as you didn't put any of your code or other important files into the directory containing it (eg. somewhere inside /home/Fred409/.virtualenvs/virtualenvname)

(That would be an unusual thing to do, but I've seen people do it before.)