Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] Removed unneed exception #1864

Closed
wants to merge 1 commit into from
Closed

[python] Removed unneed exception #1864

wants to merge 1 commit into from

Conversation

KOLANICH
Copy link

No description provided.

@StrikerRUS
Copy link
Collaborator

Linking #1129.

@StrikerRUS
Copy link
Collaborator

I think that the compromise solution will be to create a new 32bit installation flag and write something like this:

self.32bit = 0

…

if (8 * struct.calcsize("P")) != 64:
    if self.32bit:
        warnings.warn("You're installing 32-bit version. This version is untested, so use it on your own risk.")
    else:
        raise Exception('Cannot install LightGBM in 32-bit Python, please use 64-bit Python instead.') 

This flag will guarantee

  • user is installing LightGBM in 32-bit environment consciously;
  • user is aware about that 32-bit version is unsupported;
  • user is building from sources in their environment, but not installing from pre-built wheel.

Leaving this for a decision of other maintainers.

@KOLANICH
Copy link
Author

This version is untested

How are they untested? CI can be used to test them.

user is building from sources in their environment, but not installing from pre-built wheel.

Why not? What's wrong with installing them versions from wheels?

user is aware about that 32-bit version is unsupported;

I guess a warning and a token in version for a prebuilt wheel is enough.

@StrikerRUS
Copy link
Collaborator

How are they untested? CI can be used to test them.

We won't waste CI time for this.

Why not? What's wrong with installing them versions from wheels?

All wheels contain the shared library file compiled in and for 64-bit environment.

I guess a warning and a token in version for a prebuilt wheel is enough.

As it has been already mentioned in #1129,

The code is designed for 64-bit platform. Compiling to 32-bit is possible, but it will be much slower. And 32-bit system is going to be replaced by 64 bit system.

So, we won't provide wheels for 32-bit environment.

In general, I agree that allowing to use LightGBM for any special and rare cases on 32-bit machines is OK, but it's out of the project's scope to provide any other support for 32-bit.

@StrikerRUS StrikerRUS changed the title Removed unneed exception [python] Removed unneed exception Nov 25, 2018
@StrikerRUS
Copy link
Collaborator

ping @guolinke @chivee @henry0312 @Laurae2 in this thread

@Laurae2
Copy link
Contributor

Laurae2 commented Jan 13, 2019

32-bit LightGBM installation in Python should raise at least a warning (ideally: prevent installation, and add in documentation the workaround).

In R, we are prohibiting the 32-bit installation (32-bit R is only existing for compatibility reasons, especially in Windows).

As pointed by @StrikerRUS , 32-bit LightGBM is not a supported setup. However, 32-bit setups might be useful for making proof of concepts such as for IoT devices on ARM 32-bit. Compiling LightGBM binaries work for 32-bit ARM (tested on raspberry pi). In that case, the user already know about the compatibility issues between 32-bit and 64-bit OSes.

@StrikerRUS
Copy link
Collaborator

ping @guolinke @chivee @henry0312 @jameslamb for your opinions.

@jameslamb
Copy link
Collaborator

I agree with @Laurae2 . In my opinion, it should be possible to run in 32-bit Python with a workaround but that should take sufficient effort that a user doing it understands they are doing something unsupported.

@guolinke
Copy link
Collaborator

if the 32-bit python can call the compiled 64-bit LightGBM dynamic library, I think we can raise a warning, instead of an exception.

@StrikerRUS
Copy link
Collaborator

@guolinke I guess, the main point of this PR was to allow using of (precompiled) 32-bit LightGBM library, as pointed by @Laurae2 #1864 (comment) and in this issue #1129.

@guolinke
Copy link
Collaborator

@StrikerRUS okay, I think we can have a document about the compilation of 32-bit version.

@StrikerRUS
Copy link
Collaborator

For the record

if the 32-bit python can call the compiled 64-bit LightGBM dynamic library

It can't.

============================= test session starts =============================
platform win32 -- Python 3.6.8, pytest-4.5.0, py-1.8.0, pluggy-0.11.0
rootdir: C:\projects\lightgbm
collected 0 items / 5 errors
=================================== ERRORS ====================================
__________ ERROR collecting tests/python_package_test/test_basic.py ___________
..\tests\python_package_test\test_basic.py:7: in <module>
    import lightgbm as lgb
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\__init__.py:8: in <module>
    from .basic import Booster, Dataset
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\basic.py:35: in <module>
    _LIB = _load_lib()
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\basic.py:30: in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
C:\Miniconda36\envs\test-env\lib\ctypes\__init__.py:426: in LoadLibrary
    return self._dlltype(name)
C:\Miniconda36\envs\test-env\lib\ctypes\__init__.py:348: in __init__
    self._handle = _dlopen(self._name, mode)
E   OSError: [WinError 193] %1 is not a valid Win32 application
_______ ERROR collecting tests/python_package_test/test_consistency.py ________
..\tests\python_package_test\test_consistency.py:6: in <module>
    import lightgbm as lgb
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\__init__.py:8: in <module>
    from .basic import Booster, Dataset
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\basic.py:35: in <module>
    _LIB = _load_lib()
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\basic.py:30: in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
C:\Miniconda36\envs\test-env\lib\ctypes\__init__.py:426: in LoadLibrary
    return self._dlltype(name)
C:\Miniconda36\envs\test-env\lib\ctypes\__init__.py:348: in __init__
    self._handle = _dlopen(self._name, mode)
E   OSError: [WinError 193] %1 is not a valid Win32 application
__________ ERROR collecting tests/python_package_test/test_engine.py __________
..\tests\python_package_test\test_engine.py:11: in <module>
    import lightgbm as lgb
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\__init__.py:8: in <module>
    from .basic import Booster, Dataset
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\basic.py:35: in <module>
    _LIB = _load_lib()
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\basic.py:30: in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
C:\Miniconda36\envs\test-env\lib\ctypes\__init__.py:426: in LoadLibrary
    return self._dlltype(name)
C:\Miniconda36\envs\test-env\lib\ctypes\__init__.py:348: in __init__
    self._handle = _dlopen(self._name, mode)
E   OSError: [WinError 193] %1 is not a valid Win32 application
_________ ERROR collecting tests/python_package_test/test_plotting.py _________
..\tests\python_package_test\test_plotting.py:5: in <module>
    import lightgbm as lgb
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\__init__.py:8: in <module>
    from .basic import Booster, Dataset
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\basic.py:35: in <module>
    _LIB = _load_lib()
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\basic.py:30: in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
C:\Miniconda36\envs\test-env\lib\ctypes\__init__.py:426: in LoadLibrary
    return self._dlltype(name)
C:\Miniconda36\envs\test-env\lib\ctypes\__init__.py:348: in __init__
    self._handle = _dlopen(self._name, mode)
E   OSError: [WinError 193] %1 is not a valid Win32 application
_________ ERROR collecting tests/python_package_test/test_sklearn.py __________
..\tests\python_package_test\test_sklearn.py:7: in <module>
    import lightgbm as lgb
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\__init__.py:8: in <module>
    from .basic import Booster, Dataset
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\basic.py:35: in <module>
    _LIB = _load_lib()
C:\Miniconda36\envs\test-env\lib\site-packages\lightgbm\basic.py:30: in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
C:\Miniconda36\envs\test-env\lib\ctypes\__init__.py:426: in LoadLibrary
    return self._dlltype(name)
C:\Miniconda36\envs\test-env\lib\ctypes\__init__.py:348: in __init__
    self._handle = _dlopen(self._name, mode)
E   OSError: [WinError 193] %1 is not a valid Win32 application
!!!!!!!!!!!!!!!!!!! Interrupted: 5 errors during collection !!!!!!!!!!!!!!!!!!!
=========================== 5 error in 2.77 seconds ===========================

Log: https://ci.appveyor.com/project/guolinke/lightgbm/builds/24739289/job/cck9hh9ni82k802a.

https://stackoverflow.com/a/55734490

@lock lock bot locked as resolved and limited conversation to collaborators Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants