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

Add support for Python 3.11 and drop support for Python 3.7 #3402

Merged
merged 9 commits into from
Dec 6, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,20 +318,20 @@ def run(self):
'pandas',
]

NUMPY_STR = 'numpy >= 1.17.0'
NUMPY_STR = 'numpy >= 1.23.4'
#
# We pin the Cython version for reproducibility. We expect our extensions
# to build with any sane version of Cython, so we should update this pin
# periodically.
#
CYTHON_STR = 'Cython==0.29.28'
CYTHON_STR = 'Cython==0.29.32'

# Allow overriding the Cython version requirement
CYTHON_STR = os.environ.get('GENSIM_CYTHON_REQUIRES', CYTHON_STR)

install_requires = [
NUMPY_STR,
'scipy >= 0.18.1',
'scipy >= 1.9.3',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the very latest version of scipy.

We want the oldest version (that works) here, because otherwise we make life difficult for users who don't have the very latest.

Could you please find which is the first version of numpy & scipy to support 3.11?

Copy link
Contributor Author

@acul3 acul3 Nov 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please find which is the first version of numpy & scipy to support 3.11?

just check(install on local..pip)
the oldest version that support 3.11 for scipy and numpy are 1.9.2 and 1.23.0 (not very far from the lastest)

maybe we can add special condition just for python 3.11 ?
something like overriding version(numpy,scipy) like the cython https://github.com/RaRe-Technologies/gensim/blob/c93eb0b647ec9de7cfcb43c74c37f295f2944821/setup.py#L330

Copy link
Owner

@piskvorky piskvorky Nov 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://devguide.python.org/versions/, the currently oldest supported Python (before end-of-life) is Python 3.7. So we can ignore Pythons older than that (3.6 etc).

Now looking at SciPy's compatibility matrix https://docs.scipy.org/doc/scipy/dev/toolchain.html :

Screen Shot 2022-11-08 at 10 22 27

It seems for 3.11 we need Scipy 1.9.0 (or .1?) and Numpy 1.18.5. Which doesn't match your the oldest version that support 3.11 for scipy and numpy are 1.9.2 and 1.23.0 – can you verify please?

maybe we can add special condition just for python 3.11 ?

I don't think so. Gensim is a library used by ML developers, so we can afford to update its dependencies. We just shouldn't do it without a reason. @mpenkov WDYT?

If the matrix above is correct, I'd go with Scipy>=1.9.0 and Numpy>=1.18.5.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that's fine. The versions you suggested also make sense to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah thank you for detail and correction

my missunderstanding
i refer to this issue scipy/scipy#16851 (comment) for oldest "wheel" scipy 1.9.2 and https://numpy.org/news/ for numpy

If the matrix above is correct, I'd go with Scipy>=1.9.0 and Numpy>=1.18.5.

just tried with this version and it works

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@piskvorky @acul3 Does this mean that 3.6 and 3.7 are no longer supported? If so, we need to update setup.py accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the currently oldest supported Python (before end-of-life) is Python 3.7. So we can ignore Pythons older than that (3.6 etc).

hmm it seems python 3.7 still need supported according to this argument

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the table above, it looks like it's impossible to support both 3.7 and 3.11 using a single version of scipy, numpy, etc.

So, our options are:

  1. Use different versions for Py3.11
  2. Drop 3.7 support now (3.7 reaches EOL in 6 months anyway)
  3. Wait before 3.7 reaches EOL, and then add support for 3.11

Personally, I think 2) is best. 1) requires a fair bit of effort for very little value (6 more months of 3.7 support, and after 6 months the value of that effort goes down to zero). We can do a major version bump. If people really need support for 3.7, they can continue to use the current version of gensim.

@piskvorky thoughts?

Copy link
Owner

@piskvorky piskvorky Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agreed. Now that Python versions go EOL frequently, there isn't much expectation to support older ones (not like when py2.7 was supported for ages).

So I'd give preference to the latest / best versions, rather than stability with older.

'smart_open >= 1.8.1',
]

Expand Down