Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cchardet requirement, Python 3.11 compat #922

Closed
pansen opened this issue Oct 26, 2022 · 6 comments
Closed

cchardet requirement, Python 3.11 compat #922

pansen opened this issue Oct 26, 2022 · 6 comments
Labels

Comments

@pansen
Copy link

pansen commented Oct 26, 2022

Hi,

first: thank you for your great library. I much enjoy using that :)

With the release of Python 3.11 I was checking my projects upgrade capabilities and it turns out, that cchardet is a difficult candidate. There is already an open issue for Python 3.10 (how is this working for Python 3.10 then anyway ...) and the project seems not maintained anymore.

In the sourcecode of cryptofeed I was looking for places where cchardet is actually used, as I wanted to see if it can be replaced with charset-normalizer (via SO) but couldn't find the location.

So my questions are:

  • is cchardet used
  • if so, where (maybe I can put some work in it to replace it)

Best, Andi

@pansen
Copy link
Author

pansen commented Oct 27, 2022

Stupid question, sorry. I was using ripgrep and not grep, which skipped the relevant files.

@pansen pansen closed this as completed Oct 27, 2022
@peedrr
Copy link
Contributor

peedrr commented Nov 30, 2022

@pansen - Notwithstanding your "stupid question" 😜 I think this issue should be re-opened.

Cryptofeed does not build out-of-the-box on 3.11.0 and it does indeed seems that cchardet is the culprit.

      src/cchardet/_cchardet.cpp:196:12: fatal error: 'longintrepr.h' file not found
        #include "longintrepr.h"
                 ^~~~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> cchardet

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Potential solutions:

  1. Wait for fix on cchardet (NB @pansen's comment re. no longer maintained; latest release is > 2 years old)
  2. Find a suitable replacement to cchardet

Regarding (2), there is a note in setup.py that cchardet is optional. Cryptofeed does indeed build (and run) when using the Python chardet. @bmoscon: thoughts on abandoning cchardet in favour of Python chardet? (In terms of speed gained using Python 3.11 plus speed lost by not using Cchardet?) Is there perhaps some clever way to conditionally install Python chardet if Python version ≥ 3.11 else Cchardet?

Temporary solutions:
I propose we Update README.md (and probably INSTALL.md as well) to state that "Cryptofeed requires Python ≥ 3.8 < 3.11", or give explicit instructions how to opt for Python chardet instead of Cchardet.

@bmoscon
Copy link
Owner

bmoscon commented Dec 5, 2022

I was able to get it working with 3.11, what error do you get?

@peedrr
Copy link
Contributor

peedrr commented Dec 5, 2022

I pasted the error above

@peedrr
Copy link
Contributor

peedrr commented Dec 5, 2022

My setup was Python 3.11 within Conda env, running on Mac. It wouldn't build from either source or pip

@bmoscon
Copy link
Owner

bmoscon commented Mar 4, 2023

resolved with latest commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants