JamesYang007 / adelie

A fast and flexible Python package for solving group lasso and elastic net problems.
https://jamesyang007.github.io/adelie/
MIT License
16 stars 1 forks source link

Problems encountered with Windows installation #101

Closed Tianbo-Diao closed 3 months ago

Tianbo-Diao commented 4 months ago

System: Win10 python version: 3.11.8 pip install adelie

Collecting adelie Using cached adelie-1.1.34.tar.gz (1.6 MB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [18 lines of output] Traceback (most recent call last): File "D:\Python\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "D:\Python\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dtb\AppData\Local\Temp\pip-build-env-68091si4\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dtb\AppData\Local\Temp\pip-build-env-68091si4\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires self.run_setup() File "C:\Users\dtb\AppData\Local\Temp\pip-build-env-68091si4\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup exec(code, locals()) File "", line 30, in AttributeError: 'NoneType' object has no attribute 'split' [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

JamesYang007 commented 4 months ago

Thanks for letting me know! I suspected the windows build was going to fail because I wasn't taking it into consideration. I'll start a PR for this. Btw, I think you're going to need the Developer Installation instructions. I am also just realizing that building from source through pip may not work since I have dependencies only available through conda.

Tianbo-Diao commented 4 months ago
您好,邮件已收到,会尽快处理。
JamesYang007 commented 4 months ago

Try cloning the repo and go to james.yang/windows-build branch. Follow the developer installation instructions and let me know if you still have problems.

Tianbo-Diao commented 4 months ago

Thanks for your reply, I'm testing it according to your instructions. I used to install libraries such as numpy and scipy directly with pip on Windows, but I can't solve the conda operation yet, I still encountered some problems, mainly because my level is a bit weak. Or one possible solution is to refer to the release method of numpy (https://github.com/numpy/numpy/releases/tag/v1.26.4) or scipy (https://github.com/scipy/scipy/releases), but it may add extra workload for you.

JamesYang007 commented 4 months ago

Those releases just compress their git repo. It's no different from cloning my repo. These libraries usually package the third-party dependencies as well so that it's fully self-contained. I used to do it like that too, but the repo felt unnecessarily bulky so I reverted to making all dependencies installed through conda or pip. I'm not sure if mamba exists on windows, but anaconda surely does and that's all you need - you just need some conda (so you can use conda ... instead of mamba ...). Then all the commands should go through?

Tianbo-Diao commented 4 months ago

Thanks for your reply, I tried it on Windows and tried to install it using conda environment with the following steps:

  1. Create an environment with the name qr and activate it:
    conda create -n qr python=3.11.8
    conda activate qr
  2. I downloaded and unzipped the adelie source code and put it in a folder on my D drive, then, cd to the appropriate file location:
    
    cd /d  D:\Python\Lib\site-packages\adelie-main

This is the corresponding display in the conda environment qr, run the install command

(qr) D:\Python\Lib\site-packages\adelie-main>python setup.py install

3.  Tips after running: 

(qr) D:\Python\Lib\site-packages\adelie-main>python setup.py install Traceback (most recent call last): File "D:\Python\Lib\site-packages\adelie-main\setup.py", line 4, in from pybind11.setup_helpers import Pybind11Extension ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'pybind11'

4.  Install the `pybind11` library and keep running:

(qr) D:\Python\Lib\site-packages\adelie-main>pip install pybind11 Collecting pybind11 Using cached pybind11-2.12.0-py3-none-any.whl.metadata (9.5 kB) Using cached pybind11-2.12.0-py3-none-any.whl (234 kB) Installing collected packages: pybind11 Successfully installed pybind11-2.12.0

5. The problem is in this step:

(qr) D:\Python\Lib\site-packages\adelie-main>python setup.py install Traceback (most recent call last): File "D:\Python\Lib\site-packages\adelie-main\setup.py", line 30, in extra_compile_args = sysconfig.get_config_var('CFLAGS').split() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'split'



 _File "D:\Python\Lib\site-packages\adelie-main\setup.py", line 30, in <module>
    extra_compile_args = sysconfig.get_config_var('CFLAGS').split()_

I've tried to solve the problem myself with references, without success, so I'm not sure if that would help with this problem?

- [What should I do with these error when I try to install strtotime?](https://stackoverflow.com/questions/75459293/what-should-i-do-with-these-error-when-i-try-to-install-strtotime)
- [setup.py](https://github.com/KxSystems/pyq/blob/master/setup.py)
JamesYang007 commented 4 months ago

There are multiple issues with what you tried.

  1. It sounds like you are unpacking adelie tarball that was uploaded as a release. This will of course not contain the branch linked to this issue, so you won't be able to see the fixes I'm making. On my branch james.yang/windows-build, I fixed the CFLAGS issue in step 5.
  2. You are creating an essentially empty conda environment. You are seeing errors regarding pybind11 because you didn't have it installed upon creating the conda environment. My repo contains environment.yml and pyproject.toml which specify exactly the dependencies you need. Please refer to my directions on Developer Installation.

Please try the following:

  1. Git clone the repo in your favorite directory and change directory:
    git clone git@github.com:JamesYang007/adelie.git
    cd adelie
  2. Change to the branch linked to this issue:
    git checkout james.yang/windows-build
  3. Create the conda environment and install the dependencies using poetry by doing step 3 of the Developer Installation. Again, any reference to mamba should be replaced with conda for you.
  4. Install adelie in your conda environment by doing one of the following:
    pip install . 
    pip install -e . # editable mode
JamesYang007 commented 4 months ago

Closing for now due to inactivity. Feel free to reopen the issue if you still need help!

JamesYang007 commented 3 months ago

Reviving since a proper Windows build is needed for adelie-r now.