简体   繁体   中英

LightGBM and Catboost are both installed but give ModuleNotFoundError when imported in Jupyter

I have successfully installed the CatBoost and LightGbM modules using the command prompt. It gave me the message Successfully installed catboost-0.2.5 (I also previously tried another one). However, for both of them I have an identical error when I try to import both of them in a jupyter notebook:

import lightgbm as lgb

I get:

ModuleNotFoundError: No module named 'lightgbm'

and I get an identical error with CatBoost as well.

Any ideas? Thank you!

As discussed in the chat , it turns out that the environment where your Jupyter notebooks run and the one where you have installed the packages are different.

Since pip reports both packages installed in your "main" environment (ie the one coming up when you simply open a Windows command prompt), what you should do is open Jupyter from the command prompt, as

jupyter notebook

and your packages will indeed be available for importing, as we confirmed indeed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM