lericson / pylibmc

A Python wrapper around the libmemcached interface from TangentOrg.
http://sendapatch.se/projects/pylibmc/
BSD 3-Clause "New" or "Revised" License
478 stars 136 forks source link

Release for Python 3.8/9 support #269

Closed matt-dalton closed 1 year ago

matt-dalton commented 3 years ago

I noticed that support for Python 3.8 & 3.9 was merged in back in January. Is there an ETA for when this will be released?

We are trying to upgrade and this is the only library that doesn't yet support those versions.

lericson commented 3 years ago

I will look into it.

lericson commented 3 years ago

There is nothing in that merge that you need. You can just use the latest release.

matt-dalton commented 3 years ago

Ah brilliant OK - I tried it and you're correct. I followed the pull request for 3.8 support and thought those commits were a requirement.

timgraham commented 3 years ago

It would be nice to publish wheel files for these Python versions on PyPI.

lindycoder commented 2 years ago

+1 On having a python 3.8 wheel on pipy! Thank you

reubano commented 2 years ago

Getting an error with py3.9 on mac

pip install pylibmc
Looking in links: file:///Users/reubano/.pip/wheels
Collecting pylibmc
  Using cached pylibmc-1.6.1.tar.gz (64 kB)
Building wheels for collected packages: pylibmc
  Building wheel for pylibmc (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/reubano/.virtualenvs/py39/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-install-kq3upa33/pylibmc/setup.py'"'"'; __file__='"'"'/private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-install-kq3upa33/pylibmc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-wheel-oertpzk4
       cwd: /private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-install-kq3upa33/pylibmc/
  Complete output (28 lines):
  /private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-install-kq3upa33/pylibmc/setup.py:98: DeprecationWarning: 'U' mode is deprecated
    with open("README.rst", "U", encoding="utf-8") as r:
  /private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-install-kq3upa33/pylibmc/setup.py:100: DeprecationWarning: 'U' mode is deprecated
    with open("src/pylibmc-version.h", "U", encoding="utf-8") as r:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.15-x86_64-3.9
  creating build/lib.macosx-10.15-x86_64-3.9/pylibmc
  copying src/pylibmc/autoconf.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
  copying src/pylibmc/pools.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
  copying src/pylibmc/client.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
  copying src/pylibmc/__init__.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
  copying src/pylibmc/test.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
  copying src/pylibmc/consts.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
  copying src/pylibmc/__main__.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
  running build_ext
  building '_pylibmc' extension
  creating build/temp.macosx-10.15-x86_64-3.9
  creating build/temp.macosx-10.15-x86_64-3.9/src
  /usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/opt/local/include -DUSE_ZLIB -I/Users/reubano/.virtualenvs/py39/include -I/opt/local/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_pylibmcmodule.c -o build/temp.macosx-10.15-x86_64-3.9/src/_pylibmcmodule.o -fno-strict-aliasing -std=c99
  In file included from src/_pylibmcmodule.c:34:
  src/_pylibmcmodule.h:42:10: fatal error: 'libmemcached/memcached.h' file not found
  #include <libmemcached/memcached.h>
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for pylibmc
  Running setup.py clean for pylibmc
Failed to build pylibmc
DEPRECATION: Could not build wheels for pylibmc which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: pylibmc
    Running setup.py install for pylibmc ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/reubano/.virtualenvs/py39/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-install-kq3upa33/pylibmc/setup.py'"'"'; __file__='"'"'/private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-install-kq3upa33/pylibmc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-record-0dy1ojnh/install-record.txt --single-version-externally-managed --compile --install-headers /Users/reubano/.virtualenvs/py39/include/site/python3.9/pylibmc
         cwd: /private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-install-kq3upa33/pylibmc/
    Complete output (28 lines):
    /private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-install-kq3upa33/pylibmc/setup.py:98: DeprecationWarning: 'U' mode is deprecated
      with open("README.rst", "U", encoding="utf-8") as r:
    /private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-install-kq3upa33/pylibmc/setup.py:100: DeprecationWarning: 'U' mode is deprecated
      with open("src/pylibmc-version.h", "U", encoding="utf-8") as r:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.15-x86_64-3.9
    creating build/lib.macosx-10.15-x86_64-3.9/pylibmc
    copying src/pylibmc/autoconf.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
    copying src/pylibmc/pools.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
    copying src/pylibmc/client.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
    copying src/pylibmc/__init__.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
    copying src/pylibmc/test.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
    copying src/pylibmc/consts.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
    copying src/pylibmc/__main__.py -> build/lib.macosx-10.15-x86_64-3.9/pylibmc
    running build_ext
    building '_pylibmc' extension
    creating build/temp.macosx-10.15-x86_64-3.9
    creating build/temp.macosx-10.15-x86_64-3.9/src
    /usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/opt/local/include -DUSE_ZLIB -I/Users/reubano/.virtualenvs/py39/include -I/opt/local/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_pylibmcmodule.c -o build/temp.macosx-10.15-x86_64-3.9/src/_pylibmcmodule.o -fno-strict-aliasing -std=c99
    In file included from src/_pylibmcmodule.c:34:
    src/_pylibmcmodule.h:42:10: fatal error: 'libmemcached/memcached.h' file not found
    #include <libmemcached/memcached.h>
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    error: command '/usr/bin/clang' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/reubano/.virtualenvs/py39/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-install-kq3upa33/pylibmc/setup.py'"'"'; __file__='"'"'/private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-install-kq3upa33/pylibmc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/m1/z7tt4jpd23z27g6n21yyrh2h0000gp/T/pip-record-0dy1ojnh/install-record.txt --single-version-externally-managed --compile --install-headers /Users/reubano/.virtualenvs/py39/include/site/python3.9/pylibmc Check the logs for full command output.
WARNING: You are using pip version 20.2.2; however, version 21.3.1 is available.
You should consider upgrading via the '/Users/reubano/.virtualenvs/py39/bin/python -m pip install --upgrade pip' command.
hugovk commented 2 years ago

@reubano Upgrade pip first and try again?

timgraham commented 2 years ago

@reubano, since there's no wheel for Python 3.9 yet, the source code is built and installed. This requires libmemcached-dev on Linux. I'm not sure of the equivalent on MacOS, but some searching suggests brew install libmemcached might work.

reubano commented 2 years ago

Just got a new mac and reinstalled everything. It all installed fine. I also installed libmemcached, memcached, and memcachedb via Macports so that was likely what did it.

pythonmobile commented 2 years ago

waiting for the new version :)

ajnisbet commented 2 years ago

For anyone wanting to build your own wheels (e.g. for a private pypi server or a multi-stage docker image) the steps are

  1. Install libmemcached-dev
  2. Build pylibmc wheel
  3. Run auditwheel to fix the missing shared libraries.

I'm using this for a debian-based Dockerfile:

# Build container.
FROM python:3.9.10-slim-bullseye as builder
RUN set -e && \
    apt-get update && \
    apt-get install -y --no-install-recommends \
        gcc \
        libmemcached-dev \
        patchelf \
        python3.9-dev

RUN pip wheel --wheel-dir=/tmp/wheels pylibmc==1.6.1 && \
    pip install auditwheel && \
    auditwheel repair /tmp/wheels/pylibmc-*.whl -w /root/wheels --plat manylinux_2_27_x86_64

# Actual container.
FROM python:3.9.10-slim-bullseye

COPY --from=builder /root/wheels /root/wheels
RUN pip install \
        --no-index \
        --find-links=/root/wheels \
        pylibmc
P403n1x87 commented 2 years ago

The latest release available from PyPI fails to install with Python 3.11. However, the current version on the main branch installs fine. Would it be possible to have a new release in PyPI? This affects, e.g., the installation of the test dependencies for Django.

automotua commented 2 years ago

So basically I got the same error on Mac as @reubano reported above. What I did to resolve it:

  1. My understanding of the problem: The issue is that clang cannot find the libmemcached library when building pylibmc, i.e. libmemcached cannot be found by clang following the search path. Folks above already suggested that we can install libmemcached via brew. So all we need to do is pass the brew installed libmemcached to make it visible to clang again.

  2. So steps: a. brew install libmemcached b. libmemcached exists under /usr/local/Cellar/ after installation. So we do: export LDFLAGS=-L/usr/local/Cellar/libmemcached/1.0.18_2/lib to make it visible to clang c. Also did export CPPFLAGS=-I/usr/local/Cellar/libmemcached/1.0.18_2/include. d. pip install pylibmc - this time it should be fine

Hope this can help.

lericson commented 1 year ago

I'll try getting a release out today. Stay tuned.