amueller/introduction_to_ml_with_python

Mglearn : Memory(cachedir="cache")

Matthieu0202 opened this issue · 8 comments

hello,

When i try to import mglearn : i have this message error :

"3 import numpy as np
5 from joblib import Memory
----> 7 memory = Memory(cachedir="cache")
10 def plot_pca_illustration():"
TypeError: Memory.init() got an unexpected keyword argument 'cachedir'

Can you tell me how to fix it ?

Thx

hello,
Several of my students had this issue as well, but not all. There is an open issue on stackoverflow that provides a little more information. It apparently has something to do with a recent update to hdbscan on Sep 16 2022. Students (and me) who downloaded prior to that date are not having the problem. here is the link: https://stackoverflow.com/questions/73830225/init-got-an-unexpected-keyword-argument-cachedir-when-importing-top2vec. My short-term solution was to point my students to my fork on GitHub that still has the old version. You are welcome to it but it also has a few changes I've made for my course. All original files are intact, but I have a few extras.

Hello, I have the same issue

my solution :

  • go to the directory python3.9/sites-packages/mglearn
  • find the files plot_pca.py and plot_nmf.py
  • change the line memory = Memory(cachedir="cache") into memory = Memory(location="cache")
    because in the joblib packages the option location replaces cachedir since version 0.12 and that works for me.

I hope this will help you and also other people.

Thank you the 2 solutions works !

@tingwang97077 dude you are a lifesaver! this worked for me too! Thanks so much for the help!

How would you fix this in notebooks? I am running it on google colab

running this fixes it:
!pip install joblib==1.1.0

I've tried all the options above

I'm using a Jupyter Notebook inside vs code where I'm running a Python 3.12.2 kernel. I install mglearn and when I run the following

import mglearn

I get the folliwing error message:

OSError: [Errno 30] Read-only file system: 'cache'

Would appreciate any help on this. I've even gone into the files mentioned above and changed the code there. If I try install a previous version if joblib it still gives me the above mentioned Errno 30