I'm using Azure Machine Learning Studio which supports version 17.0 of scikit-learn. I would like to use newer one. You can do it as described here. But this causes name aliasing so I would have to change the name of the library which file can be found here. I don't know which parts of files I'm supposed to change so I can import scikit-learn as something else than import sklearn
Asked
Active
Viewed 174 times
0

mihagazvoda
- 1,057
- 13
- 23
-
You can change the name of a library with the `as` keyword. Is that what you mean? e.g. `import sklearn as sk_learn` – Arne Dec 20 '17 at 11:03
-
No, this way I import old version. I need to change the name somewhere inside the scikit-learn files. – mihagazvoda Dec 20 '17 at 11:24
-
I don't understand. You want to use a newer version of sklearn within the code of an older version of sklearn? – Arne Dec 20 '17 at 11:29
-
No. Azure contains older version by default. However, you can import other libraries (also new scikit-learn) but there's a problem of name aliasing. They have the same name and when you import sklearn you're importing old one. Check the links in my post. – mihagazvoda Dec 20 '17 at 11:37
-
Those links explained nothing to me. The first is a question that should, in my opinion, be deleted for being bad, and the second is just the installation description of sklearn. Your actual problem is managing package versions in a cloud environment, and your question gives very little information about your actual setup. – Arne Dec 20 '17 at 11:48
-
Is it possible to use pyenv, pipenv or virtualenv and use an requirements.txt file where you add `sklearn==0.19.1` or whatever version you want? – MortenB Dec 20 '17 at 11:58
-
The first question is bad but answer is useful, it represents how to include any library in your Azure ML Studio environment. Some Python libraries (Anaconda) are included by default - you don't need a special module to import them into the environment. The link above explains how to include library which is not already included in Azure ML environment. BUT, I can't do the same with scikit-learn because it has the same name as the version already included in Azure ML. So, if I call "import sklearn" within my script - it will call the older one because they have the same names. – mihagazvoda Dec 20 '17 at 12:02
1 Answers
0
I think what you're proposing to do is perhaps not a great idea. This would involve changing the name of the sklearn folder in your site-packages directory, but that subsequently breaks a bunch of stuff within sklearn. You would have to change references to sklearn in a bunch of files to unbreak it.
My suggestion (hopefully not a bad suggestion) would be to go into Lib >> site-packages directory and remove the sklearn folder which contains the old version of sklearn. Then when you import sklearn, it should find the new version.
Note:
You may also need to rename the folder that contains the new version of sklearn.
-
I'm not sure how to remove site-package in Azure Machine Learning Studio. Can you help me with that? – mihagazvoda Dec 20 '17 at 11:50
-
Can you navigate to the directory where Python is installed? If so, go to Lib >> site-packages, and find the folder for the old version of sklearn and delete it. – gaw89 Dec 20 '17 at 11:52