YttriLab / A-SOID

An active learning platform for expert-guided, data efficient discovery of behavior.
Other
55 stars 7 forks source link

AttributeError: module 'numpy' has no attribute 'long' ; Issues with Python 3.10.13 #56

Closed DavidGill159 closed 11 months ago

DavidGill159 commented 11 months ago

Bug Description: Try to launch asoid app from Anaconda prompt. Error seen in screenshot returned. Numpy version == 1.22.4

To Reproduce

  1. activate asoid environment
  2. launch asoid app

Expected behavior Asoid app to load without error

Desktop:

Additional context common issues found:

my python packages: python==3.10.13 streamlit==1.20.0 numpy==1.22.4 pandas==1.5.0 joblib==1.3.2 matplotlib==3.5.3 seaborn==0.12.0 scikit-learn==1.3.0 h5py==3.7.0 plotly==5.10.0 tqdm==4.64.1 numba==0.58.1 (0.52 is not compatible with Python 3.10.13) scipy==1.9.1 stqdm==0.0.4 moviepy==1.0.3 hdbscan==0.8.33 psutil==5.9.1 pillow==9.2.0 click==8.1.3 ipython==8.4.0 setuptools==59.8.0 ffmpeg-python==0.2.0

Thanks in advance!

Screenshot 2023-12-04 133901 Screenshot 2023-12-04 133918
JensBlack commented 11 months ago

Seems like a numpy version issue from the first look. But the function shouldn't be removed until 1.24, so that's weird!

Can you try installing everything on python 3.8 to get the numba version indicated in the requirements? Maybe we need to be more restrict on the python version until numba is properly updated.

JensBlack commented 11 months ago

I installed asoid with your package specifications and did not encounter any issues.

To install A-SOiD with Python 3.10.13, I actually needed to make a few additional changes (see below).

Did you create a new environment with conda env create --file asoid.yml when installing A-SOiD or did you update an existing environment?

Content of my altered requirements.txt

streamlit==1.20.0
streamlit_option_menu
opencv-python
hydralit
numpy==1.22.4
pandas==1.5.0
joblib==1.3.2
matplotlib==3.5.3
seaborn==0.12.0
scikit-learn==1.3.0
h5py==3.7.0
plotly==5.10.0
tqdm==4.64.1
numba==0.58.1
scipy==1.9.1
stqdm==0.0.4
moviepy==1.0.3
hdbscan==0.8.33
psutil==5.9.1
pillow==9.2.0
click==8.1.3
ipython==8.4.0
setuptools==59.8.0
ffmpeg-python==0.2.0
umap-learn

I also had to change setup.py to python_requires = ">=3.10" and changed the yml file to python = 3.10.


Regardless of the python version, the app started without any issues. Let me know if this solved your problem.

DavidGill159 commented 11 months ago

Hi @JensBlack I changed my python requirements as you listed here and modified the yml and setup.py. Now when trying to create the environment I get this error. HOWEVER, I changed my python version to 3.9.7, re-setup asoid and that worked. Thanks for the help!

image
pozel commented 11 months ago

Hi @JensBlack -- thanks for your recommendations. I had similar issues with versions being incompatible and this solution solved my problem. I'm including my original error message here: `Collecting hydralit Using cached hydralit-1.0.14.tar.gz (29 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [44 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\pozel\AppData\Local\Temp\pip-install-rpsenqka\hydralit_ee2c915a4e0a4ba0a626b781c475af6c\setup.py", line 8, in setuptools.setup( File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools__init.py", line 107, in setup return distutils.core.setup(**attrs) File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools_distutils\core.py", line 147, in setup _setup_distribution = dist = klass(attrs) File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools\dist.py", line 486, in init _Distribution.init( File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools_distutils\dist.py", line 283, in init self.finalize_options() File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools\dist.py", line 924, in finalize_options for ep in sorted(loaded, key=by_order): File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools\dist.py", line 923, in loaded = map(lambda e: e.load(), filtered) File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools_vendor\importlib_metadata__init__.py", line 208, in load module = import_module(match.group('module')) File "C:\Users\pozel\Anaconda3\envs\asoid\lib\importlib\init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 961, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 843, in exec_module File "", line 219, in _call_with_frames_removed File "C:\Users\pozel\AppData\Roaming\Python\Python38\site-packages\npe2\init.py", line 9, in from ._dynamic_plugin import DynamicPlugin File "C:\Users\pozel\AppData\Roaming\Python\Python38\site-packages\npe2_dynamic_plugin.py", line 19, in from ._plugin_manager import PluginManager File "C:\Users\pozel\AppData\Roaming\Python\Python38\site-packages\npe2_plugin_manager.py", line 30, in from ._command_registry import CommandRegistry File "C:\Users\pozel\AppData\Roaming\Python\Python38\site-packages\npe2_command_registry.py", line 9, in from .manifest import utils File "C:\Users\pozel\AppData\Roaming\Python\Python38\site-packages\npe2\manifest\init__.py", line 1, in from ._package_metadata import PackageMetadata File "C:\Users\pozel\AppData\Roaming\Python\Python38\site-packages\npe2\manifest_package_metadata.py", line 5, in from pydantic.fields import SHAPE_LIST ImportError: cannot import name 'SHAPE_LIST' from 'pydantic.fields' (C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\pydantic\fields.py) [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.`

JensBlack commented 11 months ago

Hi @JensBlack I changed my python requirements as you listed here and modified the yml and setup.py. Now when trying to create the environment I get this error. HOWEVER, I changed my python version to 3.9.7, re-setup asoid and that worked. Thanks for the help! image

Okay, so we might have some conflicting versions for higher versions of python. I'll make note of that for a future update!

You did not have to adjust the requirements etc. I just documented what I installed as an environment to try to recreate your case.

My current guess is that for some reason your python version was higher than recommended and that resulted in the installation of non-tested versions of numpy.

Thank you for reporting this.

JensBlack commented 11 months ago

Hi @JensBlack -- thanks for your recommendations. I had similar issues with versions being incompatible and this solution solved my problem. I'm including my original error message here: `Collecting hydralit Using cached hydralit-1.0.14.tar.gz (29 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [44 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\pozel\AppData\Local\Temp\pip-install-rpsenqka\hydralit_ee2c915a4e0a4ba0a626b781c475af6c\setup.py", line 8, in setuptools.setup( File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptoolsinit.py", line 107, in setup return distutils.core.setup(attrs) File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools_distutils\core.py", line 147, in setup _setup_distribution = dist = klass(attrs) File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools\dist.py", line 486, in init _Distribution.init( File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools_distutils\dist.py", line 283, in init** self.finalize_options() File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools\dist.py", line 924, in finalize_options for ep in sorted(loaded, key=by_order): File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools\dist.py", line 923, in loaded = map(lambda e: e.load(), filtered) File "C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\setuptools_vendor\importlib_metadatainit.py", line 208, in load module = import_module(match.group('module')) File "C:\Users\pozel\Anaconda3\envs\asoid\lib\importlibinit.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 961, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 843, in exec_module File "", line 219, in _call_with_frames_removed File "C:\Users\pozel\AppData\Roaming\Python\Python38\site-packages\npe2init.py", line 9, in from ._dynamic_plugin import DynamicPlugin File "C:\Users\pozel\AppData\Roaming\Python\Python38\site-packages\npe2_dynamic_plugin.py", line 19, in from ._plugin_manager import PluginManager File "C:\Users\pozel\AppData\Roaming\Python\Python38\site-packages\npe2_plugin_manager.py", line 30, in from ._command_registry import CommandRegistry File "C:\Users\pozel\AppData\Roaming\Python\Python38\site-packages\npe2_command_registry.py", line 9, in from .manifest import utils File "C:\Users\pozel\AppData\Roaming\Python\Python38\site-packages\npe2\manifestinit.py", line 1, in from ._package_metadata import PackageMetadata File "C:\Users\pozel\AppData\Roaming\Python\Python38\site-packages\npe2\manifest_package_metadata.py", line 5, in from pydantic.fields import SHAPE_LIST ImportError: cannot import name 'SHAPE_LIST' from 'pydantic.fields' (C:\Users\pozel\Anaconda3\envs\asoid\lib\site-packages\pydantic\fields.py) [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.`

Great to here that this helped.