質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.45%
Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Q&A

解決済

1回答

2361閲覧

mglearnの入手方法

shinmaipgm

総合スコア1

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

0グッド

0クリップ

投稿2021/09/14 09:57

前提・実現したいこと

オライリー・ジャパン「Pythonではじめる機械学習」という本で機械学習の勉強を始めていますが、
p32のデータセットのところで、
エラーメッセージ「No module named 'mglearn'」が出て困っています。
mglearnというライブラリが入手できていないのだと思われます。
(Jupyter Notebook使用)

過去の質問、回答のやり取りをみて、
GitHubからmglearnというライブラリをダウンロードしたり、
Jupyter Notebook上で、pip install mglearn と打ったりしたのですが、
「No module named 'mglearn'」というメッセージがでてしまい、先に進むことができません。

何が悪いのかわからず、詳しく教えて頂けると助かります。

よろしくお願いします。

該当のソースコード

Jupyter Notebook上で打ち込んだコード

%matplotlib inline
from IPython.display import set_matplotlib_formats, display
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import mglearn


エラーメッセージ

ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-2f592ac79fb8> in <module>
4 import numpy as np
5 import matplotlib.pyplot as plt
----> 6 import mglearn

ModuleNotFoundError: No module named 'mglearn'

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

TakaiY

2021/09/14 10:10

使っているpythonについて、「pip install mglearn」を実行すればいいはずです。 ・pip でのインストールに失敗している。 ・pip の実行のしかたが間違えている。 ・pipでインストールしたpythonとjupyter notebookで使っているpythonが違うものである。 ・他 の可能性があります。 pipでインストールしたときの詳しい手順と、そのときの出力結果を載せてください。
shinmaipgm

2021/09/14 10:29

ご回答ありがとうございます。 Jupyter Notebook(Anaconda3)を立ち上げ、 「!pip install mglearn」と打ち込んで実行すると、 しばらく考え込んだ後、下記メッセージが出ました。 何が間違っていますでしょうか? WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1108: The handshake operation timed out'))': /simple/mglearn/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1108: The handshake operation timed out'))': /simple/mglearn/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1108: The handshake operation timed out'))': /simple/mglearn/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1108: The handshake operation timed out'))': /simple/mglearn/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1108: The handshake operation timed out'))': /simple/mglearn/ ERROR: Could not find a version that satisfies the requirement mglearn ERROR: No matching distribution found for mglear
jbpb0

2021/09/15 07:53

プロキシの設定が間違ってるような ・パソコンがつながってるのはプロキシが必要なネットワークでしょうか? ・現状でパソコンではプロキシの設定はしてますでしょうか?
shinmaipgm

2021/09/17 10:04

ご回答ありがとうございます。 色々試行錯誤した結果、 「mglearn」フォルダを、「Anaconda3」フォルダや、「.matplotlib」フォルダなどと同じ階層のフォルダに移動した後に、”import mglean”を実行すると、処理できました。 元々、「mglearn」フォルダも、「Anaconda3」フォルダ、「.matplotlib」フォルダと同様Cドライブに入れていたのですが、保管の階層が異なっていた為、ダメ元で、同じ階層のフォルダに移動させると、処理できました。
guest

回答1

0

ベストアンサー

Anacondaを使っているのでなければ、Jupyterで

!pip install mglearn

を実行してインストールします。

Anacondaを使っている場合は、本来ならばJupyterで

!conda install mglearn

を実行してインストールすべきなのですが、condaのリポジトリにないかもしれません。
その場合は少しリスクはありますが、

!pip install mglearn

でインストールするしかないでしょう。

投稿2021/09/14 10:05

編集2021/09/14 10:12
ppaul

総合スコア24666

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

shinmaipgm

2021/09/14 10:27

ご回答ありがとうございます。 Jupyter Notebook(Anaconda3)を立ち上げ、 「!pip install mglearn」と打ち込んで実行すると、 しばらく考え込んだ後、下記メッセージが出ました。 何が間違っていますでしょうか? WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1108: The handshake operation timed out'))': /simple/mglearn/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1108: The handshake operation timed out'))': /simple/mglearn/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1108: The handshake operation timed out'))': /simple/mglearn/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1108: The handshake operation timed out'))': /simple/mglearn/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1108: The handshake operation timed out'))': /simple/mglearn/ ERROR: Could not find a version that satisfies the requirement mglearn ERROR: No matching distribution found for mglear
ppaul

2021/09/16 06:11

会社のネットワークを使っていてproxyが設定されていないとかなら、会社の社内情報部門に問い合わせましょう。 そうでなくて、こういうメッセージが出るのであれば、OSとか、どのようにAnacondaをインストールしたのかを質問に追加してください。
shinmaipgm

2021/09/17 09:58

ご回答ありがとうございます。 色々試行錯誤した結果、 「mglearn」フォルダを、「Anaconda3」フォルダや、「.matplotlib」フォルダなどと同じ階層のフォルダに移動した後に、”import mglean”を実行すると、処理できました。 元々、「mglearn」フォルダも、「Anaconda3」フォルダ、「.matplotlib」フォルダと同様Cドライブに入れていたのですが、保管の階層が異なっていた為、ダメ元で、同じ階層のフォルダに移動させると、処理できました。 よくわかっていないのですが、保存場所の保管場所・階層について制約やルールがあるのでしょうか? 度々の質問ですみません。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.45%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問