GithubHelp home page GithubHelp logo

Comments (5)

jameslamb avatar jameslamb commented on June 28, 2024 1

@NigamSomya To install the Python package from a local copy of LightGBM, run the following:

sh build-python.sh install

For details on how to customize that, follow the docs at https://github.com/microsoft/LightGBM/blob/master/python-package/README.rst. You can ask here if you have other questions or concerns.

from lightgbm.

NigamSomya avatar NigamSomya commented on June 28, 2024

Hi! Thanks that worked successfully, but it installed the package in this directory C:\Users\snigam\AppData\AppData2\Lib\site-packages\lightgbm\ which is not picking up the changes that I made to the dcg_calculator.cpp

Plus, when I cloned the source code in a different directory, I expected the command that you shared would install the necessary files in that directory only. Please help.

from lightgbm.

jameslamb avatar jameslamb commented on June 28, 2024

which is not picking up the changes that I made to the dcg_calculator.cpp

What evidence do you see the the changes you've made to LightGBM's source code are not being picked up in the Python package?

Just to be sure you understand...the Python package will not contain any .h or .cpp files. Those files are compiled into a shared library, lib_lightgbm.dll, that the Python package code calls.

If you run the command I show you from the root of the same repo where you changed any .cpp files in LightGBM, the resulting Python package will reflect your changes. Be sure you're doing that.

I expected the command that you shared would install the necessary files in that directory only.

The command I shared will build the lightgbm Python package and install it to where pip install on your system places packages by default.

If you want to control that more tightly, omit the install.

sh build-python.sh bdist_wheel

That will create a file with a name like lightgbm-4.3.0.99-py3-none-win_amd64.whl in the dist/ directory at the root of the LightGBM repo. That file is a Python wheel and you can install it to wherever you want.

from lightgbm.

NigamSomya avatar NigamSomya commented on June 28, 2024

Hi!
Because I am getting the same error (kMaxposition error), I also ran the command in the same directory where my source code is place but somehow it gets installed as if I am running the usual pip command to install the lightgbm (in the usual appdata directory).

Also, the same thing happened when I tried to use this command sh build-python.sh bdist_wheel. Couldn't find anything named lightgbm-4.3.0.99-py3-none-win_amd64.whl. Must have been installed in the default directory and it behaves like the usual lightgbm package.
I am not sure what I am doing wrong, can you please help me with this?

from lightgbm.

jameslamb avatar jameslamb commented on June 28, 2024

somehow it gets installed as if I am running the usual pip command to install the lightgbm (in the usual appdata directory).

LightGBM's Python package does not support editable installs.

This command builds a wheel and installs it with pip install:

sh build-python.sh bdist_wheel install

This command builds a wheel and places it in the directory ./dist, relative to the root of the repo:

sh build-python.sh bdist_wheel

And then you are free to install it however you'd install other Python wheels. For example, like this:

pip install --no-deps ./dist/lightgbm-4.3.0.99-py3-none-win_amd64.whl

Because I am getting the same error (kMaxposition error)

To help you, we need more information than what you've provided.

  • what version of LightGBM? (output of git log -n 2)
  • what version of Python?
  • can you share all of the build and installation logs?

Some things to try:

  • be sure you save the file dcg_calculator.cpp before compiling
  • be sure the Python interpreter used wherever you're running your program is the same one that was active from wherever you installed LightGBM
    • for example, if you are running your training code in a separate environment managed by venv / conda / poetry, then you need to install lightgbm into that environment
    • for example, if you are using a Jupyter notebook or similar, you may need to restart the kernel

from lightgbm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.