Closed jnahlers closed 2 weeks ago
Tested on Windows 10 and Rocky Linux 9.2. Both throw the exception.
Some more info: I tried fresh conda envs with python=3.9
. Using pip install scikit-fda
I still get the exception coming up, but using conda install -c conda-forge scikit-fda
the import worked fine.
I would love to hear if this is reproducible, I feel like I might be running into some weird python/conda misconfiguration bug.
I'm getting a similar error to the one mentioned in this issue when I try to import the library. The code causing it is provided below:
>>> from skfda import FDataGrid
Traceback (most recent call last):
File "/Users/username/Repos/FNNs/model.py", line 3, in <module>
from skfda import FDataGrid
File "/Users/username/.pyenv/versions/FNNs/lib/python3.9/site-packages/lazy_loader/__init__.py", line 83, in __getattr__
attr = getattr(submod, name)
File "/Users/username/.pyenv/versions/FNNs/lib/python3.9/site-packages/lazy_loader/__init__.py", line 82, in __getattr__
submod = importlib.import_module(submod_path)
File "/Users/username/.pyenv/versions/3.9.19/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/username/.pyenv/versions/FNNs/lib/python3.9/site-packages/skfda/representation/grid.py", line 33, in <module>
from .._utils import _check_array_key, _int_to_real, _to_grid_points, constants
ImportError: cannot import name '_check_array_key' from 'skfda._utils' (/Users/username/.pyenv/versions/FNNs/lib/python3.9/site-packages/skfda/_utils/__init__.py)
I installed scikit-fda
in a clean environment using Python 3.9.19.
@jnahlers It seems to be a compatibility issue between scikit-fda
and the latest version of scikit-learn
. I was able to import the package by installing an older version (1.4.0) of scikit-learn
. Like so: pip install scikit-learn==1.4.0
Note that the current development version only works with Python 3.10 onward. Support for Python 3.9 has been dropped as per SPEC0, which is followed by all major scientific packages. Support for Python 3.10 will be dropped at the end of 2024.
Thus, no fixes for Python 3.9 integration with newer packages are planned. I encourage you to upgrade your Python version if you can, and to follow SPEC0 to be aware of the deprecations of particular versions of scientific packages and be able to plan ahead.
I will release a new version as soon as I can merge some recent improvements. In the meantime, it should be possible to install the development version directly from git (for Python >= 3.10):
python -m pip install git+https://github.com/GAA-UAM/scikit-fda.git@develop
As this error refers to Python 3.9 and I have not been able to reproduce it in the current development version (I tested it under Python 3.11), I will close this issue. Please, feel free to reopen the issue if the error remains when upgrading to the latest version.
Note that the current development version only works with Python 3.10 onward. Support for Python 3.9 has been dropped as per SPEC0, which is followed by all major scientific packages. Support for Python 3.10 will be dropped at the end of 2024.
Thanks Carlos! Just a note - the original bug report was for Python 3.10. I also just tried a fresh install on 3.11 and had the same issue (when installing from PyPi). However, when I made another fresh 3.11 env and installed the github development version instead, I had no issue.
Bug description summary
I am trying to follow the example for least squares registration . I am in a fresh conda environment (python=3.10), and have installed scikit-fda from PyPi:
pip install scikit-fda
(installs scikit-fda-0.9.1).When I try and import the registration, I get an import error:
ImportError: cannot import name 'invert_warping' from 'skfda._utils'
I have also tried installing the conda version instead, and get the same error.
conda install -c conda-forge scikit-fda
Code to reproduce the bug
Expected result
I would expect it to import 😄
Actual result
It doesn't import 😢
Traceback (if an exception is raised)
Software versions
scikit-fda version: 0.9.1
Additional context
No response