jnwatson / py-lmdb

Universal Python binding for the LMDB 'Lightning' Database
http://lmdb.readthedocs.io/
Other
646 stars 106 forks source link

Import patch-ng via a copy to avoid incompatible with Python 3.12 #352

Closed Bye-lemon closed 5 months ago

Bye-lemon commented 1 year ago

I meet the same error in #351, I fixed this issue in this way. Here is the output when I run command pip install .:

Processing d:\*******\py-lmdb
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: lmdb
  Building wheel for lmdb (pyproject.toml) ... done
  Created wheel for lmdb: filename=lmdb-1.4.1-cp312-cp312-win_amd64.whl size=100043 sha256=4a490dc24a4ef1e6e4059b12665953a2747ce1502a325a06576b539a4b9c8dc7
  Stored in directory: c:\users\*******\appdata\local\pip\cache\wheels\55\74\fe\bad0b32c74ea27c09bcd2d4217dedcd6ec5cb7e4809f11d522      
Successfully built lmdb
Installing collected packages: lmdb
Successfully installed lmdb-1.4.1

Py-LMDB is a helpful package in my work, I hope it can be compatible with Python 3.12. My PR could be helpful.

Kang9401 commented 8 months ago

Collecting lmdb Using cached lmdb-1.4.1.tar.gz (881 kB) 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 ╰─> [27 lines of output] py-lmdb: Using bundled liblmdb with py-lmdb patches; override with LMDB_FORCE_SYSTEM=1 or LMDB_PURE=1. Traceback (most recent call last): File "", line 92, in ModuleNotFoundError: No module named 'patch_ng'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "E:\python项目\Learn\env\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "E:\python项目\Learn\env\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 "E:\python项目\Learn\env\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\Admin\AppData\Local\Temp\pip-build-env-u2700k4v\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\Admin\AppData\Local\Temp\pip-build-env-u2700k4v\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-u2700k4v\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
      super().run_setup(setup_script=setup_script)
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-u2700k4v\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 94, in <module>
  Exception: Building py-lmdb from source on Windows requires the "patch-ng" python module.
  [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.

Bye-lemon commented 8 months ago

@Kang9401 You could clone my fork version, https://github.com/Bye-lemon/py-lmdb/tree/master . Then use command pip install . in your environment.

Yapeng-Gao commented 6 months ago

@Kang9401 You could clone my fork version, https://github.com/Bye-lemon/py-lmdb/tree/master . Then use command pip install . in your environment.

It does work!

lamegaton commented 6 months ago

@Kang9401 You could clone my fork version, https://github.com/Bye-lemon/py-lmdb/tree/master . Then use command pip install . in your environment.

Thanks @Kang9401, it works!

tiam-bloom commented 6 months ago

image Hello, I clone your py-lmdb project and execute pip install .command get some error, can you help me ?please

Suvoo commented 5 months ago

@Kang9401 You could clone my fork version, https://github.com/Bye-lemon/py-lmdb/tree/master . Then use command pip install . in your environment.

This works for python 3.12! thanks

jnwatson commented 5 months ago

Thank you for your contribution. However, there's no need to inline build dependencies. Just install patch-ng the normal way ('pip install patch-ng') and it will work fine.

After I push the pre-built 3.12 wheels, you won't even need to do that.