LightGBM icon indicating copy to clipboard operation
LightGBM copied to clipboard

[python-package] On Windows, lightgbm-4.6.0-cpu_py_1 from conda-forge Training Fails with Boost Filesystem Path Encoding Error

Open sdjafkhk opened this issue 8 months ago • 8 comments

Description

During LightGBM model training, an exception occurs when creating cache directories, caused by invalid path syntax with non-UTF8 characters. Error Message:boost::filesystem::create_directories: The filename, directory name, or volume label syntax is incorrect. [system:123]: "C:\Users\l\AppData\Roaming\boost_compute\0\x91\0I0???" Interpreted Error Context: The original GBK-encoded error message \xce\xc4\xbc\xfe\xc3\xfb\xa1\xa2\xc4\xbf\xc2\xbc\xc3\xfb\xbb\xf2\xbe\xed\xb1\xea\xd3\xef\xb7\xa8\xb2\xbb\xd5\xfd\xc8\xb7\xa1\xa3 translates to: "The filename, directory name, or volume label syntax is incorrect."

Reproducible example

import lightgbm as lgb params = { 'objective': 'binary', 'num_iterations': 100, 'verbose': 1 }

Sample data

import numpy as np X = np.random.rand(1000, 10) y = np.random.randint(2, size=1000) train_data = lgb.Dataset(X, label=y)

Trigger error

lgb.train(params, train_data) # Fails during cache directory creation

Expected Behavior LightGBM should automatically create cache directories with valid pathnames and complete training successfully.

Environment info

OS: Windows 11

LightGBM Version: lightgbm-4.6.0-cpu_py_1 from conda-forge

Python Version: 3.12.9

LightGBM version or commit hash:

Command(s) you used to install LightGBM conda install lightgbm

Additional Comments

when pip install lightgbm,then it works very good

sdjafkhk avatar Apr 05 '25 11:04 sdjafkhk

Thanks for using LightGBM and for reporting this.

I'm very confused to see anything involving Boost here, given that you did not pass "device": "gpu" in params. Are you sure the reproducible example you've provided produces this error?

Could you run with "verbosity": 1 in params and share ALL of the logs here?

jameslamb avatar Apr 05 '25 15:04 jameslamb

Sorry, I have uninstalled the lightgbm installed by conda, and then installed lightgbm through pip, and all the problems are normal. When I used lightgbm installed through conda, I saw that files with strange names were created in the folder C:\Users\l\AppData\Roaming\boost_compute. When I switched to the lightgbm installed by pip, all the folder names were normal. My parameter settings are like this params = { 'boosting_type': 'gbdt', 'objective': 'multiclass', 'num_class': 10, 'metric': {'multi_logloss'}, 'feature_fraction': 1.0, 'lambda_l1': 92, 'lambda_l2': 33, 'min_gain_to_split': 10, 'learning_rate': 0.20, 'bagging_fraction': 0.8, 'bagging_freq': 2, 'min_data_in_leaf': 800, 'max_depth': 7, 'num_leaves': 40, "bagging_seed": 2, "random_state": 2, 'nthread': 8, 'verbose': 1, 'device': 'gpu', 'gpu_use_dp':True, 'max_bins':63 }

sdjafkhk avatar Apr 07 '25 14:04 sdjafkhk

Can you please share the following?

  • output of conda info
  • exact command you ran to install lightgbm with conda

I can try to reproduce this issue with surprising files being created by the conda package on Windows. What you've reported is very unexpected.

jameslamb avatar May 20 '25 02:05 jameslamb

This issue has been automatically closed because it has been awaiting a response for too long. When you have time to to work with the maintainers to resolve this issue, please post a new comment and it will be re-opened. If the issue has been locked for editing by the time you return to it, please open a new issue and reference this one. Thank you for taking the time to improve LightGBM!

github-actions[bot] avatar Jun 19 '25 04:06 github-actions[bot]

I'm also encountering the same problem.

[LightGBM] [Info] This is the GPU trainer!!
[LightGBM] [Info] Total Bins 32614
[LightGBM] [Info] Number of data points in the train set: 373954, number of used features: 158
[LightGBM] [Info] Using GPU Device: NVIDIA GeForce RTX 5070 Ti, Vendor: NVIDIA Corporation
[LightGBM] [Info] Compiling OpenCL Kernel with 256 bins...
[LightGBM] [Warning] boost::filesystem::create_directories: 文件名、目录名或卷标语法不正确。 [system:123]: "C:\Users\haiha\AppData\Roaming\boost_compute\0骪0G0????v00?0? 020 0W0????9", "C:\Users\haiha\AppData\Roaming\boost_compute\0骪0G0????v00?0? 020 0W0????9"
[LightGBM] [Warning] boost::filesystem::cException ignored on calling ctypes callback functionreate_directories: 文件名、目录名或卷标: 语法不正确。 [system:123]: "C:\Users\haiha\AppData\Roam<function _log_callback at 0x000002E817A97B00>ing\boost_compute\0醆0??s0??&0<0?~0
?90Traceback (most recent call last):
?/0  File "d:\Users\haiha\anaconda3\envs\qlib\Lib\site-packages\lightgbm\basic.py", line 289, in _log_callback
#0F0?0?I", "C:\Users\haiha\AppData\Roaming\boost    _log_native(str(msg.decode("utf-8")))_

HAIHANTYZ avatar Jun 28 '25 09:06 HAIHANTYZ

@HAIHANTYZ if you want help, we need you to provide the same information I asked for from the previous report:

https://github.com/microsoft/LightGBM/issues/6881#issuecomment-2892762961

It's very unlikely that we'll be able to help you from an error message alone.


I've also slightly re-formatting your post... please also see https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax for some advice on formatting markdown here on GitHub.

jameslamb avatar Jun 28 '25 20:06 jameslamb

Can you please share the following?

  • output of conda info
  • exact command you ran to install lightgbm with conda

I can try to reproduce this issue with surprising files being created by the conda package on Windows. What you've reported is very unexpected.

Hi I encounter same problem when I try to use lightgbm on gpu, thanks for your help inadvance

The problem conda log: "Failed to read file: C:\Users\Goktu\AppData\Local\Temp\dep-fc9c41.d 1 warning generated. [LightGBM] [Warning] boost::filesystem::create_directories: The filename, directory name, or volume label syntax is incorrect [system:123]: "C:\Users\Goktu\AppData\Roaming\boost_compute\0\0�0F0 0q0�00�0�0~0�0\00-0}0�0i00 0�", "C:\Users\Goktu\AppData\Roaming\boost_compute\0" 1 warning generated. 1 warning generated. Failed to read file: C:\Users\Goktu\AppData\Local\Temp\dep-714835.d [LightGBM] [Warning] boost::filesystem::create_directories: The filename, directory name, or volume label syntax is incorrect [system:123]: "C:\Users\Goktu\AppData\Roaming\boost_compute\0�\0~0r0p0.0�0�0�0�070�0�0�0W0�0�0z0�050", "C:\Users\Goktu\AppData\Roaming\boost_compute\0�\0~0r0p0.0�0�0�0�070�0�0�0W0�0�0z0�050"[LightGBM] [Warning] boost::filesystem::create_directories: The filename, directory name, or volume label syntax is incorrect [system:123]: "C:\Users\Goktu\AppData\Roaming\boost_compute\0�\0�0K0)0�0�0�0 0H0�070�0B0�0�0�0�0x0�0P", "C:\Users\Goktu\AppData\Roaming\boost_compute\0�\0�0K0)0�0�0�0 0H0�070�0B0�0�0�0�0x0�0P" [LightGBM] [Warning] boost::filesystem::create_directories: The filename, directory name, or volume label syntax is incorrect [system:123]: "C:\Users\Goktu\AppData\Roaming\boost_compute\0�\0�0�0�0�0�00�0<0�0$0C0�0k0M0�0�0�0�0", "C:\Users\Goktu\AppData\Roaming\boost_compute\0�\0�0�0�0�0�00�0<0�0$0C0�0k0M0�0�0�0�0" [LightGBM] [Warning] boost::filesystem::create_directories: The filename, directory name, or volume label syntax is incorrect [system:123]: "C:\Users\Goktu\AppData\Roaming\boost_compute\0␦\0�0F0B0�0�0�0e0�0�0^0�0�0.0.0�0�0n04", "C:\Users\Goktu\AppData\Roaming\boost_compute\0␦" 1 warning generated. [LightGBM] [Warning] boost::filesystem::create_directories: The filename, directory name, or volume label syntax is incorrect [system:123]: "C:\Users\Goktu\AppData\Roaming\boost_compute\0�\00 0�0+0�0�0�00�0S0�0u0�0�0)0�0@0�", "C:\Users\Goktu\AppData\Roaming\boost_compute\0�\00 0�0+0�0�0�00�0S0�0u0�0�0)0�0@0�"[LightGBM] [Warning] boost::filesystem::create_directories: The filename, directory name, or volume label syntax is incorrect [system:123]: "C:\Users\Goktu\AppData\Roaming\boost_compute\0\0�000/0�0�0y0O0[070a0�0�0~0�0�0R0'", "C:\Users\Goktu\AppData\Roaming\boost_compute\0" [LightGBM] [Warning] boost::filesystem::create_directories: The filename, directory name, or volume label syntax is incorrect [system:123]: "C:\Users\Goktu\AppData\Roaming\boost_compute\0�\0&0�0\0y0�0�0�00<0}0i00�0050U0y00b", "C:\Users\Goktu\AppData\Roaming\boost_compute\0�\0&0�0\0y0�0�0�00<0}0i00�0050U0y00b" [LightGBM] [Warning] boost::filesystem::create_directories: The filename, directory name, or volume label syntax is inco0�00h0�0�0"0�0�0?0�0�", "C:\Users\Goktu\AppData\Roaming\boost_compute\0�\0�0�0�0�000�0

[LightGBM] [Warning] boost::filesystem::create_directories: The filename, directory name, or volume label syntax is incorrect [system:123]: "C:\Users\Goktu\AppData\Roaming\boost_compute\0#\0_00�0�0�0�0�0�0�0�010�0�0�00r0�0 0", "C:\Users\Goktu\AppData\Roaming\boost_compute\0#\0_00�0�0�0�0�0�0�0�010�0�0�00r0�0 0""

Conda info:

" active environment : base active env location : C:\Users\Goktu\anaconda3 shell level : 1 user config file : C:\Users\Goktu.condarc populated config files : C:\Users\Goktu\anaconda3.condarc C:\Users\Goktu.condarc conda version : 24.11.3 conda-build version : 24.9.0 python version : 3.12.3.final.0 solver : libmamba (default) virtual packages : __archspec=1=skylake __conda=24.11.3=0 __cuda=13.0=0 __win=0=0 base environment : C:\Users\Goktu\anaconda3 (writable) conda av data dir : C:\Users\Goktu\anaconda3\etc\conda conda av metadata url : None channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Users\Goktu\anaconda3\pkgs C:\Users\Goktu.conda\pkgs C:\Users\Goktu\AppData\Local\conda\conda\pkgs envs directories : C:\Users\Goktu\anaconda3\envs C:\Users\Goktu.conda\envs C:\Users\Goktu\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/24.11.3 requests/2.32.3 CPython/3.12.3 Windows/11 Windows/10.0.26100 solver/libmamba conda-libmamba-solver/24.9.0 libmambapy/1.5.8 aau/0.4.4 c/CNhYqbMCjfELdTuNCm6Udg s/R2T8Xg3P_DhYsuzuvjE0kw e/slg2Vkt7QLxK3OLNm1oT1w administrator : False netrc file : None offline mode : False"

And finally the command that i used to install lightgbm: conda install -c conda-forge lightgbm

seicatsu avatar Aug 16 '25 15:08 seicatsu

Ok @seicatsu thanks for the comment, we can re-open this, seeing two separate reports suggests this is a problem we need to investigate.

jameslamb avatar Oct 13 '25 19:10 jameslamb