I use anaconda to run jupyter and the path is:
/Users/Kum/anaconda/bin
I installed lightgbm successfully below this path:
drwxr-xr-x 22 Kum staff 748B Feb 11 09:11 LightGBM
-rwxr-xr-x 1 Kum staff 147B Jun 16 2016 ipython
-rwxr-xr-x 1 Kum staff 147B Jun 16 2016 ipython2
-rwxr-xr-x 1 Kum staff 11K Jun 16 2016 isympy
-rwxr-xr-x 1 Kum staff 133B Jun 16 2016 jsonschema
-rwxr-xr-x 1 Kum staff 149B Jun 16 2016 jupyter
-rwxr-xr-x 1 Kum staff 108B Jun 16 2016 jupyter-console
-rwxr-xr-x 1 Kum staff 176B Jun 16 2016 jupyter-kernelspec
-rwxr-xr-x 1 Kum staff 159B Jun 16 2016 jupyter-migrate
-rwxrwxr-x 1 Kum staff 113B Jun 16 2016 jupyter-nbconvert
-rwxr-xr-x 1 Kum staff 152B Jun 16 2016 jupyter-nbextension
-rwxr-xr-x 1 Kum staff 150B Jun 16 2016 jupyter-notebook
Under LightGBM:
-rw-r--r-- 1 Kum staff 3.1K Feb 11 09:10 CMakeLists.txt
-rw-r--r-- 1 Kum staff 1.1K Feb 11 09:10 LICENSE
drwxr-xr-x 12 Kum staff 408B Feb 11 09:10 R-package
-rw-r--r-- 1 Kum staff 3.9K Feb 11 09:10 README.md
drwxr-xr-x 6 Kum staff 204B Feb 11 09:11 build
drwxr-xr-x 4 Kum staff 136B Feb 11 09:10 docker
drwxr-xr-x 12 Kum staff 408B Feb 11 09:10 docs
drwxr-xr-x 10 Kum staff 340B Feb 11 09:10 examples
drwxr-xr-x 3 Kum staff 102B Feb 11 09:10 include
-rwxr-xr-x 1 Kum staff 1.0M Feb 11 09:11 lib_lightgbm.so
-rwxr-xr-x 1 Kum staff 982K Feb 11 09:11 lightgbm
drwxr-xr-x 4 Kum staff 136B Feb 11 09:10 pmml
drwxr-xr-x 8 Kum staff 272B Feb 11 10:19 python-package
drwxr-xr-x 11 Kum staff 374B Feb 11 09:10 src
drwxr-xr-x 4 Kum staff 136B Feb 11 09:10 tests
drwxr-xr-x 5 Kum staff 170B Feb 11 09:10 windows
anaconda/bin/LightGBM master ✔
When I code:
import lightgbm as lgm
Got an error:
ImportError: No module named lightgbm
How to solve this....I'm so sad.XD
Make sure you go through the lightgbm installation guides . Then try conda list
to check if lightgbm
is in the installed package list.
If the module is not installed using conda
or pip
, it's possible that your module is not add to the python path.
You can either config it manually by modifying the env in the beginning of your Python session, or use jupyter notebook/Python
just under the module directory.
enter image description here Create a new environment in conda according to requirements shown in lightgbm and than create a environment list in jupyter and use according to your package by changing in kernel setting it will work fine.
How to create new env?
conda create --n py37_64 python=3.7
Also download according 32 bit or 64 bit for lightgbm 64 bit is used for that:
config --env --set subdir win--64
and activate particular env here it is py37_64 so command will be:
activate py37_64
and install lightgbm:
pip install lightgbm
Now see the magic and use this env in your jupyter notebook.
conda install nb_conda
For using this kernels in notebook you have to deactivate env and activate it again
Now see your notebook
Here you can see in image im actually using this now you can switch kernels according to your requirement.
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.