PufferLib
PufferLib copied to clipboard
pip install error
windows wsl The pip install bufferlib error is as follows: Using cached pufferlib-0.4.0.tar.gz (92 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Traceback (most recent call last):
File "
note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
× Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip. hint: See above for details.
Which python version are you running right now? It seems like the recent python versions (e.g. 3.11 and 3.12) wouldn't work from what I've seen in the setup.py...
Which python version are you running right now? It seems like the recent python versions (e.g. 3.11 and 3.12) wouldn't work from what I've seen in the setup.py...
Indeed. I was able to install it with Python 3.9.19, but not with 3.12.4 (error message below).
Collecting pufferlib
Using cached pufferlib-1.0.1.tar.gz (315 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
╰─> [33 lines of output]
Traceback (most recent call last):
File "/Users/USER/miniconda3/envs/puffer1/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Users/USER/miniconda3/envs/puffer1/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/USER/miniconda3/envs/puffer1/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
backend = _build_backend()
^^^^^^^^^^^^^^^^
File "/Users/USER/miniconda3/envs/puffer1/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/USER/miniconda3/envs/puffer1/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/private/var/folders/xx/sqh3_fb17fl4dd3yly4jj461qq6y0d/T/pip-build-env-p1px24n3/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
import setuptools.version
File "/private/var/folders/xx/sqh3_fb17fl4dd3yly4jj461qq6y0d/T/pip-build-env-p1px24n3/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/private/var/folders/xx/sqh3_fb17fl4dd3yly4jj461qq6y0d/T/pip-build-env-p1px24n3/overlay/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2191, in <module>
register_finder(pkgutil.ImpImporter, find_on_path)
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
[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.
The start of this thread is from 0.4, super old version
As of 1.0, I have it running with Python 3.11 by default. I don't think I have tested 3.12. Is that the full error?
Yep, that's the whole thing. I noticed this issue, mentioned here, is caused by the deprecation of the pkgutil.ImpImporter class in Python 3.12. In the link they suggest setting the NumPy version in setup.py to 1.26 to avoid this issue, but I tried that and it still didn't work. I guess this is caused by some other old dependency then.
conda create --name puffer python=3.12 -y
conda activate puffer
conda install pip -y
pip install pufferlib
Either way, I was able to install and run it on Python 3.11.
I was able to install Pufferlib by upgrading NumPy to version 1.26.4. You can modify this requirement in setup.py. Everything seems to be working fine afterward. setup.py.patch