Closed ostrolucky closed 3 years ago
I faced into it with Python 3.9 on Ubuntu.
I think you just need to update Cython. There are precompiled binaries for the most common platforms.
Thanks for your response, I have the latest version of cpython installed (via pip). Here is a reproducible:
Originally reproducible via ghtopdep:
docker run -it python:3.9 /bin/bash
git clone https://github.com/github-tooling/ghtopdep
cd ghtopdep
python setup.py install
pip install -e .
Expected: works
Actual: I get the stack-trace with selectolax/parser.c:9859:60: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’; did you mean ‘tp_dict’?
When building the wheel also on such a Docker container and copying into the other container, installing it, then it works.
docker run -it python:3.9 /bin/bash
git clone --recursive https://github.com/rushter/selectolax
cd selectolax
pip install -r requirements_dev.txt
python setup.py install
python setup.py bdist_wheel
# Copy the following file into the other container, then it works:
# /selectolax/dist/selectolax-0.2.11-cp39-cp39-linux_x86_64.whl
So I would guess, that something when compiling/releasing and publishing to Pypi is not configured correctly. Will investigate further.
I saw 7e49aff99b97d51cd1194e64a90c115f69614527, seems like that could fix it since their changelog contains some related fixed.
I've made a new release with more builds.
You can also try running python setup.py install --cython
Is unfortunately still reproducible. These are the reproduce steps:
docker run -it python:3.9 /bin/bash
git clone https://github.com/github-tooling/ghtopdep
cd ghtopdep
python setup.py install
pip install -e .
The error will come in the last pip install -e .
command. I ensured a new Docker container + pinned the version to your recent version to ensure its not a caching problem.
When building selectolax
directly via the repository it works, so there seems still something odd going on with the wheels.
You need to fill an issue to ghtopdep
, because it requires 0.1.x
version of selectolax
and it's pretty old. Python 3.9 has some breaking changes in API so that's why you can't compile an old version of selecolax on a new Python version. When you compile it locally from the repo, it regenerates all the C code as well.
root@italy:~# docker run -it python:3.9 /bin/bash
root@10291f514fb0:/# pip install selectolax
Collecting selectolax
Downloading selectolax-0.2.12-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.9 MB)
|████████████████████████████████| 1.9 MB 8.5 MB/s
Installing collected packages: selectolax
Successfully installed selectolax-0.2.12
The easy workaround for your problem is to pip install Cython>=0.29.23
before installing ghtopdep
on a new environment. This will force code regeneration even when you try to install an old version of selectolax.
https://github.com/rushter/selectolax/blob/386392c6c5418216d2faae122af4b9698d75ab01/setup.py#L18
Yeah in my case this was also during installation of ghtopdep
. I guess we can close the issue if this is about old version of selectolax, because in that case there is nothing to do here, ghtopdep
really needs to just update its dependencies.
Let me update an upstream issue and thanks @rushter for your effort in upgrading the release infra.
Upstream issue: https://github.com/github-tooling/ghtopdep/issues/15
I have MacOS Big Sur. Didn't try on other platforms